Title: CursorIterable/KeyRange broken in v0.9.0 · Issue #228 · lmdbjava/lmdbjava · GitHub
Open Graph Title: CursorIterable/KeyRange broken in v0.9.0 · Issue #228 · lmdbjava/lmdbjava
X Title: CursorIterable/KeyRange broken in v0.9.0 · Issue #228 · lmdbjava/lmdbjava
Description: The changes in v0.9.0 have broken CursorIterable for some KeyRange types and keys. I noticed the problem when using KeyRange.atLeastBackward(. The cursor was starting on the wrong key. I think the problem is this line: lmdbjava-0.8.3...l...
Open Graph Description: The changes in v0.9.0 have broken CursorIterable for some KeyRange types and keys. I noticed the problem when using KeyRange.atLeastBackward(. The cursor was starting on the wrong key. I think the ...
X Description: The changes in v0.9.0 have broken CursorIterable for some KeyRange types and keys. I noticed the problem when using KeyRange.atLeastBackward(. The cursor was starting on the wrong key. I think the ...
Opengraph URL: https://github.com/lmdbjava/lmdbjava/issues/228
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"CursorIterable/KeyRange broken in v0.9.0","articleBody":"The changes in v0.9.0 have broken CursorIterable for some KeyRange types and keys. I noticed the problem when using `KeyRange.atLeastBackward(`. The cursor was starting on the wrong key.\r\n\r\nI think the problem is this line:\r\n\r\nhttps://github.com/lmdbjava/lmdbjava/compare/lmdbjava-0.8.3...lmdbjava-0.9.0#diff-a5dda1cdb60b45d45a5a4364768ad1f7c62ac0ec025f295f78d489cf08392bf2R206\r\n\r\nIt is using the standard java `ByteBuffer.compareTo` method rather than your lexographical `AbstractByteBufferProxy::compareBuff` method, so 150 is considered \u003c 110.\r\n\r\nSee my branch (on the link below) where I have changed your `CursorIterableTest` to use 200 ... 900 instead of 2 ... 9 for the key values to demonstrate the problem. With the modified values a lot of the tests fail. Changing `AbstractByteBufferProxy` to use `compareBuf` makes them all pass again.\r\n\r\nhttps://github.com/lmdbjava/lmdbjava/compare/master...at055612:backwards-at-least?expand=1\r\n\r\nI think this is the problem is in `AbstractByteBufferProxy`.\r\n```java\r\n @Override\r\n protected Comparator\u003cByteBuffer\u003e getComparator(final DbiFlags... flags) {\r\n final int flagInt = mask(flags);\r\n if (isSet(flagInt, MDB_INTEGERKEY)) {\r\n return this::compareCustom;\r\n }\r\n return this::compareDefault;\r\n // TODO Think the above line should be changed to this:\r\n // return AbstractByteBufferProxy::compareBuff;\r\n }\r\n```\r\n\r\nIt may also be an issue for netty/agrona but I am not using those so have not looked.\r\n\r\nThis is a pretty serious bug for anyone using KeyRanges and it will present in subtle ways depending on the keys in the db and the keyRange type used.","author":{"url":"https://github.com/at055612","@type":"Person","name":"at055612"},"datePublished":"2023-12-11T13:44:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/228/lmdbjava/issues/228"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:055b1ece-79ca-bd16-8af1-8345dd5cad43 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E486:2AD947:2663B4A:35E875C:6970FA3E |
| html-safe-nonce | 94791a92cb097887915df988d3f03a0dd1e0c640342649c222a89857c7bb1e62 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDg2OjJBRDk0NzoyNjYzQjRBOjM1RTg3NUM6Njk3MEZBM0UiLCJ2aXNpdG9yX2lkIjoiODE5NDYwODg5NDU1ODkyNzQyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8117abb9a6998d2322b03773ecbd36590d5d6555def877d615ff167a7c630b10 |
| hovercard-subject-tag | issue:2035713639 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/lmdbjava/lmdbjava/228/issue_layout |
| twitter:image | https://opengraph.githubassets.com/58e83160895ec2ba615704035cdbe805e9841910a45d812bd7a0b9f159fa4b6d/lmdbjava/lmdbjava/issues/228 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/58e83160895ec2ba615704035cdbe805e9841910a45d812bd7a0b9f159fa4b6d/lmdbjava/lmdbjava/issues/228 |
| og:image:alt | The changes in v0.9.0 have broken CursorIterable for some KeyRange types and keys. I noticed the problem when using KeyRange.atLeastBackward(. The cursor was starting on the wrong key. I think the ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | at055612 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1b239ebed690c3053869ff31a3b7597834c25673659d63e7b6fd6a9b5d7853de |
| turbo-cache-control | no-preview |
| go-import | github.com/lmdbjava/lmdbjava git https://github.com/lmdbjava/lmdbjava.git |
| octolytics-dimension-user_id | 19765602 |
| octolytics-dimension-user_login | lmdbjava |
| octolytics-dimension-repository_id | 60480511 |
| octolytics-dimension-repository_nwo | lmdbjava/lmdbjava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 60480511 |
| octolytics-dimension-repository_network_root_nwo | lmdbjava/lmdbjava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | aeacfd55297f3de5395c83f200ac35d1f474115e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width