Repository navigation
DEV-1230: Fix B+tree node decoding that corrupts concurrent reads - #6
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
formatBPTreeNode decoded a node with relative position(), limit(), slice() and rewind() calls on block.getByteBuffer(). That returns the block's single buffer instance, and both BlockMgrJournal.getRead and BlockMgrCache.getRead hand the same Block to every concurrent reader, so two readers decoding the same node tore each other's view and read a garbage child pointer. It surfaces as BlockException: BlockAccessBase: Bounds exception on node2id.dat, from find() in a read transaction with no journal replay involved. Use absolute slice(index, length) instead, so decoding reads the buffer without changing any state other threads can see. Reported in DEV-1230; the fix is the one sketched there. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Internal patched build of Apache Jena, published as
6.2.0-tq-2. Cumulative on top of6.2.0-tq-1: it carries the journal write-back fix from #5 as well as this one.BPTreeNodeMgr.formatBPTreeNodedecoded a node with relativeposition(),limit(),slice()andrewind()calls onblock.getByteBuffer(). That returns the block's single buffer instance, and bothBlockMgrJournal.getReadandBlockMgrCache.getReadhand the sameBlockto every concurrent reader, so two readers decoding the same node tore each other's view and read a garbage child pointer. It surfaces asBlockException: BlockAccessBase: Bounds exceptiononnode2id.dat, thrown fromfind()in a read transaction with no journal replay involved.The fix uses absolute
slice(index, length), so decoding reads the buffer without changing state other threads can see. Six lines in, twelve out, and no lock.This is the second race described in DEV-1230, the one the write-back patch does not address. The approach is the one sketched in that ticket.
Validation
6.2.0-tq-1failed 2 of 10, bothBlockExceptiononnode2id.datwith no data loss;6.2.0-tq-2failed 0 of 10.Not urgent. Master is on
6.2.0-tq-1and Richard is observing it. This is ready whenever it is wanted;tq-1remains published and tagged, so moving between them is a one-line change tover.jena.🤖 Generated with Claude Code