-
Hi, I finally got around to trying to integrate LMDB as a drop-in replacement for some key/value memory and file stores I've been using. So far, the easy stuff has gone pretty well—apart from some messages about not being able to serialize keys for multi-valued keys. I've solved that for now. I'm really just trying to see how to make it work with the least amount of surgery to the overall architecture. It was essentially designed for this model from the beginning, so it should be fine. So far, I'm very impressed. However, the problem I'm having now that I've moved past the testing of the pieces into actually testing the bigger parts is that even using putSync to write in the same transaction, my unit tests – and probably my command line tools once we get there – aren't able to reliably detect when the data has been fully loaded and ready to use. It writes across several database indexes in chunks, and then expects to be able to use the data once the write completes. Instrumenting the adapters, it's clear that the writes are happening, but not until after the tests have completed. The tests are intended to be driven from the command line, and the store is used by a whole lot of command line tools, so I'm perfectly comfortable dealing with potential thread blocking and all the rest for the moment. I am surprised that even in sync mode that the writes aren't available to subsequent reads when the methods return, but I guess I understand why this is the case. However, I'm really wondering how this will deal with bulk loads once I get this problem figured out. I get I'm probably missing something pretty obvious here, but I'm a bit stumped on how to proceed. I tried to see if there was anything similar already posted, but I didn't see anything relevant. Anyone have any suggestions apart from rewriting 10+ years worth of code? Cheers, ast |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
When |
Beta Was this translation helpful? Give feedback.
Ok, thanks. You got me: operator error on the transactions. I didn't notice the #transaction vs. #transactionSync in the API docs. I have updated it to switch based on the type of write I'm doing, and everything works swimmingly now.
The this pointer is being used inside a callback, e.g.,:
During the iteration, the values in the LMDB-backed data structures are being accessed.
However, given that I was using async transactions by mistake, who knows what it was really pointing to as far as the stack frame and local memory assignments.
The superbly awesome news is that it was all do…