Fork me on GitHub
#datalevin
<
2022-12-16
>
Loic03:12:23

So we can use M1 mac now and any version of Java?

Huahai05:12:15

Correct. The library is released for Java 8, so it should work for any version after that.

Huahai05:12:51

Please do test and report, as I do not have a M1. It passed all the tests on a M1 CI runner, so I assume it should work.

Huahai05:12:13

The CI runner ran Java 18.

Huahai05:12:41

The native shared library compiled on macOS Monterey.

Loic06:12:58

Just got a M1 and tried. I still have the error:

Couldn't load Clojure file: Unable to make field long java.nio.Buffer.address accessible: module java.base does not "opens java.nio" to unnamed module @54307ae0  systems.clj   line:39  column:3
The java version:
ava -version
openjdk version "19.0.1" 2022-10-18
OpenJDK Runtime Environment Homebrew (build 19.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 19.0.1, mixed mode, sharing)
The mac specs:
Software:

    System Software Overview:

      System Version: macOS 13.0 (22A380)
      Kernel Version: Darwin 22.1.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: Loic's Laptop
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: 1 day, 21 hours, 39 minutes

Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro18,3
      Model Number: Z15G0018AZP/A
      Chip: Apple M1 Pro
      Total Number of Cores: 8 (6 performance and 2 efficiency)
      Memory: 32 GB
      System Firmware Version: 8419.41.10
      OS Loader Version: 8419.41.10
      Serial Number (system): D3KHY729FQ
      Hardware UUID: 6A9EE39E-2A94-5575-91A4-FE2EC906FB07
      Provisioning UDID: 00006000-001030120AFA401E
      Activation Lock Status: Enabled
Deps in my deps.edn:
datalevin/datalevin {:mvn/version "0.7.2"}
-----------

Huahai06:12:44

You still need to open nio

Loic06:12:35

Sorry, I forgot to specify that. I do have it already: in deps.edn:

:jvm-opts ["--add-opens=java.base/java.nio=ALL-UNNAMED"
           "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED"]

Huahai06:12:23

but your error says otherwise

Loic06:12:02

