• Andres Freund's avatar
    Improve representation of 'moved partitions' indicator on deleted tuples. · 1667148a
    Andres Freund authored
    Previously a tuple that has been moved to a different partition (see
    f16241be), 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 f16241be...
    
    Reported-By: Peter Geoghegan
    Author: Heikki Linnakangas, Amul Sul
    Discussion: https://postgr.es/m/CAH2-Wzm9ty+1BX7-GMNJ=xPRg67oJTVeDNdA9LSyJJtMgRiCMA@mail.gmail.com
    1667148a
htup_details.h 29.5 KB