Skip to content

CNDB-141284: use ByteBuffer.remaining instead of limit to asset size (#1755) #1829

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2025

Conversation

driftx
Copy link

@driftx driftx commented Jun 20, 2025

The data inserted into the trie in TrieMemoryIndex is encodedTerm, which is built from term and only on the "available" bytes (between term.position() and term.limit()). But the check that decides to use the (more efficient) recursive path or not uses term.limit() to assess the size of encodedTerm. If term.position() is not 0, this is incorrect, and can lead to using the less optimal pass completely unecessarily. This has been shown to happen when investigating https://github.com/riptano/cndb/issues/14153: the non-recursive path was taken even for boolean values (because the nodes were using offheap_buffers; with offheap_objects, the buffers getting to TriMemoryIndex are 0-positioned).

See https://github.com/riptano/cndb/issues/14184.

…ize (#1755)

The data inserted into the trie in `TrieMemoryIndex` is `encodedTerm`,
which is built from `term` and only on the "available" bytes (between
`term.position()` and `term.limit()`). But the check that decides to use
the (more efficient) recursive path or not uses `term.limit()` to assess
the size of `encodedTerm`. If `term.position()` is not 0, this is
incorrect, and can lead to using the less optimal pass completely
unecessarily. This has been shown to happen when investigating
riptano/cndb#14153: the non-recursive path was
taken even for boolean values (because the nodes were using
`offheap_buffers`; with `offheap_objects`, the buffers getting to
`TriMemoryIndex` are 0-positioned).

See riptano/cndb#14184.
@driftx
Copy link
Author

driftx commented Jun 20, 2025

Clean merge

Copy link

Checklist before you submit for review

  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

Copy link

@cassci-bot
Copy link

❌ Build ds-cassandra-pr-gate/PR-1829 rejected by Butler


11 new test failure(s) in 1 builds
See build details here


Found 11 new test failures

Test Explanation Branch history Upstream history
...estInterruptedExceptionCachedCounterLockManager regression 🔴
....r.PendingAntiCompactionTest.testRetriesTimeout regression 🔴
...adCommitLogAndSSTablesWithDroppedColumnTestCC40 regression 🔴
...adCommitLogAndSSTablesWithDroppedColumnTestCC50 regression 🔴
...oadCommitLogAndSSTablesWithDroppedColumnTestDSE regression 🔴
...thRestartTest.testReadingValuesOfDroppedColumns regression 🔴
o.a.c.d.t.r.ForceRepairTest.force regression 🔴
...estIndexRebuildWhenAddingSStableViaRemoteReload regression 🔴
o.a.c.i.s.d.OnDiskIndexTest.testSparseMode regression 🔴
...cySSTableTest.testVerifyOldDroppedTupleSSTables regression 🔴
o.a.c.t.SSTablePartitionsTest.testDirectory regression 🔴

No known test failures found

@driftx driftx merged commit d119d8c into main-5.0 Jul 1, 2025
574 of 588 checks passed
@driftx driftx deleted the CNDB-14535 branch July 1, 2025 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants