Repository navigation
store: Fix postponed indexes of copies and grafts - #6761
Draft
dimitrovmaksim wants to merge 2 commits into
Draft
dimitrovmaksim wants to merge 2 commits into
dimitrovmaksim wants to merge 2 commits into
Conversation
The background build of postponed indexes skipped an index only if one with the same name existed. Index names contain the positions of the table and the column. A copy's positions can differ from its source's, and older versions copied indexes under the source's names. If such a copy's flag was reset, the build added a second index on every shifted column. The build now compares the shape of the indexes, not their names. It only counts valid indexes, so that the leftover of an interrupted build is still dropped and rebuilt.
At the end of a copy or graft, `create_indexes` recreated the postponed indexes that existed on the source. It then always marked the destination as having built them. If the source hadn't built them yet, the destination never got them. Entity types that a graft added never got theirs either. The copy now reads the source's flag when it starts, before the source's indexes and on the source's shard. At the end, the destination gets its own postponed indexes for the columns the source has indexed, and for columns and entity types the source doesn't have. They are named for the destination, so its own build later doesn't add a second index on a column whose position changed. The destination then gets the source's flag. This also clears a flag that an older version set before the copy was interrupted. Fixes #6749
dimitrovmaksim
force-pushed
the
fix/copy-postponed-indexes-flag
branch
from
November 10, 2026 13:53
89ff7f7 to
0d0f6bc
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6749
At the end of a copy or graft,
create_indexesrecreated the postponed indexes that existed on the source and then always marked the destination as having built them. If the source hadn't built them yet, the destination never got them. Entity types that a graft added never got theirs either.Commits
postponed_indexes_createdflag when it starts, on the source's shard. At the end, the destination builds its own postponed indexes for the columns the source has indexed, and for columns and entity types the source doesn't have. They are named for the destination. The destination then gets the source's flag, which also clears a flag an older version set before the copy was interrupted.Tests
New graft tests in
store/test-store/tests/postgres/graft.rsand unit tests instore/postgres/src/relational/index.rs.