Closed kylebernhardy closed 2 years ago
I think I see similar behaviour on my side as well when trying to update from 2.2.6
to 2.3.x
(checked 2.3.0, 2.3.8 and newest 2.3.9).
We don't use sharedStructuresKey
however (we commented it out at some point for some reason).
Possibly interesting bits:
await rootDB.flushed
there)I didn't manage to create small reproduction for this however - this might be matter of volume or maybe some specific timing on our side? (or just something that I missed ...)
If you either set overlappingsync to false or remove the sharedStructuresKey from the dbi the range query returns the expected entries.
~Does setting overlappingSync
to false
in options actually do anything? I tried that when I found this ticket and for me it didn't seem to have effect and when checking code ( https://www.runpkg.com/?lmdb@2.3.9/dist/index.cjs#2019 ) this option seems like is now calculated from other options and not set directly?~
~I did "monkey-patch" above linked line on my side and that was "fixing" the problem, but it appears I can't achieve this result with regular options now?~
EDIT: overlappingSync: false
does work, I missed the Object.assign
in the lmdb code and put overlappingSync: false,
in wrong place in my tests :)
Thank you for the detailed report/test-case. This should be fixed in v2.3.10. Let me know if you see any lingering issue.
@kriszyp all of our tests pass now with this new version. This also fixed issues we were seeing with overlappingsync running on AWS EBS volumes that I was struggling to find a way to report!
I will wait until @pieh confirms this fixes his issues before closing.
From very brief testing, it appears like it's fixed on my side as well - I do think we can close this issue.
As always, thanks Kris for super quick turnaround on this :)
Kris as always you are amazing, thanks so much!
Thank you, appreciate the kind words!
I forgot I did want to respond this:
This transaction pattern is pretty old from the lmdb-store days, is it preferable to use the newer transaction function?
No, your transaction pattern is definitely right and idiomatic. Using ifNoExists
+ put
s is a great, recommended, best-practice approach.
(BTW, you also don't need to await
all the promises, you can just wait on the last one (since they resolve sequentially), or db.committed
, unless you are collecting the results, but I know this is just a test case.)
Thanks for the response @kriszyp & good to know the pattern is still preferred. Less code refactor for us as the sample above is a simple example of our implementation. And thanks for the reminder on the promises!
LMDB.js: 2.3.9 Ubuntu 20.04
Sorry for another odd issue. This issue is in regards to having
overlappingSync = true
and a dbi withsharedStructureKey = Symbol.for('structures')
. Writing data and reading it while the environment is open works fine. The issue occurs when you attempt to view the contents of the dbi after close. This transaction pattern is pretty old from the lmdb-store days, is it preferable to use the newer transaction function?Sample load code:
attempting to read data from dbi id:
The results of this are only the structure:
Symbol(structures) [ [ 'id', 'name', 'timestamp' ] ]
If you either set overlappingsync to false or remove the sharedStructuresKey from the dbi the range query returns the expected entries.