postgresql/src/backend
Alvaro Herrera f65b94f639 Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases
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.

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.

This is a back-patch of commits 687f2cd7a0, 3e4b7d8798, b602842613
by Simon Riggs, to branches 9.4 and 9.5.  No further backpatch is
possible because this depends on catalog scans being MVCC.  I (Álvaro)
additionally updated a slight problem in the README, which explains why
this touches the 9.6 and master branches.
2016-11-17 13:31:30 -03:00
..
access Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases 2016-11-17 13:31:30 -03:00
bootstrap Fix a bunch of places that called malloc and friends with no NULL check. 2016-08-30 18:22:43 -04:00
catalog Fix another bug in merging of inherited CHECK constraints. 2016-10-13 17:05:14 -04:00
commands Support "COPY view FROM" for views with INSTEAD OF INSERT triggers. 2016-11-10 14:13:43 -05:00
executor Simplify code by getting rid of SPI_push, SPI_pop, SPI_restore_connection. 2016-11-08 17:39:57 -05:00
foreign Remove GetUserMappingId() and GetUserMappingById(). 2016-07-22 11:32:23 -04:00
lib Clarify the new Red-Black post-order traversal code a bit. 2016-09-04 15:02:06 +03:00
libpq Consistently mention 'SELECT pg_reload_conf()' in config files 2016-10-25 11:26:15 -04:00
main Repair a bit of pgindent damage. 2016-06-09 18:09:17 -04:00
nodes Implement syntax for transition tables in AFTER triggers. 2016-11-04 10:49:50 -05:00
optimizer Cleanup of rewriter and planner handling of Query.hasRowSecurity flag. 2016-11-10 16:16:33 -05:00
parser Implement syntax for transition tables in AFTER triggers. 2016-11-04 10:49:50 -05:00
po Translation updates 2016-08-08 11:08:00 -04:00
port Try to find out the actual hugepage size when making a MAP_HUGETLB request. 2016-10-13 15:06:46 -04:00
postmaster If the stats collector dies during Hot Standby, restart it. 2016-10-27 14:27:40 -04:00
regex Make locale-dependent regex character classes work for large char codes. 2016-09-05 17:06:29 -04:00
replication Fix typos in comments. 2016-10-26 11:12:31 +03:00
rewrite Cleanup of rewriter and planner handling of Query.hasRowSecurity flag. 2016-11-10 16:16:33 -05:00
snowball Update copyright for 2016 2016-01-02 13:33:40 -05:00
storage Reserve zero as an invalid DSM handle. 2016-11-15 16:33:29 -05:00
tcop Account for catalog snapshot in PGXACT->xmin updates. 2016-11-15 15:55:35 -05:00
tsearch Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
utils Account for catalog snapshot in PGXACT->xmin updates. 2016-11-15 15:55:35 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Refer to OS X as "macOS", except for the port name which is still "darwin". 2016-09-25 15:40:57 -04:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
nls.mk Remove trailing slashes from directories in find command 2015-09-18 22:06:54 -04:00