pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix tuple search during apply after concurrent index DDL. 5+ messages / 1 participants [nested] [flat]
* pgsql: Fix tuple search during apply after concurrent index DDL. @ 2026-09-28 11:24 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Amit Kapila @ 2026-09-28 11:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix tuple search during apply after concurrent index DDL. When searching the local relation by index, the apply worker can use the first match only if the index is the relation's replica identity or primary key. Otherwise, every match must be compared with the search slot. Only the index OID was saved in the relation map, so this was determined again during the search. Concurrent DROP INDEX or REINDEX can change the index status between these two checks, causing the tuple search to fail and the change to be silently skipped as an update_missing conflict. Fix this by recording the answer as idxisreplident in the relation map entry and avoid getting it second time in FindReplTupleInLocalRel() and RelationFindReplTupleByIndex(). Oversight in 89e46da5e5. Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com> Author: vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com> Discussion: https://postgr.es/m/CADzfLwUJovFcnknCC9wjZKECX9xecgnGzC2r2TMV8h4QDD_jwQ@mail.gmail.com Backpatch-through: 16, where it was introduced Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/ad36e3608c8cb6f0848737ec81e548d4d3a0af3c Modified Files -------------- src/backend/executor/execReplication.c | 18 +-- src/backend/replication/logical/conflict.c | 4 + src/backend/replication/logical/relation.c | 18 ++- src/backend/replication/logical/worker.c | 94 +++++++++------ src/include/executor/executor.h | 2 + src/include/replication/logicalrelation.h | 4 + src/test/subscription/t/032_subscribe_use_index.pl | 127 +++++++++++++++++++++ 7 files changed, 217 insertions(+), 50 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix tuple search during apply after concurrent index DDL. @ 2026-09-28 11:24 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Amit Kapila @ 2026-09-28 11:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix tuple search during apply after concurrent index DDL. When searching the local relation by index, the apply worker can use the first match only if the index is the relation's replica identity or primary key. Otherwise, every match must be compared with the search slot. Only the index OID was saved in the relation map, so this was determined again during the search. Concurrent DROP INDEX or REINDEX can change the index status between these two checks, causing the tuple search to fail and the change to be silently skipped as an update_missing conflict. Fix this by recording the answer as idxisreplident in the relation map entry and avoid getting it second time in FindReplTupleInLocalRel() and RelationFindReplTupleByIndex(). Oversight in 89e46da5e5. Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com> Author: vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com> Discussion: https://postgr.es/m/CADzfLwUJovFcnknCC9wjZKECX9xecgnGzC2r2TMV8h4QDD_jwQ@mail.gmail.com Backpatch-through: 16, where it was introduced Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2f7bf51b7b0866cfacfd8b483351412d27cdb1e1 Modified Files -------------- src/backend/executor/execReplication.c | 18 +-- src/backend/replication/logical/conflict.c | 4 + src/backend/replication/logical/relation.c | 18 ++- src/backend/replication/logical/worker.c | 94 +++++++++------ src/include/executor/executor.h | 2 + src/include/replication/logicalrelation.h | 4 + src/test/subscription/t/032_subscribe_use_index.pl | 127 +++++++++++++++++++++ 7 files changed, 217 insertions(+), 50 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix tuple search during apply after concurrent index DDL. @ 2026-09-28 11:24 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Amit Kapila @ 2026-09-28 11:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix tuple search during apply after concurrent index DDL. When searching the local relation by index, the apply worker can use the first match only if the index is the relation's replica identity or primary key. Otherwise, every match must be compared with the search slot. Only the index OID was saved in the relation map, so this was determined again during the search. Concurrent DROP INDEX or REINDEX can change the index status between these two checks, causing the tuple search to fail and the change to be silently skipped as an update_missing conflict. Fix this by recording the answer as idxisreplident in the relation map entry and avoid getting it second time in FindReplTupleInLocalRel() and RelationFindReplTupleByIndex(). Oversight in 89e46da5e5. Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com> Author: vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com> Discussion: https://postgr.es/m/CADzfLwUJovFcnknCC9wjZKECX9xecgnGzC2r2TMV8h4QDD_jwQ@mail.gmail.com Backpatch-through: 16, where it was introduced Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/af48a67026145bd02fa953524fcdb0d84c1d9de6 Modified Files -------------- src/backend/executor/execReplication.c | 37 ++++-- src/backend/replication/logical/conflict.c | 4 + src/backend/replication/logical/relation.c | 18 ++- src/backend/replication/logical/worker.c | 85 ++++++++------ src/include/executor/executor.h | 5 + src/include/replication/logicalrelation.h | 4 + src/test/subscription/Makefile | 4 +- src/test/subscription/meson.build | 5 +- src/test/subscription/t/032_subscribe_use_index.pl | 127 +++++++++++++++++++++ 9 files changed, 239 insertions(+), 50 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix tuple search during apply after concurrent index DDL. @ 2026-09-28 11:24 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Amit Kapila @ 2026-09-28 11:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix tuple search during apply after concurrent index DDL. When searching the local relation by index, the apply worker can use the first match only if the index is the relation's replica identity or primary key. Otherwise, every match must be compared with the search slot. Only the index OID was saved in the relation map, so this was determined again during the search. Concurrent DROP INDEX or REINDEX can change the index status between these two checks, causing the tuple search to fail and the change to be silently skipped as an update_missing conflict. Fix this by recording the answer as idxisreplident in the relation map entry and avoid getting it second time in FindReplTupleInLocalRel() and RelationFindReplTupleByIndex(). Oversight in 89e46da5e5. Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com> Author: vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com> Discussion: https://postgr.es/m/CADzfLwUJovFcnknCC9wjZKECX9xecgnGzC2r2TMV8h4QDD_jwQ@mail.gmail.com Backpatch-through: 16, where it was introduced Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0405dcf7c6b1162dd1e4377d1862aa0a38629e6b Modified Files -------------- src/backend/executor/execReplication.c | 37 ++++-- src/backend/replication/logical/relation.c | 18 ++- src/backend/replication/logical/worker.c | 87 ++++++++------ src/include/executor/executor.h | 5 + src/include/replication/logicalrelation.h | 4 + src/test/subscription/Makefile | 4 +- src/test/subscription/meson.build | 5 +- src/test/subscription/t/032_subscribe_use_index.pl | 125 +++++++++++++++++++++ 8 files changed, 234 insertions(+), 51 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix tuple search during apply after concurrent index DDL. @ 2026-09-28 11:24 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Amit Kapila @ 2026-09-28 11:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix tuple search during apply after concurrent index DDL. When searching the local relation by index, the apply worker can use the first match only if the index is the relation's replica identity or primary key. Otherwise, every match must be compared with the search slot. Only the index OID was saved in the relation map, so this was determined again during the search. Concurrent DROP INDEX or REINDEX can change the index status between these two checks, causing the tuple search to fail and the change to be silently skipped as an update_missing conflict. Fix this by recording the answer as idxisreplident in the relation map entry and avoid getting it second time in FindReplTupleInLocalRel() and RelationFindReplTupleByIndex(). Oversight in 89e46da5e5. Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com> Author: vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com> Discussion: https://postgr.es/m/CADzfLwUJovFcnknCC9wjZKECX9xecgnGzC2r2TMV8h4QDD_jwQ@mail.gmail.com Backpatch-through: 16, where it was introduced Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2389f898eea60b445191b1bcaafada29781ab9dc Modified Files -------------- src/backend/executor/execReplication.c | 37 ++++++++++--- src/backend/replication/logical/relation.c | 18 +++++-- src/backend/replication/logical/worker.c | 83 +++++++++++++++++------------- src/include/executor/executor.h | 5 ++ src/include/replication/logicalrelation.h | 4 ++ 5 files changed, 98 insertions(+), 49 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-09-28 11:24 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-09-28 11:24 pgsql: Fix tuple search during apply after concurrent index DDL. Amit Kapila <akapila@postgresql.org> 2026-09-28 11:24 pgsql: Fix tuple search during apply after concurrent index DDL. Amit Kapila <akapila@postgresql.org> 2026-09-28 11:24 pgsql: Fix tuple search during apply after concurrent index DDL. Amit Kapila <akapila@postgresql.org> 2026-09-28 11:24 pgsql: Fix tuple search during apply after concurrent index DDL. Amit Kapila <akapila@postgresql.org> 2026-09-28 11:24 pgsql: Fix tuple search during apply after concurrent index DDL. Amit Kapila <akapila@postgresql.org>
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