datalevin

2024-10-17T09:56:36.171119Z

Why datalevin-native 0.9.12 is not on clojars ? And again no Linux ARM version...

2024-10-17T10:12:02.156369Z

Ahh my bad, didn’t see the -native part. 🀷

2024-10-17T10:13:11.343449Z

Yess... I need for GraalVM compilation

Huahai 2024-10-17T17:13:24.609459Z

because I didn't think people are using it.

Huahai 2024-10-17T17:14:03.820119Z

we are very behind in graalvm version, so I thought people were not using it.

Huahai 2024-10-17T17:14:18.993689Z

another reason is that clojars kept rejecting it for its large size. I don't have time to cut it down. Maybe I need some help here.

Huahai 2024-10-17T17:16:36.348399Z

Sending org/clojars/huahaiy/datalevin-native/0.9.12/datalevin-native-0.9.12.jar (20493k) to https://repo.clojars.org/ Could not transfer artifact org.clojars.huahaiy:datalevin-native:jar:0.9.12 from/to clojars (https://repo.clojars.org): transfer failed for https://repo.clojars.org/org/clojars/huahaiy/datalevin-native/0.9.12/datalevin-native-0.9.12.jar, status: 413 Request Entity Too Large

Huahai 2024-10-17T17:20:57.589249Z

posted in #clojars voice your concern there too if you care about it

2024-10-17T17:35:33.963619Z

Ok. Thank you for answer

2024-10-17T17:40:26.176369Z

But what do you mean "very behind"? There is version 0.9.11... is it different from common 0.9.11?

Huahai 2024-10-17T17:43:29.397989Z

I mean the version of GraalVM we require is very behind compared with the latest version.

2024-10-17T17:43:53.603779Z

Ahhh. I see, 22.3.1 instead of 23

Huahai 2024-10-17T17:44:04.325559Z

that's the reason why clj-lsp dropped us

Huahai 2024-10-17T17:44:59.739569Z

I don't have time to update it, because it requires code change on my part.

Huahai 2024-10-17T17:45:23.308079Z

I welcome contribution.

πŸ‘Œ 1
2024-10-17T17:46:34.688679Z

Ok, I'll take a look maybe on weekend

πŸ™ 1
Huahai 2024-10-17T18:31:05.429159Z

0.9.12 native is pushed.

πŸ™ 1
2024-10-17T18:35:53.380649Z

I see! Thank you

cfleming 2024-10-17T14:17:58.996059Z

Is there a reason that empty is not supported on datoms? A user has reported an issue with Cursive (https://github.com/cursive-ide/cursive/issues/2970), the issue seems to stem from an exception which contains a datom in its ex-data. Cursive uses clojure.walk over the ex-data, and this fails because walk uses empty.

Huahai 2024-10-17T17:23:10.235779Z

No reason. We can add an empty function, and always return false, how's that sound?

cfleming 2024-10-17T17:26:41.583129Z

Sounds ok to me, although I don't really understand the semantics of datoms - whatever you think is reasonable is fine by me.

cfleming 2024-10-17T17:31:32.674069Z

Would you like me to file an issue for this?

Huahai 2024-10-17T17:31:50.060959Z

sure. thanks

cfleming 2024-10-17T17:35:56.664909Z

https://github.com/juji-io/datalevin/issues/286

Huahai 2024-10-17T17:39:09.906079Z

Thanks!

2024-10-17T23:33:11.436919Z

Note that empty returns a new collection of the same type (but empty), unlike empty? which returns a boolean

cfleming 2024-10-18T00:11:51.833679Z

Yep, that's why walk uses it, so that it can rebuild the collections with the returned value from the function you pass it. Whether that makes sense for datoms, I'm not really sure.

Huahai 2024-11-07T06:22:56.458509Z

resolved

πŸ‘ 1
2024-10-17T19:05:35.400409Z

Is it the known behaviour that any future with Datalevin query inside d/with-transaction hangs up the application on deref?

(require '[me.raynes.fs :as fs] '[datalevin.core :as d])
    (let [dtlv-dir (fs/temp-dir "dtlv-sandbox")
          conn     (d/get-conn (str dtlv-dir))
          tr-data  (into [] (map #(array-map :entity/id % :entity/uuid (random-uuid))) (range 1000))]
      (try
        (d/transact conn tr-data)
        (d/with-transaction [cn conn]
          (let [odds (future
                       (d/q '[:find [?e ...]
                              :where
                              [?e :entity/id ?id]
                              [(odd? ?id)]]
                            (d/db cn)))]
            (println @odds)))
        
        (finally
          (fs/delete-dir dtlv-dir)
          (d/close conn))))
On JVM...

Huahai 2024-10-17T19:07:15.885029Z

There's no transaction inside with-transaction. Why would one do that?

2024-10-17T19:08:36.133739Z

It's simplified example..

Huahai 2024-10-17T19:09:15.243069Z

I wound't have a future in with-transaction, what does that even achieve?

Huahai 2024-10-17T19:11:18.771999Z

the basic idea of a transaction is to group a set of actions as an atomic thing. Put a future in there violate this basic assumption.

Huahai 2024-10-17T19:12:02.339879Z

I wouldn't even think about this. So, it's not a known issue, but it is also a wont-fix

Huahai 2024-10-17T19:17:44.990069Z

put a with-transaction inside a future, that's fine, we have lots of tests for those cases.

2024-10-17T19:18:42.114759Z

maybe I understand something wrong about with-transa ction? How I see it: Inside with-transaction block I have something like database "sandbox". So I can do transactions and queries in the block and be sure that nothing outside it will change the state. In the end of with-transaction all changes are flushed to persistence. Isn't it? My idea is to achieve more functional purity for every user request. To be sure that for certain pair of request and database state the result always will be the same...

Huahai 2024-10-17T19:21:57.793539Z

I am not sure about the "sandbox" idea, but the work a read/write transaction does to the DB is not visible outside the transaction until the transaction commit. True. However, it has implications. a LMDB read/write transaction has to be done with a single thread, so putting a future in there is asking for trouble.

Huahai 2024-10-17T19:22:59.236339Z

maybe it can be made to work, but that's not something I want to support.

2024-10-17T19:23:08.406089Z

Okay, now I see

2024-10-17T19:23:38.198089Z

Need to work in one thread

Huahai 2024-10-17T19:24:02.932889Z

because semantically, a transaction should be able to abort and roll back, if some work is done in another thread in a future, how's that going to work?

2024-10-17T19:24:27.801139Z

Yes, that makes sense

πŸ‘ 1
2024-10-17T20:37:44.078039Z

What is behind such behaviour? This query work nice as expected:

(d/q '[:find ?n
        :in $ ?uid
        :where
        [?e :test-entity/user [:user/id ?uid]]
        [?e :test-entity/data ?n]] (dtlv) (:user/id user))
But this one stuck, despite looks like it have to do same:
(d/q '[:find ?n
        :in $ ?uid
        :where
        [?u :user/id ?uid]
        [?e :test-entity/user ?u]
        [?e :test-entity/data ?n]] (dtlv) (:user/id user))

Huahai 2024-10-17T20:42:25.988379Z

What’s stuck?

2024-10-17T20:45:42.594759Z

Second one never completes... calculating forever. Need some research to find out minimal example to reproduce...

Huahai 2024-10-17T20:46:27.380489Z

Thanks

πŸ™ 1
Huahai 2024-10-17T20:51:15.899569Z

Could be a bug . These two went into completely different code paths. The first one has only one entity class, the second has two.