fix(index): reuse primary-key index groups with retired source files - #253
fix(index): reuse primary-key index groups with retired source files#253wangyong9999 wants to merge 3 commits into
Conversation
|
The current changes seem reasonable to me. That said, to avoid |
Keep the full immutable source metadata for ordinal localization while covering only eligible sources present in the current scan. Reject conflicting or mismatched active intersections and leave uncovered files on the normal scan path.
cc1ea0d to
9a1f257
Compare
|
Thanks. I narrowed the revision to preserve the existing one-group-per-level lifecycle and added strict |
|
I checked the current Paimon Java and Python readers and confirmed the same exact-active-set rejection there. I filed apache/paimon#9458 and opened the aligned Java/Python fix in apache/paimon#9460. This C++ branch now also binds scan-side source matching to the group's data level, with a regression test for a source moving to another level. |
Purpose
Linked issue: close #252
A source-backed primary-key index payload uses one immutable ordered source list as its ordinal namespace. After an update retires only part of that list, the current reader requires the payload to equal the complete active source set of its data level. It rejects the still-valid payload and degrades every surviving indexed file to an ordinary scan.
The same lifecycle issue is tracked for Java and Python in apache/paimon#9458, with the aligned fix in apache/paimon#9460.
Key code and data-flow changes
source_meta.DataLevel().PrimaryKeyIndexSourcePolicy::ShouldRead, usingdata level + file name + row countas the scan-side source identity.IndexedSplit.This restores index reuse for surviving compact files without introducing a new writer lifecycle or allowing an uncovered file to depend on stale index metadata.
Error and compatibility boundaries
Tests
PkSortedBucketIndexStateTest.*:PrimaryKeySortedIndexScanTest.*— 37/37 passed.core_test— 1,747 passed, 100 skipped, 0 failed (1,847 total).DataLevelbinding regression set — 3/3 passed: cross-level source fallback, retired-source ordinal preservation, and wrong-level payload rejection.clang-formatdry-run andgit diff --checkpass.API and Format
No public include API, storage format, or index protocol changes. The change only broadens safe read-side reuse of one existing source-backed payload per level.
Documentation
Updated the primary-key global-index user guide to describe immutable source groups, partial active coverage, the one-group-per-level boundary, declared-level validation, and fallback behavior.
Generative AI tooling
Generated-by: OpenAI Codex (GPT-5)