]> granicus.if.org Git - postgresql/commit
Avoid pin scan for replay of XLOG_BTREE_VACUUM
authorSimon Riggs <simon@2ndQuadrant.com>
Sat, 9 Jan 2016 10:10:08 +0000 (10:10 +0000)
committerSimon Riggs <simon@2ndQuadrant.com>
Sat, 9 Jan 2016 10:10:08 +0000 (10:10 +0000)
commit687f2cd7a0150647794efe432ae0397cb41b60ff
tree0d6813a68bf31028de8170da5d740a397667cd49
parent463172116634423f8708ad9d7afb0f759a40cf2c
Avoid pin scan for replay of XLOG_BTREE_VACUUM
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.

The current commit still performs the pin scan for toast indexes, though this
can also be avoided if we recheck scans on toast indexes. Later patch will
address this.

No tests included. Manual tests using an additional patch to view WAL records
and their timing have shown the change in WAL records and their handling has
successfully reduced replication delay.
src/backend/access/nbtree/README
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtxlog.c
src/backend/access/rmgrdesc/nbtdesc.c
src/include/access/nbtree.h