pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases
Date: 2016-04-03 16:47:50
Message-ID: E1amlBm-0005hb-Fz@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 and WAL is identical.

The current commit applies in all cases, effectively replacing commit
687f2cd7a0150647794efe432ae0397cb41b60ff.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3e4b7d87988f0835f137f15f5c1a40598dd21f3d

Modified Files
--------------
src/backend/access/nbtree/README | 15 ++++++---------
src/backend/access/nbtree/nbtree.c | 32 +++++++++-----------------------
src/backend/access/nbtree/nbtxlog.c | 11 ++++++++---
3 files changed, 23 insertions(+), 35 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-04-03 18:17:33 pgsql: Clean up some stuff in new contrib/bloom module.
Previous Message Tom Lane 2016-04-03 16:30:04 pgsql: Add libpq support for recreating an error message with different