pgsql: Use the relation map's index when searching deleted tuples seque - Mailing list pgsql-committers

From Amit Kapila
Subject pgsql: Use the relation map's index when searching deleted tuples seque
Date
Msg-id E1xCaW0-000000000N4-0cXc@gemulon.postgresql.org
Whole thread
List pgsql-committers
Use the relation map's index when searching deleted tuples sequentially.

When the index cannot be used to find a recently deleted row,
RelationFindDeletedTupleInfoSeq() scans the table. It looked up the
relation's replica identity or primary key again to determine which
columns to compare, which could differ from the index selected when the
relation was opened. A concurrent DROP INDEX CONCURRENTLY could remove the
replica identity in between, so the search compared the whole row and
reported the conflict as update_deleted instead of update_missing.

Use the index recorded in the relation map instead. The relation map
already records the replica identity index, or the primary key if there is
no replica identity. It also avoids using a deferrable primary key, which
cannot serve as a replica identity; using its columns could incorrectly
report a deleted row with different values as update_deleted instead of
update_missing.

Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Author: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Zhijie Hou <houzhijie22@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CABdArM5ydwdRrpaZyK1q2p3-vY_+pnBtTmkvg_pcM=gHwmH7Kg@mail.gmail.com
Discussion: https://postgr.es/m/OS7PR01MB1831779ED93F5470CA1D57605F58C2@OS7PR01MB18317.jpnprd01.prod.outlook.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a72542b7937a846654d9bcb5855bd8c5725a85b5

Modified Files
--------------
src/backend/executor/execReplication.c   | 49 +++++++++++++++++--------
src/backend/replication/logical/worker.c |  9 +++--
src/include/executor/executor.h          |  2 +-
src/test/subscription/t/035_conflicts.pl | 63 ++++++++++++++++++++++++++++++++
4 files changed, 104 insertions(+), 19 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: pgindent: Keep the alignas() placeholder the same width
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Write pg_attribute_counted_by() in front of the type