Skip to content

fix(hot): MemKvRwTx read cursor now sees queued writes#32

Merged
prestwich merged 1 commit intomainfrom
fix/mem-rwtx-read-cursor-queued-writes
Feb 16, 2026
Merged

fix(hot): MemKvRwTx read cursor now sees queued writes#32
prestwich merged 1 commit intomainfrom
fix/mem-rwtx-read-cursor-queued-writes

Conversation

@prestwich
Copy link
Member

Summary

  • Fix read cursor inconsistency: HotKvRead for MemKvRwTx now uses MemKvCursorMut instead of MemKvCursor, so read cursors on write transactions see pending (queued) writes — matching the behavior of raw_get which already checked queued ops.
  • Fix MemKvCursorMut::last_of_k1 bug: The k1 comparison compared the full MAX_KEY_SIZE (64 bytes) padded key against the shorter encoded key, causing last_of_k1 to always return None. Now correctly compares only the relevant prefix, matching MemKvCursor's implementation.
  • Bump version to 0.6.2.

Test plan

  • cargo clippy -p signet-hot --all-features --all-targets
  • cargo clippy -p signet-hot --no-default-features --all-targets
  • cargo +nightly fmt
  • cargo t -p signet-hot (103 unit tests + 4 integration tests pass)
  • mem_unwind_conformance test now validates real history index data (previously was a vacuous 0 == 0 comparison since history indices were never built within single transactions)

🤖 Generated with Claude Code

`HotKvRead for MemKvRwTx` previously returned `MemKvCursor` which only
sees committed data. This caused read cursors on write transactions to
miss pending writes, creating an inconsistency with `raw_get` which
already checked queued ops. Change `Traverse` type to `MemKvCursorMut`
which merges committed data with queued writes.

Also fix a pre-existing bug in `MemKvCursorMut::last_of_k1` where the
k1 comparison used full MAX_KEY_SIZE bytes against the shorter encoded
key, causing it to always return None.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@prestwich prestwich merged commit fbfe22c into main Feb 16, 2026
6 checks passed
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.

1 participant