datalevin

erdos 2024-10-18T11:36:44.608229Z

Dear Team, I am working on a version update from 0.8.29 to (current latest) 0.9.12 in my app, but got stuck in the import step. I want to use use the nippy format because I have some types that cannot be read by default (LocalDate, byte array etc). 1. Created the dump with dtlv-0.8.29 -d . --nippy dump > db-dump.nippy 2. Trying to import the dump with cat db-dump.nippy | dtlv-0.9.12 -d ./imported -n load The dump file file is successfully created in (1) but running (2) hangs indefinitely. The new ./imported/data.mdb file is stuck at the size of 40960 bytes. Seems like the process hangs (no cpu load). Please advise thanks2

erdos 2024-10-18T11:41:51.830349Z

Seems like the problem is not only with the standalone dtlv command (amd64 linux build). Running the jar file version has the same effect:

cat db-dump.nippy | java --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED  -jar ~/Downloads/datalevin-0.9.12-standalone.jar -d ./imported --nippy load

m3tti 2024-10-18T13:08:40.218799Z

Are you able to create a gist? Or even something you can show off? Guess that might help. @huahaiy is really fast in responding. But i guess to fix a bug he has to reproduce it somehow.

erdos 2024-10-18T13:10:41.858619Z

ok, will try. in the meanwhile, I got a thread dump of the java process.

m3tti 2024-10-18T13:15:39.048049Z

And maybe open up an issue if its really a bug

Huahai 2024-10-18T14:25:55.615789Z

Please follow the guide at https://cljdoc.org/d/datalevin/datalevin/0.9.12/doc/database-upgrade

Huahai 2024-10-18T14:26:33.773589Z

Is this a Datalog DB or not?

Huahai 2024-10-18T14:27:17.926349Z

You did not specify it in you command

Huahai 2024-10-18T14:28:20.378279Z

I don't think cat or pipe is well tested, I would use -f option to specify source and destanation

Huahai 2024-10-18T14:28:56.442549Z

for Datalog db, you need -g

Huahai 2024-10-18T14:29:23.019899Z

./dtlv-0.8.29 -d /src/dir -g -n -f dump-file dump

Huahai 2024-10-18T14:30:10.818339Z

./dtlv-0.9.12 -d /dest/dir -f dump-file -g -n load

erdos 2024-10-18T14:35:41.499149Z

hey @huahaiy, thanks for jumping in to this thread. > for Datalog db, you need -g Apparently -g and -n cannot work together. The problem with -g is that it disables -n and the entities will be dumped as edn regular maps instead of just the triples. But I need Nippy serialized values in the dump, because I have values in the database that cannot be pretty-printed by dtlv (for example, LocalDate, LocalTime, byte array, etc) > I don't think cat or pipe is well tested, I would use -f option I tried, had the same experience with explicitly specifying the file instead of using stdin/stdout.

Huahai 2024-10-18T14:37:35.283549Z

did you try -g and -n together?

Huahai 2024-10-18T14:38:47.772629Z

why would -g disable -n? did you try?

Huahai 2024-10-18T14:40:47.868929Z

if it is nippy dump, -f must be given, apparently you did not

👍 1
👀 1
☝️ 1
erdos 2024-10-18T14:41:38.697669Z

yes, I can confirm I have tried -g and -n together. For example, running:

dtlv-0.8.29 -d . -g -n -f dump-file dump
will result
[23 :spend/tx-day {:nippy/unthawable {:type :serializable, :cause :exception, :class-name "java.time.LocalDate", :content nil, :exception #error {
 :cause "java.time.Ser"
 :via
 [{:type java.lang.ClassNotFoundException
   :message "java.time.Ser"
   :at [java.lang.Class forName "DynamicHub.java" 1132]}]
 :trace
 [
so it looks like LocalDate cannot be serialized

erdos 2024-10-18T14:42:18.126519Z

> if it is nippy dump, -f must be given, apparently you did not oh thanks, I was not aware of this restriction. Tried again, see result above.

Huahai 2024-10-18T14:42:51.705759Z

well then nippy is not going to help you either

erdos 2024-10-18T14:44:28.770559Z

I see, so if I understand correctly, Nippy itself also cannot serialize java.time.LocalDate. Thanks for checking it. I will move forward with a application code exporting/importing the database. 🙇

Huahai 2024-10-18T14:45:41.107249Z

Datalevin cannot handle arbitrary object at this point, we have a ticket for that

Huahai 2024-10-18T14:48:18.864769Z

one thing you may be able to do, is to dump/load in your app, where all the missing classes probably are present, because you did write them into DB in the app.

Huahai 2024-10-18T14:50:15.749129Z

datalein.main/dump and datalein.main/load can be called in your code.

Huahai 2024-10-18T14:51:11.297999Z

these are what dtlv command is calling anyway

Huahai 2024-10-18T14:51:14.500549Z

so they are the same

Huahai 2024-10-18T14:52:51.594839Z

dump in 0.8.29, then close app, change deps to 0.9.12, then load

Huahai 2024-10-18T15:53:42.025599Z

updated the upgrade doc to mention this in code upgrade method.