| From: | Amit Kapila <akapila(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Use the relation map's index when searching deleted tuples seque |
| Date: | 2026-10-02 10:29:20 |
| Message-ID: | E1xCaW0-000000000N2-0UMy@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(dot)hayato(at)fujitsu(dot)com>
Author: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
Reviewed-by: Vignesh C <vignesh21(at)gmail(dot)com>
Reviewed-by: Zhijie Hou <houzhijie22(at)gmail(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)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
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5a5e3b88dead9cbea2352283addd927a32dc4d4b
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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-10-02 11:16:06 | pgsql: Write pg_attribute_counted_by() in front of the type |
| Previous Message | Peter Eisentraut | 2026-10-02 08:16:37 | pgsql: pgindent: Keep the alignas() placeholder the same width |