- Notifications
You must be signed in to change notification settings - Fork124
gh-249 Remove MDB_UNSIGNEDKEY, let CursorIterable call mdb_cmp#250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There are now essentially three ways of configuring comparatorswhen creating a Dbi.**null comparator**LMDB will use its own comparator & CursorIterable will call downto mdb_cmp for comparisons between the current cursor key and therange start/stop key.**provided comparator**LMDB will use its own comparator & CursorIterable will use theprovided comparator for comparisons between the current cursorkey and the range start/stop key.**provided comparator with nativeCb==true**LMDB will call back to java for all comparator duties.CursorIterable will use the same provided comparator forcomparisons between the current cursor key and the rangestart/stop key.The methods `getSignedComparator()` and `getUnsignedComparator()`have been made public so users of this library can access them.
codecovbot commentedMar 6, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@## master #250 +/- ##============================================- Coverage 89.06% 85.06% -4.01%- Complexity 413 507 +94============================================ Files 32 41 +9 Lines 1482 1962 +480 Branches 125 180 +55 ============================================+ Hits 1320 1669 +349- Misses 92 177 +85- Partials 70 116 +46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| cnt++; | ||
| } | ||
| } | ||
| finalDurationduration =Duration.between(start,Instant.now()); |
Check notice
Code scanning / CodeQL
Unread local variable Note test
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| bb1.get(array1); | ||
| bb2.get(array2); | ||
| bb1.reset(); | ||
| bb2.reset(); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
Env.openDbi
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
5e03aec toe598e21CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Refactor DbiBuilder and Dbi ctor to use DbiFlagSet.
Replace Env#copy(File, CopyFlags...) with copy(File, CopyFlagSet).As there is only one flag this should not be a breaking change.Deprecate Env#txn(Txn, TxnFlags...) as there is nowEnv#txn(Txn)Env#txn(Txn, TxnFlags)Env#txn(Txn, TxnFlagSet)
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Also improve javadoc and refactor some tests to use DbiBuilder.Some tests are failing.
Uh oh!
There was an error while loading.Please reload this page.
| if (txn !=null) { | ||
| returnopen(txn,dbiBuilder); | ||
| }else { | ||
| try (finalTxn<T>txn =getTxn(dbiBuilder)) { |
Check notice
Code scanning / CodeQL
Possible confusion of local and field Note
open
Uh oh!
There was an error while loading.Please reload this page.
txn
Uh oh!
There was an error while loading.Please reload this page.
| /** | ||
| * @return The {@link Iterator} (in no particular order) for the flags in this {@link FlagSet}. | ||
| */ | ||
| defaultIterator<T>iterator() { |
Check notice
Code scanning / CodeQL
Missing Override annotation Note
Iterable.iterator
Uh oh!
There was an error while loading.Please reload this page.
| try (Txn<ByteBuffer>txn =env.txnWrite(); | ||
| finalCursor<ByteBuffer>cursor =db.openCursor(txn)) { | ||
| while (cursor.next()) { | ||
| cursor.delete(); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
Cursor.delete
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| finallong[]values =random.longs(5_000_000).toArray(); | ||
| Instanttime =Instant.now(); | ||
| intx =0; |
Check notice
Code scanning / CodeQL
Unread local variable Note test
| bb2.reset(); | ||
| returnguava.compare(array1,array2); | ||
| }; | ||
| finalDbi<ByteBuffer>guavaDbi =env.openDbi(DB_1,comparator,MDB_CREATE); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
Env.openDbi
Uh oh!
There was an error while loading.Please reload this page.
| create(bufferProxy) | ||
| .setMapSize(KIBIBYTES.toBytes(256)) | ||
| .setMaxReaders(1) | ||
| .setMaxDbs(3) | ||
| .open(file.toFile(),POSIX_MODE,MDB_NOSUBDIR); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
Builder.open
Uh oh!
There was an error while loading.Please reload this page.
| try (Txn<ByteBuffer>txn =env.txnRead()) { | ||
| try (CursorIterable<ByteBuffer>iterable =db.iterate(txn)) { | ||
| for (KeyVal<ByteBuffer>keyVal :iterable) { | ||
| finalStringval =getString(keyVal.val()); |
Check notice
Code scanning / CodeQL
Unread local variable Note test
| try (CursorIterable<ByteBuffer>iterable =db.iterate(txn)) { | ||
| for (KeyVal<ByteBuffer>keyVal :iterable) { | ||
| finalStringval =getString(keyVal.val()); | ||
| finallongkey =getNativeLong(keyVal.key()); |
Check notice
Code scanning / CodeQL
Unread local variable Note test
| for (KeyVal<ByteBuffer>keyVal :iterable) { | ||
| finalStringval =getString(keyVal.val()); | ||
| finallongkey =getNativeLong(keyVal.key()); | ||
| finalintremaining =keyVal.key().remaining(); |
Check notice
Code scanning / CodeQL
Unread local variable Note test
| create(bufferProxy) | ||
| .setMapSize(GIBIBYTES.toBytes(1)) | ||
| .setMaxReaders(1) | ||
| .setMaxDbs(3) | ||
| .open(file.toFile(),POSIX_MODE,MDB_NOSUBDIR); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
Builder.open
Uh oh!
There was an error while loading.Please reload this page.
at055612 commentedNov 5, 2025
Closing this as the changes have been moved to PR#276 |
Fixes#249
There are now essentially three ways of configuring comparators when creating a Dbi.
null comparator
LMDB will use its own comparator & CursorIterable will call down to mdb_cmp for comparisons between the current cursor key and the range start/stop key.
provided comparator
LMDB will use its own comparator & CursorIterable will use the provided comparator for comparisons between the current cursor key and the range start/stop key.
provided comparator with nativeCb==true
LMDB will call back to java for all comparator duties. CursorIterable will use the same provided comparator for comparisons between the current cursor key and the range start/stop key.
The methods
getSignedComparator()andgetUnsignedComparator()have been made public so users of this library can access them.