• Simon Riggs's avatar
    Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases · 3e4b7d87
    Simon Riggs authored
    Replay of XLOG_BTREE_VACUUM during Hot Standby was previously thought to require
    complex interlocking that matched the requirements on the master. This required
    an O(N) operation that became a significant problem with large indexes, causing
    replication delays of seconds or in some cases minutes while the
    XLOG_BTREE_VACUUM was replayed.
    
    This commit skips the pin scan that was previously required, by observing in
    detail when and how it is safe to do so, with full documentation. The pin
    scan is skipped only in replay; the VACUUM code path on master is not
    touched here and WAL is identical.
    
    The current commit applies in all cases, effectively replacing commit
    687f2cd7.
    3e4b7d87
nbtxlog.c 30.5 KB