Using the latest datalevin 0.10.7 and occasionally get a corrupted database: ; Execution error (ExceptionInfo) at datalevin.txlog/decode-header-buffer (txlog.clj:580). ; Invalid txn-log record magic This happens when I start/connect: (defn start! [] (locking conn* (if @conn* :already-running (let [c (d/get-conn (ensure-db-dir!) (schema/schema))] (reset! conn* c) :started)))) I used datalevin 0.9.22 on a prior project and never had corruption problems. One suspicion is that sometimes my AI agent (codex) will call db/start! through the nrepl. I see the corruption error when I run a jvm though calva and start! the connection. I have tried to isolate this to see if maybe it has to do with multiple jvms attempting to open the same db files...still unsure. Here is a github report https://github.com/datalevin/datalevin/issues/361 Any advice appreciated. thanks, Jon
@huahaiy This fix is working well. Can you please put this in a release? I am having to do some odd things with my container builds to get a local clone of datalevin compiled in my container for my deploy.
Will do a release soon. Needs to tie some loose ends.
Thank you for the report. I am investigating.
Multiple JVMs is definitely a use case that I have not thought about. Let me think this through and address this.
Instead of fail fast at second writer, I will enable multi-process writers instead.
master branch has this change. Please see if it works for you.
thanks. I'll test and get back to you. For an embedded db I don't expect multi writer to be a valid use case. I just don't want an attempt to do so to corrupt the db.
@huahaiy I have been testing my app with the master branch build of datalevin. No corruption errors. The app will be getting more thorough pre-production testing the next two weeks.