Skip to content

KAFKA-20498: Add isolation-level reads to RocksDBStore#22653

Merged
bbejeck merged 2 commits into
apache:trunkfrom
nicktelford:KIP-892/iq-isolation-rocksdb
Jun 25, 2026
Merged

KAFKA-20498: Add isolation-level reads to RocksDBStore#22653
bbejeck merged 2 commits into
apache:trunkfrom
nicktelford:KIP-892/iq-isolation-rocksdb

Conversation

@nicktelford

@nicktelford nicktelford commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Interactive queries against a transactional RocksDB store (EOS) need to
choose whether they observe writes staged in the current, uncommitted
transaction. This adds a readOnly(IsolationLevel) override to
RocksDBStore that returns a view bound to a specific DBAccessor:
READ_COMMITTED reads through the underlying DirectDBAccessor,
bypassing the transaction buffer, so the query sees only committed data;
READ_UNCOMMITTED (and the default for non-transactional stores) uses
the active accessor, preserving existing behaviour.

The returned ReadOnlyView shares cfAccessor and openIterators with
the store, so reads go through the same iterator-tracking path while the
view exposes no writes.

Includes readOnly(IsolationLevel) semantic tests covering get,
range/all, and prefixScan that stage writes without committing and
assert the READ_COMMITTED/READ_UNCOMMITTED divergence, reopening the
store under an EOS context with enable.transactional.statestores=true
to exercise the transaction buffer.

🤖 Generated with Claude Code

Reviewers: Bill Bejeck bbejeck@apache.org

@github-actions github-actions Bot added triage PRs from the community streams labels Jun 23, 2026
@nicktelford

Copy link
Copy Markdown
Contributor Author

@bbejeck

@bbejeck bbejeck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nicktelford LGTM, can we get a test or two for reverse iteration?

@github-actions github-actions Bot removed the triage PRs from the community label Jun 25, 2026
nicktelford and others added 2 commits June 25, 2026 10:31
Override readOnly(IsolationLevel) on RocksDBStore to return a view bound
to a specific DBAccessor so interactive-query callers can select the
read strategy. READ_COMMITTED on a transactional store reads through the
underlying DirectDBAccessor, bypassing the transaction buffer;
READ_UNCOMMITTED (and the default for non-transactional stores) uses the
active accessor, preserving existing semantics. The view shares
cfAccessor and openIterators with the store, so reads go through the
same iterator-tracking path while writes are not exposed.

Add readOnly(IsolationLevel) semantic tests covering get, range/all, and
prefixScan, reopening the store under an EOS context with
enable.transactional.statestores=true to exercise the transaction
buffer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The RocksDBStore ReadOnlyView now supports configurable isolation
levels, but reverse iteration was not yet covered by tests. Without
coverage, a regression in reverseAll/reverseRange could silently expose
uncommitted writes under READ_COMMITTED, or vice versa.

Add tests asserting that reverseAll and reverseRange honour both
READ_UNCOMMITTED and READ_COMMITTED, including the ordering of results,
and that reverseRange returns an empty iterator when the from key is
greater than the to key.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nicktelford
nicktelford force-pushed the KIP-892/iq-isolation-rocksdb branch from 21cdaff to 1d07566 Compare June 25, 2026 09:37
@nicktelford

Copy link
Copy Markdown
Contributor Author

Thanks @nicktelford LGTM, can we get a test or two for reverse iteration?

@bbejeck Tests added for reverse iteration, as requested, and rebased on latest trunk.

@bbejeck bbejeck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nicktelford LGTM

@bbejeck
bbejeck merged commit 81de9da into apache:trunk Jun 25, 2026
20 checks passed
@bbejeck

bbejeck commented Jun 25, 2026

Copy link
Copy Markdown
Member

Merged #22653 into trunk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants