pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix marking of indisvalid for partitioned indexes at creation 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix marking of indisvalid for partitioned indexes at creation @ 2023-06-30 04:55 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2023-06-30 04:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix marking of indisvalid for partitioned indexes at creation The logic that introduced partitioned indexes missed a few things when invalidating a partitioned index when these are created, still the code is written to handle recursions: 1) If created from scratch because a mapping index could not be found, the new index created could be itself invalid, if for example it was a partitioned index with one of its leaves invalid. 2) A CCI was missing when indisvalid is set for a parent index, leading to inconsistent trees when recursing across more than one level for a partitioned index creation if an invalidation of the parent was required. This could lead to the creation of a partition index tree where some of the partitioned indexes are marked as invalid, but some of the parents are marked valid, which is not something that should happen (as validatePartitionedIndex() defines, indisvalid is switched to true for a partitioned index iff all its partitions are themselves valid). This patch makes sure that indisvalid is set to false on a partitioned index if at least one of its partition is invalid. The flag is set to true if *all* its partitions are valid. The regression test added in this commit abuses of a failed concurrent index creation, marked as invalid, that maps with an index created on its partitioned table afterwards. Reported-by: Alexander Lakhin Reviewed-by: Alexander Lakhin Discussion: https://postgr.es/m/14987634-43c0-0cb3-e075-94d423607e08@gmail.com Backpatch-through: 11 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/cfc43aeb3810ebaa8dbda4807046a4c953d9e992 Modified Files -------------- src/backend/commands/indexcmds.c | 31 +++++++++++++++++++++++------- src/test/regress/expected/indexing.out | 35 ++++++++++++++++++++++++++++++++++ src/test/regress/sql/indexing.sql | 26 +++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix marking of indisvalid for partitioned indexes at creation @ 2023-06-30 04:55 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2023-06-30 04:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix marking of indisvalid for partitioned indexes at creation The logic that introduced partitioned indexes missed a few things when invalidating a partitioned index when these are created, still the code is written to handle recursions: 1) If created from scratch because a mapping index could not be found, the new index created could be itself invalid, if for example it was a partitioned index with one of its leaves invalid. 2) A CCI was missing when indisvalid is set for a parent index, leading to inconsistent trees when recursing across more than one level for a partitioned index creation if an invalidation of the parent was required. This could lead to the creation of a partition index tree where some of the partitioned indexes are marked as invalid, but some of the parents are marked valid, which is not something that should happen (as validatePartitionedIndex() defines, indisvalid is switched to true for a partitioned index iff all its partitions are themselves valid). This patch makes sure that indisvalid is set to false on a partitioned index if at least one of its partition is invalid. The flag is set to true if *all* its partitions are valid. The regression test added in this commit abuses of a failed concurrent index creation, marked as invalid, that maps with an index created on its partitioned table afterwards. Reported-by: Alexander Lakhin Reviewed-by: Alexander Lakhin Discussion: https://postgr.es/m/14987634-43c0-0cb3-e075-94d423607e08@gmail.com Backpatch-through: 11 Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/537b70b82c2ccc79f7a81a5c662c2816cc8d0a34 Modified Files -------------- src/backend/commands/indexcmds.c | 29 ++++++++++++++++++++++------ src/test/regress/expected/indexing.out | 35 ++++++++++++++++++++++++++++++++++ src/test/regress/sql/indexing.sql | 26 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix marking of indisvalid for partitioned indexes at creation @ 2023-06-30 04:55 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2023-06-30 04:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix marking of indisvalid for partitioned indexes at creation The logic that introduced partitioned indexes missed a few things when invalidating a partitioned index when these are created, still the code is written to handle recursions: 1) If created from scratch because a mapping index could not be found, the new index created could be itself invalid, if for example it was a partitioned index with one of its leaves invalid. 2) A CCI was missing when indisvalid is set for a parent index, leading to inconsistent trees when recursing across more than one level for a partitioned index creation if an invalidation of the parent was required. This could lead to the creation of a partition index tree where some of the partitioned indexes are marked as invalid, but some of the parents are marked valid, which is not something that should happen (as validatePartitionedIndex() defines, indisvalid is switched to true for a partitioned index iff all its partitions are themselves valid). This patch makes sure that indisvalid is set to false on a partitioned index if at least one of its partition is invalid. The flag is set to true if *all* its partitions are valid. The regression test added in this commit abuses of a failed concurrent index creation, marked as invalid, that maps with an index created on its partitioned table afterwards. Reported-by: Alexander Lakhin Reviewed-by: Alexander Lakhin Discussion: https://postgr.es/m/14987634-43c0-0cb3-e075-94d423607e08@gmail.com Backpatch-through: 11 Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/dbe0e5c56f313aec94cd8cf0c4f922867b2a95c5 Modified Files -------------- src/backend/commands/indexcmds.c | 29 ++++++++++++++++++++++------ src/test/regress/expected/indexing.out | 35 ++++++++++++++++++++++++++++++++++ src/test/regress/sql/indexing.sql | 26 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix marking of indisvalid for partitioned indexes at creation @ 2023-06-30 04:55 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2023-06-30 04:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix marking of indisvalid for partitioned indexes at creation The logic that introduced partitioned indexes missed a few things when invalidating a partitioned index when these are created, still the code is written to handle recursions: 1) If created from scratch because a mapping index could not be found, the new index created could be itself invalid, if for example it was a partitioned index with one of its leaves invalid. 2) A CCI was missing when indisvalid is set for a parent index, leading to inconsistent trees when recursing across more than one level for a partitioned index creation if an invalidation of the parent was required. This could lead to the creation of a partition index tree where some of the partitioned indexes are marked as invalid, but some of the parents are marked valid, which is not something that should happen (as validatePartitionedIndex() defines, indisvalid is switched to true for a partitioned index iff all its partitions are themselves valid). This patch makes sure that indisvalid is set to false on a partitioned index if at least one of its partition is invalid. The flag is set to true if *all* its partitions are valid. The regression test added in this commit abuses of a failed concurrent index creation, marked as invalid, that maps with an index created on its partitioned table afterwards. Reported-by: Alexander Lakhin Reviewed-by: Alexander Lakhin Discussion: https://postgr.es/m/14987634-43c0-0cb3-e075-94d423607e08@gmail.com Backpatch-through: 11 Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c75c33de5bab97e7e558480c59519377ad9e2751 Modified Files -------------- src/backend/commands/indexcmds.c | 29 ++++++++++++++++++++++------ src/backend/utils/cache/lsyscache.c | 23 ++++++++++++++++++++++ src/include/utils/lsyscache.h | 1 + src/test/regress/expected/indexing.out | 35 ++++++++++++++++++++++++++++++++++ src/test/regress/sql/indexing.sql | 26 +++++++++++++++++++++++++ 5 files changed, 108 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix marking of indisvalid for partitioned indexes at creation @ 2023-06-30 04:55 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2023-06-30 04:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix marking of indisvalid for partitioned indexes at creation The logic that introduced partitioned indexes missed a few things when invalidating a partitioned index when these are created, still the code is written to handle recursions: 1) If created from scratch because a mapping index could not be found, the new index created could be itself invalid, if for example it was a partitioned index with one of its leaves invalid. 2) A CCI was missing when indisvalid is set for a parent index, leading to inconsistent trees when recursing across more than one level for a partitioned index creation if an invalidation of the parent was required. This could lead to the creation of a partition index tree where some of the partitioned indexes are marked as invalid, but some of the parents are marked valid, which is not something that should happen (as validatePartitionedIndex() defines, indisvalid is switched to true for a partitioned index iff all its partitions are themselves valid). This patch makes sure that indisvalid is set to false on a partitioned index if at least one of its partition is invalid. The flag is set to true if *all* its partitions are valid. The regression test added in this commit abuses of a failed concurrent index creation, marked as invalid, that maps with an index created on its partitioned table afterwards. Reported-by: Alexander Lakhin Reviewed-by: Alexander Lakhin Discussion: https://postgr.es/m/14987634-43c0-0cb3-e075-94d423607e08@gmail.com Backpatch-through: 11 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f4691e2e76a4ba6a340668160d8008124c2140a0 Modified Files -------------- src/backend/commands/indexcmds.c | 31 +++++++++++++++++++++++------- src/test/regress/expected/indexing.out | 35 ++++++++++++++++++++++++++++++++++ src/test/regress/sql/indexing.sql | 26 +++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix marking of indisvalid for partitioned indexes at creation @ 2023-06-30 04:55 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2023-06-30 04:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix marking of indisvalid for partitioned indexes at creation The logic that introduced partitioned indexes missed a few things when invalidating a partitioned index when these are created, still the code is written to handle recursions: 1) If created from scratch because a mapping index could not be found, the new index created could be itself invalid, if for example it was a partitioned index with one of its leaves invalid. 2) A CCI was missing when indisvalid is set for a parent index, leading to inconsistent trees when recursing across more than one level for a partitioned index creation if an invalidation of the parent was required. This could lead to the creation of a partition index tree where some of the partitioned indexes are marked as invalid, but some of the parents are marked valid, which is not something that should happen (as validatePartitionedIndex() defines, indisvalid is switched to true for a partitioned index iff all its partitions are themselves valid). This patch makes sure that indisvalid is set to false on a partitioned index if at least one of its partition is invalid. The flag is set to true if *all* its partitions are valid. The regression test added in this commit abuses of a failed concurrent index creation, marked as invalid, that maps with an index created on its partitioned table afterwards. Reported-by: Alexander Lakhin Reviewed-by: Alexander Lakhin Discussion: https://postgr.es/m/14987634-43c0-0cb3-e075-94d423607e08@gmail.com Backpatch-through: 11 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cb4ac3e5685f823e79aaa8508edef86d48718bea Modified Files -------------- src/backend/commands/indexcmds.c | 29 ++++++++++++++++++++++------ src/test/regress/expected/indexing.out | 35 ++++++++++++++++++++++++++++++++++ src/test/regress/sql/indexing.sql | 26 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix marking of indisvalid for partitioned indexes at creation @ 2023-06-30 04:55 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 7+ messages in thread From: Michael Paquier @ 2023-06-30 04:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix marking of indisvalid for partitioned indexes at creation The logic that introduced partitioned indexes missed a few things when invalidating a partitioned index when these are created, still the code is written to handle recursions: 1) If created from scratch because a mapping index could not be found, the new index created could be itself invalid, if for example it was a partitioned index with one of its leaves invalid. 2) A CCI was missing when indisvalid is set for a parent index, leading to inconsistent trees when recursing across more than one level for a partitioned index creation if an invalidation of the parent was required. This could lead to the creation of a partition index tree where some of the partitioned indexes are marked as invalid, but some of the parents are marked valid, which is not something that should happen (as validatePartitionedIndex() defines, indisvalid is switched to true for a partitioned index iff all its partitions are themselves valid). This patch makes sure that indisvalid is set to false on a partitioned index if at least one of its partition is invalid. The flag is set to true if *all* its partitions are valid. The regression test added in this commit abuses of a failed concurrent index creation, marked as invalid, that maps with an index created on its partitioned table afterwards. Reported-by: Alexander Lakhin Reviewed-by: Alexander Lakhin Discussion: https://postgr.es/m/14987634-43c0-0cb3-e075-94d423607e08@gmail.com Backpatch-through: 11 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/663b35f2df6261e5531d97967bca04d95a61ee15 Modified Files -------------- src/backend/commands/indexcmds.c | 29 ++++++++++++++++++++++------ src/test/regress/expected/indexing.out | 35 ++++++++++++++++++++++++++++++++++ src/test/regress/sql/indexing.sql | 26 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 6 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2023-06-30 04:55 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-06-30 04:55 pgsql: Fix marking of indisvalid for partitioned indexes at creation Michael Paquier <michael@paquier.xyz> 2023-06-30 04:55 pgsql: Fix marking of indisvalid for partitioned indexes at creation Michael Paquier <michael@paquier.xyz> 2023-06-30 04:55 pgsql: Fix marking of indisvalid for partitioned indexes at creation Michael Paquier <michael@paquier.xyz> 2023-06-30 04:55 pgsql: Fix marking of indisvalid for partitioned indexes at creation Michael Paquier <michael@paquier.xyz> 2023-06-30 04:55 pgsql: Fix marking of indisvalid for partitioned indexes at creation Michael Paquier <michael@paquier.xyz> 2023-06-30 04:55 pgsql: Fix marking of indisvalid for partitioned indexes at creation Michael Paquier <michael@paquier.xyz> 2023-06-30 04:55 pgsql: Fix marking of indisvalid for partitioned indexes at creation Michael Paquier <michael@paquier.xyz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox