Expose AdvancedColumnFamilyOptions::memtable_batch_lookup_optimization in the C API#14776
Expose AdvancedColumnFamilyOptions::memtable_batch_lookup_optimization in the C API#14776zaidoon1 wants to merge 1 commit into
Conversation
…n in the C API
The skip-list memtable gained an opt-in batch-lookup optimization that
caches the search path between consecutive MultiGet keys, reducing
per-key cost from O(log N) to O(log d) where d is the distance between
consecutive keys. The optimization is gated by a new immutable
AdvancedColumnFamilyOptions field (default: false) which had no C API
setter, so the optimization was unreachable from C/Rust.
Add a setter/getter pair mirroring the existing
rocksdb_options_{set,get}_memtable_huge_page_size — the closest sibling
on both the C API side (adjacent memtable knob) and the C++ side (same
AdvancedColumnFamilyOptions parent struct).
The field is immutable on the C++ side, so the setter only takes effect
on options used to open a column family.
No change to the C++ API.
✅ clang-tidy: No findings on changed linesCompleted in 54.7s. |
🟡 Codex Code ReviewAuto-triggered after CI passed — reviewing commit c4d237d ❌ Codex review failed before producing findings. ℹ️ About this responseGenerated by Codex CLI. Limitations:
Commands:
|
✅ Claude Code ReviewAuto-triggered after CI passed — reviewing commit c4d237d SummaryClean, mechanical PR that correctly adds C API getter/setter for an existing C++ bool field following established patterns. One missing test case for copy independence. High-severity findings (0): No high-severity findings. Full review (click to expand)Findings🔴 HIGHNone. 🟡 MEDIUMM1. Missing copy-independence test —
|
| Context | Relevant? | Assessment |
|---|---|---|
| WritePreparedTxnDB | No | Getter/setter only — no runtime behavior change |
| ReadOnly DB | No | Options set before open |
| User-defined timestamps | No | Orthogonal |
| All other contexts | No | Pure options plumbing |
The PR adds no new code paths, no new logic, no new data structures. It is a thin passthrough from C to an existing C++ field. All correctness, concurrency, and behavioral guarantees are unchanged from the existing C++ implementation.
Positive Observations
- Follows the established
unsigned charconvention for C API bool fields exactly - Placement in c.h, c.cc, and c_test.c is consistent with neighboring options
- Tests verify both default value and set/get round-trip
- Copy verification test is included
- Release note file correctly placed in
unreleased_history/public_api_changes/
ℹ️ About this response
Generated by Claude Code.
Review methodology: claude_md/code_review.md
Limitations:
- Claude may miss context from files not in the diff
- Large PRs may be truncated
- Always apply human judgment to AI suggestions
Commands:
/claude-review [context]— Request a code review/claude-query <question>— Ask about the PR or codebase
Summary
AdvancedColumnFamilyOptions::memtable_batch_lookup_optimization(advanced_options.h) gates the skip-list memtable's batch-lookup optimization forMultiGet. When enabled, the search path is cached between consecutive keys, reducing per-key cost fromO(log N)toO(log d)wheredis the distance between consecutive keys.The C++ field exists; the C API setter does not. This PR adds the missing pair, mirroring the existing
rocksdb_options_{set,get}_memtable_huge_page_sizeshape exactly — the closest sibling on both axes:rocksdb_options_t*receiver.AdvancedColumnFamilyOptionsparent struct, same immutability semantics.Motivation
Without this setter, C API consumers and downstream bindings cannot opt into the batch-lookup optimization. Non-skip-list memtable implementations fall back to per-key lookups, so the flag is a no-op for them.
The field is immutable on the C++ side, so calling the setter on options that are already in use by an open DB has no effect on that DB — same constraint as the underlying C++ field. This matches the behavior of every other immutable-options setter in the C API.
No change to the C++ API.