git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 928da6f) | patch
Add isolation test for TOAST value reuse during CLUSTER
2025年8月17日 06:20:01 +0000 (15:20 +0900)
2025年8月17日 06:20:01 +0000 (15:20 +0900)
commit f57e214d1cbb748b1e9be79e1b30d85fcbc9e340
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
src/test/isolation/expected/cluster-toast-value-reuse.out [new file with mode: 0644] blob
src/test/isolation/isolation_schedule diff | blob | blame | history
src/test/isolation/specs/cluster-toast-value-reuse.spec [new file with mode: 0644] blob
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /