This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-06
Channels
- # aleph (1)
- # announcements (29)
- # babashka (39)
- # beginners (52)
- # cider (3)
- # cljsrn (19)
- # clojure (167)
- # clojure-europe (15)
- # clojure-nl (2)
- # clojure-uk (62)
- # clojurescript (13)
- # community-development (8)
- # cursive (5)
- # datomic (10)
- # introduce-yourself (1)
- # java (10)
- # jobs (12)
- # jobs-discuss (1)
- # kaocha (2)
- # lsp (6)
- # luminus (1)
- # malli (15)
- # meander (3)
- # music (1)
- # nrepl (2)
- # off-topic (91)
- # pathom (4)
- # reagent (21)
- # reitit (10)
- # sci (5)
- # shadow-cljs (17)
- # spacemacs (3)
- # sql (7)
- # tools-deps (40)
- # utah-clojurians (2)
- # xtdb (7)
Hi there, this morning I started my Crux server from scratch and I started receiving these WARN
ings
2021-07-06 09:45:00,872 WARN crux.tx - Transaction function failed when originally evaluated: #crux/id dfd920ebfa0088055b91222ad2e0c99713febdcd #uuid "00bc7b58-10cb-4496-b09a-db4ef308a766" {:crux.db.fn/exception java.lang.NullPointerException, :crux.db.fn/message nil, :crux.db.fn/ex-data nil}
These is some transaction function I was trying out but I am not sure which one is failing - and is there a way to delete them?
Also, why is the transaction function called at startup (just curious to know how it all works)?Hey again. It's generally best to leave the functions where they are, if you can, as it will make things easier to reason about. You can delete/evict them but I really wouldn't recommend it. Regardless, it wouldn't get rid this message though, The transaction function warning is being printed each time you restart the node because I gather your node is using an in-memory index (as per your "am for now using in-memory indexing" comment from the other thread)
> I am not sure which one is failing
You should be able to figure this out by inspecting the tx-log (via open-tx-log
) but there's not a straighforward API for this. You can add some side-effecting logging code into your transaction function to help too.
Thanks gotcha
Hi again, one use case we have that we encode ranges like {:lower-bound 10 :lower-bound-inclusive true :upper-bound 12 :upper-bound-inclusive false}
An idea that I have is to have a rule that conditionally uses Range Queries depending on the above data structure.
I was wondering if I can "swap-in" the right operator conditionally, kind of like when in Clojure you do (if foo > <)
and you use that in function position.
I suspect I can do that with a custom Clojure function, was wondering if I can have a "conditional" rule
Hey 🙂 I think you can do something with multiple rule bodies, like:
{:find [r]
:where [[(identity true) foo]
(my-rule foo 2 3 r)]
:rules [[(my-rule [x a b] r)
[(true? x)]
[(< a b) r]]
[(my-rule [x a b] r)
[(false? x)]
[(> a b) r]]]}
I have noticed the (identity true)
pattern in some of the crux tests...is that a way to use hardcoded values and assign them to variables?
that's exactly right. The other edn Datalog dbs have a special ground
function which in theory provides some performance benefit, but we've not evaluated whether there's really any point to implementing such a thing in Crux (probably no benefit, in my opinion, given how the query engine works) so we stick with identity