diff options
author | Michael Paquier <michael@paquier.xyz> | 2025-08-17 15:20:01 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2025-08-17 15:20:01 +0900 |
commit | f57e214d1cbb748b1e9be79e1b30d85fcbc9e340 (patch) | |
tree | 66dbf231124e2e50779526cfec2ac0cb706eab38 /src/backend/utils/misc/database.c | |
parent | 928da6ff1254f471941e43f9ad258cc6b1f037e4 (diff) |
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
Diffstat (limited to 'src/backend/utils/misc/database.c')
0 files changed, 0 insertions, 0 deletions