pgsql: Add test to prevent premature removal of conflict-relevant data.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add test to prevent premature removal of conflict-relevant data.
Date: 2025-09-08 12:06:49
Message-ID: E1uvae1-0016or-2v@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add test to prevent premature removal of conflict-relevant data.

A test has been added to ensure that conflict-relevant data is not
prematurely removed when a concurrent prepared transaction is being
committed on the publisher.

This test introduces an injection point that simulates the presence of a
prepared transaction in the commit phase, validating that the system
correctly delays conflict slot advancement until the transaction is fully
committed.

Additionally, the test serves as a safeguard for developers, ensuring that
the acquisition of the commit timestamp does not occur before marking
DELAY_CHKPT_IN_COMMIT in RecordTransactionCommitPrepared.

Reported-by: Robert Haas <robertmhaas(at)gmail(dot)com>
Author: Zhijie Hou <houzj(dot)fnst(at)fujitsu(dot)com>
Reviewed-by: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Discussion: https://postgr.es/m/OS9PR01MB16913F67856B0DA2A909788129400A@OS9PR01MB16913.jpnprd01.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6456c6e2c4ad1cf9752e09cce37bfcfe2190c5e0

Modified Files
--------------
src/backend/access/transam/twophase.c | 6 ++
src/test/subscription/Makefile | 4 +-
src/test/subscription/meson.build | 5 +-
src/test/subscription/t/035_conflicts.pl | 160 +++++++++++++++++++++++++++++++
4 files changed, 173 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Melanie Plageman 2025-09-08 14:29:53 pgsql: Remove unneeded VM pin from VM replay
Previous Message Michael Paquier 2025-09-08 06:53:25 pgsql: Fix corruption of pgstats shared hashtable due to OOM failures