It has to be put in an alias? cannot be at the deps.edn top level? (I am assuming that's my mistake)

Huahai06:12:21

i am not an expert on deps.edn, in fact i hardly use it

Huahai06:12:38

i think it is more complicated than lein

Loic06:12:51

Ok, let me try to put in in an alias instead, hopefully, that'll do it

Loic06:12:46

Putting the jvm-opts in the alias worked. So I guess, we cannot put it at the top level, could not find doc that confirms it. Sorry for inconvenience! So everything work on my side now! Thanks for the update!

👍 1
Huahai06:12:02

Great to hear that

Huahai06:12:20

Thanks for testing.

Huahai06:12:03

maybe i should put in this info in the installation page.

Loic06:12:46

Yes could be a good idea. How to add on tools.deps and lein.

Huahai07:12:06

Done

🙌 1
Loic09:12:25

I created a docker image using jibbit, but when I start the container, I get:

Syntax error compiling at (datalevin/spill.clj:73:45).
Unable to resolve symbol: random-uuid in this context
It used to work fine on mac intel and java8 I tried with the following base images: (jibbit default) and openjdk:11-slim-buster ------

Huahai15:12:40

Make sure you are using the latest clojure

Huahai15:12:04

random-uuid appears in Clojure 1.11. I expect people are using the latest version of Clojure. There’s no reason not to use the latest Clojure.

Huahai15:12:08

I can release a version that does not use it

Huahai23:12:05

0.7.6 fixes this

Loic13:12:27

I was a bit surprised because our project uses the latest version of Clojure (I did not specify older version of clojure in my deps.edn). But for some reasons, jibbit packaged Clojure 1.10.4. So I specified the 1.11.1 version in my deps.edn to ensure this version is used and it works as expected now. Thank you.

pithyless13:12:54

Just confirming that :jvm-opts needs to be in an alias. https://clojure.atlassian.net/browse/TDEPS-63

🙌 1
👍 1
dvingo19:12:09

Hi, I'm trying to use datalevin kv when running in server mode (via the jar). This is in development, server is running on same machine as the client jvm. I can use the server fine as a datalog store. I get the following error when attempting to open a sub-db though (via (d/open-dbi) :

(def kv-db (d/open-kv ""))
(def table (d/open-dbi kv-db "temp"))
=>
Execution error (ExceptionInfo) at datalevin.client/normal-request (client.clj:342).
Request to Datalevin server failed: "No implementation of method: :open-dbi of protocol: #'datalevin.lmdb/ILMDB found for class: datalevin.storage.Store"

dvingo20:12:10

and just verified local storage does work:

(def d (d/open-kv "/tmp/hello1"))
(def table (d/open-dbi d "temp"))
(d/transact-kv d [[:put "temp" :test "data"]] )
(d/get-value d "temp" :test)
=> "data"
this is on 0.6.29

dvingo20:12:28

ahh the kv database cannot be the same as the datalog one. I'd be happy to update the docs for this - would you accept a documentation PR for this?

👍 1
Huahai21:12:51

On the server, databases are identified by names, not by files

Huahai21:12:08

Names should be unique for the server

dvingo21:12:23

unrelated to that I was trying to create a new user that only has write permission for one db instead of all dbs, and I'm getting the following error:

;; in a datalevin commandline repl:  
(def client (new-client ""))
(create-user client "test-user" "password")
(create-database client  "test-db" :datalog)
(grant-permission client :datalevin.role/test-user :datalevin.server/create  :datalevin.server/database "test-db")
  
  ;; in the server process' terminal log:
  => 
  2022-12-16T21:52:01.395Z dv-homebase DEBUG [datalevin.server:2049] - Message received: {:type :grant-permission, :writing? false}
  2022-12-16T21:52:01.396Z dv-homebase ERROR [datalevin.server:?] -
  java.lang.Thread.run              Thread.java:  833
  java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  635
  java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1136
  ...
  datalevin.server/handle-read/fn/fn               server.clj: 2075
  datalevin.server/handle-message               server.clj: 2052
  datalevin.server/grant-permission               server.clj: 1386
  datalevin.server/transact-role-permission               server.clj:  393
  datalevin.server/permission-eid               server.clj:  257
  datalevin.core/q                core.cljc:  195
  clojure.core/apply                 core.clj:  669
  ...
  datalevin.query/q               query.cljc: 1174
  datalevin.query/q               query.cljc: 1189
  datalevin.query/resolve-ins               query.cljc:  428
  clojure.lang.ExceptionInfo: Too few inputs passed, expected: [$ ?act ?obj ?tgt], got: 3
  error: :query/inputs
  expected: [{:variable {:symbol $}}
             {:variable {:symbol ?act}}
             {:variable {:symbol ?obj}}
             {:variable {:symbol ?tgt}}]
  got: ({:store
         #object[datalevin.storage.Store 0x7c0b0bd9 "datalevin.storage.Store@7c0b0bd9"],
         :eavt
         #{#datalevin/Datom [32 :database/name "test-db"]
           #datalevin/Datom [32 :database/type :datalog]
           #datalevin/Datom [33 :permission/act :datalevin.server/create]
           #datalevin/Datom [33 :permission/obj :datalevin.server/database]
           #datalevin/Datom [33 :permission/tgt 32]
           #datalevin/Datom [34 :role-perm/perm 33]
           #datalevin/Datom [34 :role-perm/role 2]},
         :avet
         #{#datalevin/Datom [32 :database/name "test-db"]
           #datalevin/Datom [32 :database/type :datalog]
           #datalevin/Datom [33 :permission/act :datalevin.server/create]
           #datalevin/Datom [33 :permission/obj :datalevin.server/database]
           #datalevin/Datom [33 :permission/tgt 32]
           #datalevin/Datom [34 :role-perm/perm 33]
           #datalevin/Datom [34 :role-perm/role 2]},
         :veat
         #{#datalevin/Datom [34 :role-perm/role 2]
           #datalevin/Datom [33 :permission/tgt 32]
           #datalevin/Datom [34 :role-perm/perm 33]},
         :max-eid 34,
         :max-tx 10,
         :hash nil}
        :datalevin.server/create
        :datalevin.server/database)

  2022-12-16T21:52:01.411Z dv-homebase ERROR [datalevin.server:2055] - Error Handling message: Unfreezable type: class org.lmdbjava.Env

dvingo21:12:47

but passing nil instead of "test-database" does work

dvingo21:12:05

so it's non-blocking but just reporting what I found

Huahai23:12:58

it’s a bug. the fix is coming out

Huahai23:12:28

Thanks for reporting

👍 1
Huahai23:12:39

0.7.6 fixes this

dvingo19:12:11

awesome! thanks - just verified it is working on 0.7.7

👍 1