Skip to content

Migrate BtreeRangeIter to BtreeCursorRange#1253

Merged
cberner merged 1 commit into
masterfrom
claude/migrate-multimap-btree-zUY26
May 13, 2026
Merged

Migrate BtreeRangeIter to BtreeCursorRange#1253
cberner merged 1 commit into
masterfrom
claude/migrate-multimap-btree-zUY26

Conversation

@cberner
Copy link
Copy Markdown
Owner

@cberner cberner commented May 13, 2026

Summary

This PR removes the BtreeRangeIter implementation and migrates all usages to the BtreeCursorRange type, consolidating the range iteration logic into a single implementation.

Key Changes

  • Removed from btree_iters.rs:

    • BtreeRangeIter<K, V> struct definition and all its implementations
    • Helper methods: is_leaf() and get_entry() from RangeIterState
    • Iterator trait implementations (Iterator and DoubleEndedIterator)
    • Initialization and state management methods (new, new_inner, close, advance, etc.)
  • Updated imports and usages:

    • Removed BtreeRangeIter from public exports in tree_store/mod.rs
    • Updated multimap_table.rs to use BtreeCursorRange instead of BtreeRangeIter in:
      • ValueIterState enum variant
      • MultimapValue::new_subtree() and new_subtree_free_on_drop() method signatures
      • All instantiation calls throughout the file (6 locations)

Implementation Details

The migration consolidates range iteration functionality by replacing the standalone BtreeRangeIter with BtreeCursorRange, which provides equivalent bidirectional iteration capabilities. The RangeIterState enum remains but with reduced helper methods, as the iteration logic is now centralized in BtreeCursorRange.

https://claude.ai/code/session_01FjAnvpv4K1pPnshfkNX7Pn

The previous commit replaced BtreeRangeIter at the tree range API; the
multimap value subtree iterators were the last in-tree callers. Switch
ValueIterState::Subtree and the empty-iterator fallbacks in
MultimapValue / MultimapTable / ReadOnlyMultimapTable over to
BtreeCursorRange so the BtreeRangeIter struct and its supporting impls
in btree_iters.rs can be removed (RangeIterState remains for
AllPageNumbersBtreeIter).

A micro-benchmark on a 200-key x 5000-value subtree-backed table
(release build) shows the new path is slightly faster on every
workload exercised:

  single_key_iter:  72.7 ms -> 64.3 ms
  range_iter:       75.6 ms -> 68.0 ms
  reverse_range:    79.0 ms -> 73.0 ms

Assisted-by: Claude <noreply@anthropic.com>
@cberner cberner force-pushed the claude/migrate-multimap-btree-zUY26 branch from 76cc77e to 4ffb4a8 Compare May 13, 2026 22:36
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.33%. Comparing base (6408c74) to head (4ffb4a8).

Files with missing lines Patch % Lines
src/multimap_table.rs 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1253      +/-   ##
==========================================
+ Coverage   88.10%   88.33%   +0.22%     
==========================================
  Files          36       36              
  Lines       15220    15022     -198     
==========================================
- Hits        13409    13269     -140     
+ Misses       1811     1753      -58     
Files with missing lines Coverage Δ
src/tree_store/btree_iters.rs 91.92% <ø> (+6.33%) ⬆️
src/multimap_table.rs 84.26% <87.50%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cberner cberner merged commit 695bfde into master May 13, 2026
8 checks passed
@cberner cberner deleted the claude/migrate-multimap-btree-zUY26 branch May 13, 2026 22:56
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