pgsql: Set HEAP_XMAX_INVALID for tuples updated by aborted subtransacti
pgsql: Set HEAP_XMAX_INVALID for tuples updated by aborted subtransacti
От:
Michael Paquier <michael@paquier.xyz>
Дата:
Set HEAP_XMAX_INVALID for tuples updated by aborted subtransaction HeapTupleSatisfiesVacuumHorizon() did not set HEAP_XMAX_INVALID on a tuple inserted, then updated by a subtransaction that rolled back. rewriteheap.c relies on this hint to tell if such tuples should be treated as updated and would drop them, causing rewrites to lose some tuples. HeapTupleSatisfiesVacuumHorizon() is updated to set the hint HEAP_XMAX_INVALID, so as heap AM is able to redirect such a tuple to its correct route, and does not lose it. This issue impacted both CLUSTER (down to v14) and REPACK [USING] (down to v19). Reported-by: Alperen Keles Author: Shihao Zhong Author: Michael Paquier Reported-by: Zhijie Hou Reported-by: Takeshi Ideriha Reported-by: Ayush Tiwari Discussion: https://postgr.es/m/19760-8f9a0eba17bc8c92@postgresql.org Backpatch-through: 14 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0b565674945c2b08d131f2d821400ed11181ac37 Modified Files -------------- src/backend/access/heap/heapam_visibility.c | 2 ++ src/test/regress/expected/cluster.out | 28 ++++++++++++++++++++++++++++ src/test/regress/sql/cluster.sql | 19 +++++++++++++++++++ 3 files changed, 49 insertions(+)