From 9f57335f77816cddac93ff85a9e9a84a69ddaf55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E7=A8=8B?= <517719039@qq.com> Date: Thu, 13 Mar 2025 17:09:28 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0interval=E5=88=86?= =?UTF-8?q?=E5=8C=BA=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/regress/expected/gpi_clean_wait.out | 2 +- src/test/regress/sql/gpi_clean_wait.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/regress/expected/gpi_clean_wait.out b/src/test/regress/expected/gpi_clean_wait.out index dcf7a2fbc9..2ecc2f2245 100644 --- a/src/test/regress/expected/gpi_clean_wait.out +++ b/src/test/regress/expected/gpi_clean_wait.out @@ -559,10 +559,10 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "interval_partiti create index global_index_interval_partition_table_vacuum_a on interval_partition_table_vacuum(c1) global; \parallel on insert into interval_partition_table_vacuum values (generate_series(1,10), generate_series(1,10), generate_series(TO_DATE('1990-01-01', 'YYYY-MM-DD'),TO_DATE('2020-12-01', 'YYYY-MM-DD'),'1 day')); +\parallel off vacuum interval_partition_table_vacuum; vacuum interval_partition_table_vacuum; vacuum analyze interval_partition_table_vacuum; -\parallel off set enable_seqscan = off; set enable_bitmapscan = off; explain (costs off) select count(*) from interval_partition_table_vacuum where c1 = 1; diff --git a/src/test/regress/sql/gpi_clean_wait.sql b/src/test/regress/sql/gpi_clean_wait.sql index 900cdadf5e..4dadeaf862 100644 --- a/src/test/regress/sql/gpi_clean_wait.sql +++ b/src/test/regress/sql/gpi_clean_wait.sql @@ -231,10 +231,10 @@ create index global_index_interval_partition_table_vacuum_a on interval_partitio \parallel on insert into interval_partition_table_vacuum values (generate_series(1,10), generate_series(1,10), generate_series(TO_DATE('1990-01-01', 'YYYY-MM-DD'),TO_DATE('2020-12-01', 'YYYY-MM-DD'),'1 day')); +\parallel off vacuum interval_partition_table_vacuum; vacuum interval_partition_table_vacuum; vacuum analyze interval_partition_table_vacuum; -\parallel off set enable_seqscan = off; set enable_bitmapscan = off; -- Gitee From d59f18af2807531bd3a173d5975b97c9d8089e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E7=A8=8B?= <517719039@qq.com> Date: Fri, 14 Mar 2025 11:15:02 +0800 Subject: [PATCH 2/6] =?UTF-8?q?Revert=20"=E6=9B=B4=E6=96=B0interval?= =?UTF-8?q?=E5=88=86=E5=8C=BA=E7=94=A8=E4=BE=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9f57335f77816cddac93ff85a9e9a84a69ddaf55. --- src/test/regress/expected/gpi_clean_wait.out | 2 +- src/test/regress/sql/gpi_clean_wait.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/regress/expected/gpi_clean_wait.out b/src/test/regress/expected/gpi_clean_wait.out index 2ecc2f2245..dcf7a2fbc9 100644 --- a/src/test/regress/expected/gpi_clean_wait.out +++ b/src/test/regress/expected/gpi_clean_wait.out @@ -559,10 +559,10 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "interval_partiti create index global_index_interval_partition_table_vacuum_a on interval_partition_table_vacuum(c1) global; \parallel on insert into interval_partition_table_vacuum values (generate_series(1,10), generate_series(1,10), generate_series(TO_DATE('1990-01-01', 'YYYY-MM-DD'),TO_DATE('2020-12-01', 'YYYY-MM-DD'),'1 day')); -\parallel off vacuum interval_partition_table_vacuum; vacuum interval_partition_table_vacuum; vacuum analyze interval_partition_table_vacuum; +\parallel off set enable_seqscan = off; set enable_bitmapscan = off; explain (costs off) select count(*) from interval_partition_table_vacuum where c1 = 1; diff --git a/src/test/regress/sql/gpi_clean_wait.sql b/src/test/regress/sql/gpi_clean_wait.sql index 4dadeaf862..900cdadf5e 100644 --- a/src/test/regress/sql/gpi_clean_wait.sql +++ b/src/test/regress/sql/gpi_clean_wait.sql @@ -231,10 +231,10 @@ create index global_index_interval_partition_table_vacuum_a on interval_partitio \parallel on insert into interval_partition_table_vacuum values (generate_series(1,10), generate_series(1,10), generate_series(TO_DATE('1990-01-01', 'YYYY-MM-DD'),TO_DATE('2020-12-01', 'YYYY-MM-DD'),'1 day')); -\parallel off vacuum interval_partition_table_vacuum; vacuum interval_partition_table_vacuum; vacuum analyze interval_partition_table_vacuum; +\parallel off set enable_seqscan = off; set enable_bitmapscan = off; -- Gitee From 89d0e9a218587cf3d3df1ad154c475725b834fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E7=A8=8B?= <517719039@qq.com> Date: Fri, 14 Mar 2025 11:15:48 +0800 Subject: [PATCH 3/6] 1 --- src/common/backend/catalog/heap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/backend/catalog/heap.cpp b/src/common/backend/catalog/heap.cpp index 80b163bdc5..8bca97e9fb 100644 --- a/src/common/backend/catalog/heap.cpp +++ b/src/common/backend/catalog/heap.cpp @@ -6968,7 +6968,6 @@ Oid AddNewIntervalPartition(Relation rel, void* insertTuple, int *partitionno, b if (RELATION_SUPPORT_AUTONOMOUS_EXTEND_PARTITION && HeapAddIntervalPartitionByAutonomousSession(rel, insertTuple)) { UnlockPartitionObject(rel->rd_id, INTERVAL_PARTITION_LOCK_SDEQUENCE, PARTITION_EXCLUSIVE_LOCK); - AcceptInvalidationMessages(); // routing again partitionRoutingForTuple(rel, insertTuple, u_sess->catalog_cxt.route, false, true); if (u_sess->catalog_cxt.route->fileExist) { @@ -7033,6 +7032,8 @@ Oid AddNewIntervalPartition(Relation rel, void* insertTuple, int *partitionno, b */ CommandCounterIncrement(); + AcceptInvalidationMessages(); + /* * If add interval partition in the DDL, do not need to change the csn * because the scn has been changed in the DDL. -- Gitee From 01ff005b79df9044ba3d3fe6851d6a81033fdb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E7=A8=8B?= <517719039@qq.com> Date: Fri, 14 Mar 2025 11:28:38 +0800 Subject: [PATCH 4/6] 1 --- src/common/backend/catalog/heap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/backend/catalog/heap.cpp b/src/common/backend/catalog/heap.cpp index 8bca97e9fb..eaaeac7fe4 100644 --- a/src/common/backend/catalog/heap.cpp +++ b/src/common/backend/catalog/heap.cpp @@ -6968,6 +6968,7 @@ Oid AddNewIntervalPartition(Relation rel, void* insertTuple, int *partitionno, b if (RELATION_SUPPORT_AUTONOMOUS_EXTEND_PARTITION && HeapAddIntervalPartitionByAutonomousSession(rel, insertTuple)) { UnlockPartitionObject(rel->rd_id, INTERVAL_PARTITION_LOCK_SDEQUENCE, PARTITION_EXCLUSIVE_LOCK); + AcceptInvalidationMessages(); // routing again partitionRoutingForTuple(rel, insertTuple, u_sess->catalog_cxt.route, false, true); if (u_sess->catalog_cxt.route->fileExist) { @@ -7033,7 +7034,6 @@ Oid AddNewIntervalPartition(Relation rel, void* insertTuple, int *partitionno, b CommandCounterIncrement(); AcceptInvalidationMessages(); - /* * If add interval partition in the DDL, do not need to change the csn * because the scn has been changed in the DDL. -- Gitee From def5151e6af4bb51d05ac73a16679a724cebb2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E7=A8=8B?= <517719039@qq.com> Date: Fri, 14 Mar 2025 11:35:08 +0800 Subject: [PATCH 5/6] x --- src/common/backend/catalog/heap.cpp | 42 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/common/backend/catalog/heap.cpp b/src/common/backend/catalog/heap.cpp index eaaeac7fe4..443d0bfafe 100644 --- a/src/common/backend/catalog/heap.cpp +++ b/src/common/backend/catalog/heap.cpp @@ -6965,26 +6965,26 @@ Oid AddNewIntervalPartition(Relation rel, void* insertTuple, int *partitionno, b errhint("please reindex the unusable index first."))); } - if (RELATION_SUPPORT_AUTONOMOUS_EXTEND_PARTITION - && HeapAddIntervalPartitionByAutonomousSession(rel, insertTuple)) { - UnlockPartitionObject(rel->rd_id, INTERVAL_PARTITION_LOCK_SDEQUENCE, PARTITION_EXCLUSIVE_LOCK); - AcceptInvalidationMessages(); - // routing again - partitionRoutingForTuple(rel, insertTuple, u_sess->catalog_cxt.route, false, true); - if (u_sess->catalog_cxt.route->fileExist) { - Assert(OidIsValid(u_sess->catalog_cxt.route->partitionId)); - newPartOid = u_sess->catalog_cxt.route->partitionId; - if (PointerIsValid(partitionno)) { - *partitionno = GetPartitionnoFromSequence(rel->partMap, u_sess->catalog_cxt.route->partSeq); - } - } else { - ereport(ERROR, (errmsg("search failed for new added interval partition."))); - } - return newPartOid; - } - - ereport(LOG, - (errmsg("add new interval partition on heap %s by current session.", RelationGetRelationName(rel)))); + // if (RELATION_SUPPORT_AUTONOMOUS_EXTEND_PARTITION + // && HeapAddIntervalPartitionByAutonomousSession(rel, insertTuple)) { + // UnlockPartitionObject(rel->rd_id, INTERVAL_PARTITION_LOCK_SDEQUENCE, PARTITION_EXCLUSIVE_LOCK); + // AcceptInvalidationMessages(); + // // routing again + // partitionRoutingForTuple(rel, insertTuple, u_sess->catalog_cxt.route, false, true); + // if (u_sess->catalog_cxt.route->fileExist) { + // Assert(OidIsValid(u_sess->catalog_cxt.route->partitionId)); + // newPartOid = u_sess->catalog_cxt.route->partitionId; + // if (PointerIsValid(partitionno)) { + // *partitionno = GetPartitionnoFromSequence(rel->partMap, u_sess->catalog_cxt.route->partSeq); + // } + // } else { + // ereport(ERROR, (errmsg("search failed for new added interval partition."))); + // } + // return newPartOid; + // } + + // ereport(LOG, + // (errmsg("add new interval partition on heap %s by current session.", RelationGetRelationName(rel)))); pgPartRel = relation_open(PartitionRelationId, RowExclusiveLock); @@ -7033,7 +7033,7 @@ Oid AddNewIntervalPartition(Relation rel, void* insertTuple, int *partitionno, b */ CommandCounterIncrement(); - AcceptInvalidationMessages(); + // AcceptInvalidationMessages(); /* * If add interval partition in the DDL, do not need to change the csn * because the scn has been changed in the DDL. -- Gitee From 56314249e0fcf7970419e8887b5da7ff39dcb522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=85=E7=A8=8B?= <517719039@qq.com> Date: Fri, 14 Mar 2025 11:41:43 +0800 Subject: [PATCH 6/6] y --- src/common/backend/catalog/heap.cpp | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/common/backend/catalog/heap.cpp b/src/common/backend/catalog/heap.cpp index 443d0bfafe..7309b33ce0 100644 --- a/src/common/backend/catalog/heap.cpp +++ b/src/common/backend/catalog/heap.cpp @@ -6965,26 +6965,26 @@ Oid AddNewIntervalPartition(Relation rel, void* insertTuple, int *partitionno, b errhint("please reindex the unusable index first."))); } - // if (RELATION_SUPPORT_AUTONOMOUS_EXTEND_PARTITION - // && HeapAddIntervalPartitionByAutonomousSession(rel, insertTuple)) { - // UnlockPartitionObject(rel->rd_id, INTERVAL_PARTITION_LOCK_SDEQUENCE, PARTITION_EXCLUSIVE_LOCK); - // AcceptInvalidationMessages(); - // // routing again - // partitionRoutingForTuple(rel, insertTuple, u_sess->catalog_cxt.route, false, true); - // if (u_sess->catalog_cxt.route->fileExist) { - // Assert(OidIsValid(u_sess->catalog_cxt.route->partitionId)); - // newPartOid = u_sess->catalog_cxt.route->partitionId; - // if (PointerIsValid(partitionno)) { - // *partitionno = GetPartitionnoFromSequence(rel->partMap, u_sess->catalog_cxt.route->partSeq); - // } - // } else { - // ereport(ERROR, (errmsg("search failed for new added interval partition."))); - // } - // return newPartOid; - // } - - // ereport(LOG, - // (errmsg("add new interval partition on heap %s by current session.", RelationGetRelationName(rel)))); + if (RELATION_SUPPORT_AUTONOMOUS_EXTEND_PARTITION + && HeapAddIntervalPartitionByAutonomousSession(rel, insertTuple)) { + UnlockPartitionObject(rel->rd_id, INTERVAL_PARTITION_LOCK_SDEQUENCE, PARTITION_EXCLUSIVE_LOCK); + AcceptInvalidationMessages(); + // routing again + partitionRoutingForTuple(rel, insertTuple, u_sess->catalog_cxt.route, false, true); + if (u_sess->catalog_cxt.route->fileExist) { + Assert(OidIsValid(u_sess->catalog_cxt.route->partitionId)); + newPartOid = u_sess->catalog_cxt.route->partitionId; + if (PointerIsValid(partitionno)) { + *partitionno = GetPartitionnoFromSequence(rel->partMap, u_sess->catalog_cxt.route->partSeq); + } + } else { + ereport(ERROR, (errmsg("search failed for new added interval partition."))); + } + return newPartOid; + } + + ereport(LOG, + (errmsg("add new interval partition on heap %s by current session.", RelationGetRelationName(rel)))); pgPartRel = relation_open(PartitionRelationId, RowExclusiveLock); -- Gitee