erthink / libmdbx

One of the fastest embeddable key-value ACID database without WAL. libmdbx surpasses the legendary LMDB in terms of reliability, features and performance.
https://erthink.github.io/libmdbx/
Other
1.16k stars 110 forks source link

MDBX_GET_BOTH not returning MDBX_NOTFOUND for missing value #243

Closed kriszyp closed 2 years ago

kriszyp commented 2 years ago

Using mdbx_cursor_get with MDBX_GET_BOTH on a MDBX_DUPSORT database, where the provided key exists and has values, but the provided value does not exist for the key, will return 0. Expected behavior: MDBX_GET_BOTH should position the cursor at exactly the key and value provided, and if the exact key/value dooes not exist, it should return MDBX_NOTFOUND (this is the behavior in LMDB with MDB_GET_BOTH, which does return MDB_NOTFOUND if the key/value does not exist).

erthink commented 2 years ago

I will check this. As a temporary solution, I suggest you try MDBX_SET_LOWERBOUND, maybe it will be more convenient.

kriszyp commented 2 years ago

That works great, thank you!

erthink commented 2 years ago

@kriszyp, thank you for reporting.

kriszyp commented 2 years ago

No problem, thanks for the quick response. The JS library, lmdbx-js (formerly called lmdbx-store) is really stabilizing and working well with libmdbx, I think, and I am hoping to add support for Deno soon.