public inbox for [email protected]help / color / mirror / Atom feed
[PATCH v9 8/8] pg_dump: partitioned index depend on its partitions 91+ messages / 2 participants [nested] [flat]
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v10 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 88a68a4697..aaf955458c 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -18153,6 +18153,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -18164,9 +18167,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx), false); parentTblId = get_partition_parent(RelationGetRelid(partedTbl), false); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --mvpLiMfbWzRoNl4x-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --AA9g+nFNFPYNJKiL-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 420991e315..a478c13990 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17521,6 +17521,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17532,9 +17535,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --O5XBE6gyVG5Rl6Rj-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8687e9a97c..865ab6c2e9 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17493,6 +17493,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17504,9 +17507,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index b0f02bc1f6..2a7d9b463c 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --FsscpQKzF/jJk6ya-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions @ 2020-11-25 23:34 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Justin Pryzby @ 2020-11-25 23:34 UTC (permalink / raw) This is required for restoring clustered parent index, which is marked INVALID until indexes have been built on all its child tables, and it's prohibited to CLUSTER ON an INVALID index See also: 8cff4f5348d075e063100071013f00a900c32b0f --- src/backend/commands/tablecmds.c | 6 +++--- src/bin/pg_dump/common.c | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 559fa1d2e5..eb56890311 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17497,6 +17497,9 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) table_close(idxRel, RowExclusiveLock); } + /* make sure we see the validation we just did */ + CommandCounterIncrement(); + /* * If this index is in turn a partition of a larger index, validating it * might cause the parent to become valid also. Try that. @@ -17508,9 +17511,6 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl) Relation parentIdx, parentTbl; - /* make sure we see the validation we just did */ - CommandCounterIncrement(); - parentIdxId = get_partition_parent(RelationGetRelid(partedIdx)); parentTblId = get_partition_parent(RelationGetRelid(partedTbl)); parentIdx = relation_open(parentIdxId, AccessExclusiveLock); diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 1a261a5545..cdfba058fc 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -429,6 +429,12 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) attachinfo[k].parentIdx = parentidx; attachinfo[k].partitionIdx = index; + /* + * We want dependencies from parent to partition (so that the + * partition index is created first) + */ + addObjectDependency(&parentidx->dobj, index->dobj.dumpId); + /* * We must state the DO_INDEX_ATTACH object's dependencies * explicitly, since it will not match anything in pg_depend. @@ -446,6 +452,8 @@ flagInhIndexes(Archive *fout, TableInfo tblinfo[], int numTables) */ addObjectDependency(&attachinfo[k].dobj, index->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, parentidx->dobj.dumpId); + // addObjectDependency(&parentidx->dobj, attachinfo[k].dobj.dumpId); + addObjectDependency(&attachinfo[k].dobj, index->indextable->dobj.dumpId); addObjectDependency(&attachinfo[k].dobj, -- 2.17.0 --fmvA4kSBHQVZhkR6-- ^ permalink raw reply [nested|flat] 91+ messages in thread
* Re: Make set_ps_display faster and easier to use @ 2023-02-17 01:01 Andres Freund <[email protected]> 0 siblings, 0 replies; 91+ messages in thread From: Andres Freund @ 2023-02-17 01:01 UTC (permalink / raw) To: David Rowley <[email protected]>; +Cc: PostgreSQL Developers <[email protected]> Hi, On 2023-02-16 14:19:24 +1300, David Rowley wrote: > After fixing up the set_ps_display()s to use set_ps_display_with_len() > where possible, I discovered some not so nice code which appends " > waiting" onto the process title. Basically, there's a bunch of code > that looks like this: > > const char *old_status; > int len; > > old_status = get_ps_display(&len); > new_status = (char *) palloc(len + 8 + 1); > memcpy(new_status, old_status, len); > strcpy(new_status + len, " waiting"); > set_ps_display(new_status); > new_status[len] = '\0'; /* truncate off " waiting" */ Yea, that code is atrocious... It took me a while to figure out that no, LockBufferForCleanup() isn't leaking memory, because it'll always reach the cleanup path *further up* in the function. Avoiding the allocation across loop iterations seems like a completely pointless optimization in these paths - we add the " waiting", precisely because it's a slow path. But of course not allocating memory would be even better... > Seeing that made me wonder if we shouldn't just have something more > generic for setting a suffix on the process title. I came up with > set_ps_display_suffix() and set_ps_display_remove_suffix(). The above > code can just become: > > set_ps_display_suffix("waiting"); > > then to remove the "waiting" suffix, just: > > set_ps_display_remove_suffix(); That'd definitely be better. It's not really a topic for this patch, but somehow the fact that we have these set_ps_display() calls all over feels wrong, particularly because most of them are paired with a pgstat_report_activity() call. It's not entirely obvious how it should be instead, but it doesn't feel right. > +/* > + * set_ps_display_suffix > + * Adjust the process title to append 'suffix' onto the end with a space > + * between it and the current process title. > + */ > +void > +set_ps_display_suffix(const char *suffix) > +{ > + size_t len; Think this will give you an unused-variable warning in the PS_USE_NONE case. > +#ifndef PS_USE_NONE > + /* update_process_title=off disables updates */ > + if (!update_process_title) > + return; > + > + /* no ps display for stand-alone backend */ > + if (!IsUnderPostmaster) > + return; > + > +#ifdef PS_USE_CLOBBER_ARGV > + /* If ps_buffer is a pointer, it might still be null */ > + if (!ps_buffer) > + return; > +#endif This bit is now repeated three times. How about putting it into a helper? > +#ifndef PS_USE_NONE > +static void > +set_ps_display_internal(void) Very very minor nit: Perhaps this should be update_ps_display() or flush_ps_display() instead? Greetings, Andres Freund ^ permalink raw reply [nested|flat] 91+ messages in thread
end of thread, other threads:[~2023-02-17 01:01 UTC | newest] Thread overview: 91+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v10 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v7 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v6 7/7] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v8 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2020-11-25 23:34 [PATCH v9 8/8] pg_dump: partitioned index depend on its partitions Justin Pryzby <[email protected]> 2023-02-17 01:01 Re: Make set_ps_display faster and easier to use Andres Freund <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox