]> granicus.if.org Git - postgresql/commit
Improve representation of 'moved partitions' indicator on deleted tuples.
authorAndres Freund <andres@anarazel.de>
Tue, 1 May 2018 20:30:12 +0000 (13:30 -0700)
committerAndres Freund <andres@anarazel.de>
Tue, 1 May 2018 20:30:12 +0000 (13:30 -0700)
commit1667148a4dd98cea28b8b53d57dbc1eece1b0b5c
treefafd722d80402315d3ff7c281cdf9d3e39bdead3
parent37a3058bc7c8224d4c0d8b36176d821636a1f90e
Improve representation of 'moved partitions' indicator on deleted tuples.

Previously a tuple that has been moved to a different partition (see
f16241bef7c), set the block number on the old tuple to an invalid
value to indicate that fact. But the tuple offset was left
untouched. That turned out to trigger a wal_consistency_checking
failure as reported by Peter Geoghegan, as the offset wasn't
always overwritten during WAL replay.

Heikki observed that we're wasting valuable data by not putting
information also in the offset. Thus set that to
MovedPartitionsOffsetNumber when a tuple indicates it has moved.

We continue to set the block number to MovedPartitionsBlockNumber, as
that seems more likely to cause problems for code not updated to know
about moved tuples.

As t_ctid's offset number is now always set, this refinement also
fixes the wal_consistency_checking issue.

This technically is a minor disk format break, with previously created
moved tuples not being recognized anymore. But since there not even
has been a beta release since f16241bef7c...

Reported-By: Peter Geoghegan
Author: Heikki Linnakangas, Amul Sul
Discussion: https://postgr.es/m/CAH2-Wzm9ty+1BX7-GMNJ=xPRg67oJTVeDNdA9LSyJJtMgRiCMA@mail.gmail.com
src/include/access/htup_details.h
src/include/storage/itemptr.h