Skip to content

Cover trie index modes - #14967

Open
zaidoon1 wants to merge 12 commits into
facebook:mainfrom
zaidoon1:zaidoon/udi-10-trie-index-mode-tests
Open

Cover trie index modes#14967
zaidoon1 wants to merge 12 commits into
facebook:mainfrom
zaidoon1:zaidoon/udi-10-trie-index-mode-tests

Conversation

@zaidoon1

@zaidoon1 zaidoon1 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Part 12 of 13 in the UDI split.

Stack order:

  1. Add IndexFactory compatibility names #14954 Add IndexFactory compatibility names
  2. Add UDI index mode API vocabulary #14959 Add UDI index mode API vocabulary
  3. Add optional UDI builder protocols #14960 Add optional UDI builder protocols
  4. Add built-in index factory wrappers #14961 Add built-in index factory wrappers
  5. Add built-in index factory tests #14969 Add built-in index factory tests
  6. Promote IndexFactory as UDI SPI #14962 Promote IndexFactory as UDI SPI
  7. Wire IndexFactory through block-based tables #14963 Wire IndexFactory through block-based tables
  8. Add IndexFactory table routing tests #14964 Add IndexFactory table routing tests
  9. Add IndexFactory parallel routing tests #14970 Add IndexFactory parallel routing tests
  10. Account UDI blocks as index blocks #14965 Account UDI blocks as index blocks
  11. Support parallel AddIndexEntry in trie index #14966 Support parallel AddIndexEntry in trie index
  12. Cover trie index modes #14967 Cover trie index modes
  13. Add IndexFactory stress and benchmark flags #14968 Add IndexFactory stress and benchmark flags

Previous: #14966.
Next: #14968.

Depends on #14966. Because this PR targets facebook/rocksdb:main, GitHub shows a cumulative diff until earlier PRs land. After those land, the intended review diff is:

zaidoon/udi-09-trie-parallel-builder..zaidoon/udi-10-trie-index-mode-tests

That final review delta is 1 file with 707 insertions and 280 deletions.

What changed:

  • Add DB-level coverage for trie index mode combinations.
  • Keep trie mode test coverage separate from the trie builder implementation.

Validation:

  • AUTO_CLEAN=1 make -j14 trie_index_db_test
  • ./trie_index_db_test
  • make check-sources

@meta-cla meta-cla Bot added the CLA Signed label Jul 19, 2026
@zaidoon1
zaidoon1 force-pushed the zaidoon/udi-10-trie-index-mode-tests branch from a34e1f1 to 8ae640f Compare July 19, 2026 22:31
@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown

✅ clang-tidy: No findings on changed lines

Completed in 1094.9s.

@zaidoon1
zaidoon1 force-pushed the zaidoon/udi-10-trie-index-mode-tests branch 3 times, most recently from 3ed65cf to cbc3131 Compare July 20, 2026 04:53
@github-actions

Copy link
Copy Markdown

✅ Claude Code Review

Auto-triggered after CI passed — reviewing commit cbc3131


Summary

This is Part 12 of 13 in the UDI (User Defined Index) split. The cumulative diff is large (50 files, ~6000 insertions), but the PR-specific delta is 1 file (trie_index_db_test.cc) with ~707 insertions and ~280 deletions. The cumulative diff introduces the IndexFactory API refactoring (renaming UserDefinedIndexFactory to IndexFactory, adding IndexMode enum, ReadIndex enum, BuiltinIndexFactoryBuilder, parallel compression support for custom indexes, and standard_index_is_stub table property). The test file adds comprehensive DB-level coverage for trie index mode combinations. Overall this is a well-structured change with thorough test coverage.

High-severity findings (0):

No high-severity findings.

Full review (click to expand)

Findings

🔴 HIGH

None.

🟡 MEDIUM

M1. C API SyncIndexModeFromLegacyUdiOptions priority inversion -- db/c.cc:468

The SyncIndexModeFromLegacyUdiOptions() method checks use_udi_as_primary_index before fail_if_no_udi_on_open. If a caller sets both flags true then clears use_udi_as_primary_index, index_mode becomes kStandardRequired because fail_if_no_udi_on_open is still true. This is correct behavior but the C API test at db/c_test.c:3423 only tests each flag independently.

  • Suggested fix: Add a C API test that sets both flags, then clears one, to verify the interaction.
M2. Test parameterization covers only secondary/primary but not kCustomOnly or kStandardRequired -- trie_index_db_test.cc:4727

The test is parameterized with ::testing::Bool() (secondary vs primary mode), corresponding to kStandardDefault and kCustomDefault. The new IndexMode enum adds kCustomOnly and kStandardRequired, but these are not exercised by the DB-level tests despite the PR title "Cover trie index modes."

  • Suggested fix: Add parameterization or dedicated test cases for kCustomOnly and kStandardRequired modes, or add a TODO comment if planned for Part 13.
M3. OpenDBImpl and TrieIndexReadOptions() still use legacy APIs -- trie_index_db_test.cc:188,206

The test fixture uses table_options.use_udi_as_primary_index and ro.table_index_factory rather than the new IndexMode/ReadIndex enums directly. This tests the legacy->enum translation but not the new API paths. The db_wide_blob_direct_write_test.cc changes show migration to read_index = kPreferCustom, but the main test file doesn't follow suit.

  • Suggested fix: Add test paths using the new API directly (index_mode = kCustomDefault, read_index = kPreferCustom).

🟢 LOW / NIT

L1. CF handle cleanup uses delete instead of DestroyColumnFamilyHandle -- trie_index_db_test.cc:4583

In MultiCFCoalescingIterator, delete cf1; delete cf2; should be db_->DestroyColumnFamilyHandle(cf1/cf2) to match the pattern in MultipleColumnFamilies at line 1999.

L2. IndexMode enum value ordering -- include/rocksdb/table.h

kStandardRequired = 4 placed after kCustomOnly = 3 with a backward-compatibility comment. Logically kStandardRequired sits between kStandardDefault and kCustomDefault in the migration path but numerically comes last, which could confuse users comparing enum values.

Positive Observations

  • Comprehensive test coverage across flush, compaction, WAL replay, multi-CF, ingestion, prefix iteration, direction switching, same-user-key blocks, DeleteRange, MultiGet, coalescing iterators, and edge cases
  • Dual-index verification pattern catches divergence between standard and trie paths
  • Stress-like patterns (BatchedPrefixScanStressLike) mimic crash-test workloads
  • Clean C API bridge via SyncIndexModeFromLegacyUdiOptions()
  • All three build systems (Make, CMake, BUCK) updated consistently

ℹ️ 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

@zaidoon1
zaidoon1 force-pushed the zaidoon/udi-10-trie-index-mode-tests branch from cbc3131 to 7e66d47 Compare July 20, 2026 17:53
@zaidoon1
zaidoon1 force-pushed the zaidoon/udi-10-trie-index-mode-tests branch from 7e66d47 to 45a6afd Compare July 21, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant