From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases |
Date: | 2016-11-17 16:32:47 |
Message-ID: | E1c7PcF-0007XX-Qb@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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 687f2cd7a015, 3e4b7d87988f, b60284261375
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.
Branch
------
REL9_5_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/c0db1ec2600a898ac75d14057e01fb716059a2f5
Modified Files
--------------
src/backend/access/nbtree/README | 22 ++++++++++++++++++++++
src/backend/access/nbtree/nbtree.c | 15 +++++++++++----
src/backend/access/nbtree/nbtxlog.c | 25 ++++++++++++++++++++++---
src/include/access/nbtree.h | 6 ++++--
4 files changed, 59 insertions(+), 9 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-11-17 19:37:06 | pgsql: Re-pgindent src/bin/pg_dump/* |
Previous Message | Erik Rijkers | 2016-11-17 06:53:33 | Re: Re: [COMMITTERS] pgsql: Build HTML documentation using XSLT stylesheets by default |