Repository navigation
graph, store: Mirror source indexes on copy/graft - #6762
Draft
dimitrovmaksim wants to merge 2 commits into
Draft
dimitrovmaksim wants to merge 2 commits into
dimitrovmaksim wants to merge 2 commits into
Conversation
A copy took every index of the source into account, including invalid ones. An index is invalid when a concurrent build or drop of it failed or was interrupted, and while a concurrent build is still running. A copy rebuilt postponed indexes that an operator was dropping, or whose build had failed on the source. A copy now reads only the source's valid indexes. Dumps still read all of them, since they record the schema as it is.
Since #6434, a copy or graft created the indexes it gets with its tables from its own layout instead of from its source. Indexes dropped on the source came back, and manual indexes were lost. Before #6434, a copy followed its source only when postponement was on. A copy or graft now gets the indexes its source has, for each table the source has with the same mutability. graph-node's own indexes come from the layout, even where the source tuned them, and its attribute indexes are left out where the source has their columns but doesn't index them. A source index under a graph-node name is copied only when the table has its columns but doesn't index them, such as a GIN index on a list. The source's other indexes are copied with the statement Postgres prints for them, with only the schema name changed, each in its own savepoint. Those that can't be copied are logged with the reason. Tables that are new or changed mutability get the layout's indexes, also at the end of the copy. GRAPH_STORE_COPY_MIRROR_INDEXES, true by default, turns this off. Fixes #6722
dimitrovmaksim
force-pushed
the
fix/copy-mirror-source-indexes
branch
from
November 10, 2026 13:53
0ba00f3 to
2b2c548
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 #6722
Stacked on #6761. Review the last two commits only.
Since #6434, a copy or graft created the indexes it gets with its tables from its own layout instead of from its source. Indexes dropped on the source came back, and manual indexes were lost.
Commits
store: Ignore invalid indexes of a copy source. A copy now reads only the source's valid indexes. An index is invalid while a concurrent build is running, or after a concurrent build or drop failed or was interrupted. Before, a copy rebuilt postponed indexes an operator was dropping, or whose build had failed on the source. Dumps still read all indexes.
graph, store: Mirror source indexes on copy/graft. A copy or graft gets the indexes its source has, for each source table with the same mutability:
GRAPH_STORE_COPY_MIRROR_INDEXES(defaulttrue) turns this off.Tests
New graft tests in
store/test-store/tests/postgres/graft.rsand DDL tests instore/postgres/src/relational/ddl_tests.rs.