pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Add isolation test for TOAST value reuse during CLUSTER
2+ messages / 1 participants
[nested] [flat]
Commits from this thread:
2025-08-17 97ca67377a Remove md5() call from isolation test for CLUSTER and TOAST
* pgsql: Add isolation test for TOAST value reuse during CLUSTER
@ 2025-08-17 06:27 Michael Paquier <michael@paquier.xyz>
2025-08-17 23:15 ` Re: pgsql: Add isolation test for TOAST value reuse during CLUSTER Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 2+ messages in thread
From: Michael Paquier @ 2025-08-17 06:27 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Add isolation test for TOAST value reuse during CLUSTER
This test exercises the corner case in toast_save_datum() where CLUSTER
operations encounter duplicated TOAST references, reusing the existing
TOAST data instead of creating redundant copies.
During table rewrites like CLUSTER, both live and recently-dead versions
of a row may reference the same TOAST value. When copying the second or
later version of such a row, the system checks if a TOAST value already
exists in the new TOAST table using toastrel_valueid_exists(). If
found, toast_save_datum() sets data_todo = 0 so as redundant data is not
stored, ensuring only one copy of the TOAST value exists in the new
table.
The test relies on a combination of UPDATE, CLUSTER, and checks of the
TOAST values used before and after the relation rewrite, to make sure
that the same values are reused across the rewrite.
This is a continuation of 69f75d671475 to make sure that this corner
case keeps working should we mess with this area of the code.
Author: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
Discussion: https://postgr.es/m/CAFAfj_E+kw5P713S8_jZyVgQAGVFfzFiTUJPrgo-TTtJJoazQw@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f57e214d1cbb748b1e9be79e1b30d85fcbc9e340
Modified Files
--------------
.../expected/cluster-toast-value-reuse.out | 29 +++++++++
src/test/isolation/isolation_schedule | 1 +
.../isolation/specs/cluster-toast-value-reuse.spec | 69 ++++++++++++++++++++++
3 files changed, 99 insertions(+)
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: pgsql: Add isolation test for TOAST value reuse during CLUSTER
2025-08-17 06:27 pgsql: Add isolation test for TOAST value reuse during CLUSTER Michael Paquier <michael@paquier.xyz>
@ 2025-08-17 23:15 ` Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 2+ messages in thread
From: Michael Paquier @ 2025-08-17 23:15 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
On Sun, Aug 17, 2025 at 06:27:57AM +0000, Michael Paquier wrote:
> Add isolation test for TOAST value reuse during CLUSTER
A couple of buildfarm members have been complaining about this test
using md5(). Will fix in a bit.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-08-17 23:15 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-08-17 06:27 pgsql: Add isolation test for TOAST value reuse during CLUSTER Michael Paquier <michael@paquier.xyz>
2025-08-17 23:15 ` 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