GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-249 Remove MDB_UNSIGNEDKEY, let CursorIterable call mdb_cmp by at055612 · Pull Request #250 · lmdbjava/lmdbjava

Conversation

@at055612

@at055612 at055612 commented Mar 6, 2025

Copy link
Copy Markdown
Collaborator

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() and getUnsignedComparator() have been made public so users of this library can access them.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@at055612
lmdbjavagh-249 Remove MDB_UNSIGNEDKEY, let CursorIterable call mdb_cmp
480e984
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()` and `getUnsignedComparator()`
have been made public so users of this library can access them.
@codecov

codecov Bot commented Mar 6, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.06452% with 167 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.06%. Comparing base (65df2ee) to head (dea7975).

Files with missing lines Patch % Lines
src/main/java/org/lmdbjava/AbstractFlagSet.java 72.61% 13 Missing and 10 partials ⚠️
src/main/java/org/lmdbjava/Env.java 63.79% 17 Missing and 4 partials ⚠️
src/main/java/org/lmdbjava/DbiBuilder.java 77.01% 13 Missing and 7 partials ⚠️
src/main/java/org/lmdbjava/Cursor.java 57.57% 8 Missing and 6 partials ⚠️
src/main/java/org/lmdbjava/FlagSet.java 63.33% 6 Missing and 5 partials ⚠️
src/main/java/org/lmdbjava/ByteBufProxy.java 62.96% 6 Missing and 4 partials ⚠️
src/main/java/org/lmdbjava/Dbi.java 72.22% 8 Missing and 2 partials ⚠️
src/main/java/org/lmdbjava/CopyFlagSet.java 50.00% 9 Missing ⚠️
src/main/java/org/lmdbjava/TxnFlagSet.java 62.50% 6 Missing ⚠️
src/main/java/org/lmdbjava/Key.java 73.68% 4 Missing and 1 partial ⚠️
... and 13 more
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

at055612 added 2 commits March 6, 2025 17:27
@at055612
lmdbjavagh-249 Remove non-J8 features, use indent size 2
46f8d08
@at055612
lmdbjavagh-249 Fix indents
f92012e
github-advanced-security[bot]
github-advanced-security AI found potential problems Mar 6, 2025
View reviewed changes
Comment thread src/main/java/org/lmdbjava/KeyRangeType.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/lmdbjava/KeyRangeType.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterablePerfTest.java
cnt++;
}
}
final Duration duration = Duration.between(start, Instant.now());

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'KeyVal kv' is never read.
Comment thread src/test/java/org/lmdbjava/CursorIterableTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterableTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

at055612 added 3 commits March 6, 2025 19:02
@at055612
lmdbjavagh-249 Tidy code and refactor RangeComparator impls
e1756d6
@at055612
lmdbjavagh-249 Remove commented code
9509f6b
@at055612
lmdbjavagh-249 Add CursorIterableIntegerKeyTest
67e2df1
github-advanced-security[bot]
github-advanced-security AI found potential problems Mar 7, 2025
View reviewed changes
Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

@bp-alex bp-alex mentioned this pull request Mar 8, 2025
The new MDB_UNSIGNEDKEY DbiFlag should probably be the default behaviour #249
Closed
@at055612
lmdbjavagh-249 Remove MaskedFlag.isPropagatedToLmdb, add DbiBuilder WIP
620a89f
github-advanced-security[bot]
github-advanced-security AI found potential problems Jun 5, 2025
View reviewed changes
Comment thread src/main/java/org/lmdbjava/DbiBuilder.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java
bb1.get(array1);
bb2.get(array2);
bb1.reset();
bb2.reset();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
Env.openDbi
Error loading related location
Loading

Uh oh!

There was an error while loading. Please reload this page.

should be avoided because it has been deprecated.
Comment thread src/test/java/org/lmdbjava/CursorIterablePerfTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterablePerfTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterableTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterableTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterableTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

@at055612 at055612 mentioned this pull request Oct 24, 2025
Java 25, the Foreign Function & Memory API and removal of Unsafe #259
Open
@bp-alex
bp-alex force-pushed the master branch 2 times, most recently from 5e03aec to e598e21 Compare October 25, 2025 04:27
@at055612
Merge branch 'master' into mdb_cmp
75d87d0
github-advanced-security[bot]
github-advanced-security AI found potential problems Oct 26, 2025
View reviewed changes
Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

at055612 added 5 commits October 26, 2025 21:49
@at055612
Merge branch 'master' into mdb_cmp
47b4c4f
@at055612
Add FlagSet, DbiFlagSet, PutFlagSet
bfbf223
Refactor DbiBuilder and Dbi ctor to use DbiFlagSet.
@at055612
Rename FlagSet to AbstractFlagSet
0f66aaf
@at055612
Add remaining FlagSet impls
aa000a1
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 now
Env#txn(Txn)
Env#txn(Txn, TxnFlags)
Env#txn(Txn, TxnFlagSet)
@at055612
Fix Javadoc
667dab3
github-advanced-security[bot]
github-advanced-security AI found potential problems Oct 27, 2025
View reviewed changes
Comment thread src/main/java/org/lmdbjava/AbstractFlagSet.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/lmdbjava/AbstractFlagSet.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/lmdbjava/AbstractFlagSet.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/lmdbjava/Env.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/lmdbjava/FlagSet.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

@at055612
Replace get(Uns|S)ignedComparator with getComparator(DbiFlagSet)
0234d32
Also improve javadoc and refactor some tests to use DbiBuilder.

Some tests are failing.
github-advanced-security[bot]
github-advanced-security AI found potential problems Oct 28, 2025
View reviewed changes
Comment thread src/main/java/org/lmdbjava/BufferProxy.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

@at055612
Add missing txn commit in DbiBuilder
ef0c852
github-advanced-security[bot]
github-advanced-security AI found potential problems Oct 28, 2025
View reviewed changes
Comment thread src/main/java/org/lmdbjava/DbiBuilder.java
if (txn != null) {
return open(txn, dbiBuilder);
} else {
try (final Txn<T> txn = getTxn(dbiBuilder)) {

Check notice

Code scanning / CodeQL

Possible confusion of local and field Note

Confusing name: method
open
Error loading related location
Loading

Uh oh!

There was an error while loading. Please reload this page.

also refers to field
txn
Error loading related location
Loading

Uh oh!

There was an error while loading. Please reload this page.

(without qualifying it with 'this').
at055612 added 2 commits October 28, 2025 18:21
@at055612
Change CursorIterableTest to use Parameterized
1b3f94d
@at055612
Deprecate methods using varargs flags
c0bbe73
@at055612 at055612 self-assigned this Oct 28, 2025
github-advanced-security[bot]
github-advanced-security AI found potential problems Oct 28, 2025
View reviewed changes
Comment thread src/main/java/org/lmdbjava/FlagSet.java
/**
* @return The {@link Iterator} (in no particular order) for the flags in this {@link FlagSet}.
*/
default Iterator<T> iterator() {

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
Iterable.iterator
Error loading related location
Loading

Uh oh!

There was an error while loading. Please reload this page.

; it is advisable to add an Override annotation.
Comment thread src/test/java/org/lmdbjava/CursorIterablePerfTest.java
try (Txn<ByteBuffer> txn = env.txnWrite();
final Cursor<ByteBuffer> cursor = db.openCursor(txn)) {
while (cursor.next()) {
cursor.delete();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
Cursor.delete
Error loading related location
Loading

Uh oh!

There was an error while loading. Please reload this page.

should be avoided because it has been deprecated.
at055612 added 3 commits October 29, 2025 11:32
@at055612
Add int key compare method to (Direct|Byte)BufferProxy
4fd89ff
@at055612
Tidy code
58dcc6e
@at055612
Fix byte order issues with compareAsIntegerKeys
26665ba
@bp-alex bp-alex mentioned this pull request Nov 3, 2025
Write regression after release 0.8.3 #268
Closed
at055612 added 2 commits November 4, 2025 15:01
@at055612
Add/refactor tests
c427801
@at055612
Merge branch 'master' into mdb_cmp
f606e7e
github-advanced-security[bot]
github-advanced-security AI found potential problems Nov 4, 2025
View reviewed changes
Comment thread src/test/java/org/lmdbjava/ByteBufferProxyTest.java Fixed

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/lmdbjava/ByteBufferProxyTest.java
final long[] values = random.longs(5_000_000).toArray();

Instant time = Instant.now();
int x = 0;

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'int x' is never read.
Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerDupTest.java
bb2.reset();
return guava.compare(array1, array2);
};
final Dbi<ByteBuffer> guavaDbi = env.openDbi(DB_1, comparator, MDB_CREATE);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
Env.openDbi
Error loading related location
Loading

Uh oh!

There was an error while loading. Please reload this page.

should be avoided because it has been deprecated.
@at055612
Add integer key comparator tests
e2be6bf
github-advanced-security[bot]
github-advanced-security AI found potential problems Nov 5, 2025
View reviewed changes
Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerDupTest.java
Comment on lines +127 to +131
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

Invoking
Builder.open
Error loading related location
Loading

Uh oh!

There was an error while loading. Please reload this page.

should be avoided because it has been deprecated.
Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java
try (Txn<ByteBuffer> txn = env.txnRead()) {
try (CursorIterable<ByteBuffer> iterable = db.iterate(txn)) {
for (KeyVal<ByteBuffer> keyVal : iterable) {
final String val = getString(keyVal.val());

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'String val' is never read.
Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java
try (CursorIterable<ByteBuffer> iterable = db.iterate(txn)) {
for (KeyVal<ByteBuffer> keyVal : iterable) {
final String val = getString(keyVal.val());
final long key = getNativeLong(keyVal.key());

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'long key' is never read.
Comment thread src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java
for (KeyVal<ByteBuffer> keyVal : iterable) {
final String val = getString(keyVal.val());
final long key = getNativeLong(keyVal.key());
final int remaining = keyVal.key().remaining();

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'int remaining' is never read.
Comment thread src/test/java/org/lmdbjava/CursorIterablePerfTest.java
Comment on lines +59 to +63
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

Invoking
Builder.open
Error loading related location
Loading

Uh oh!

There was an error while loading. Please reload this page.

should be avoided because it has been deprecated.
at055612 added 2 commits November 5, 2025 16:57
@at055612
Add ComparatorFactory
1acd971
@at055612
Merge branch 'master' into mdb_cmp
dea7975
@at055612

at055612 commented Nov 5, 2025

Copy link
Copy Markdown
Collaborator Author

Closing this as the changes have been moved to PR #276

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@at055612 at055612 closed this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@at055612 at055612

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

The new MDB_UNSIGNEDKEY DbiFlag should probably be the default behaviour

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@at055612 @github-advanced-security
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.