pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM
14+ messages / 4 participants
[nested] [flat]

* pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM
@ 2016-01-09 10:13 Simon Riggs <simon@2ndQuadrant.com>
  2016-01-09 12:23 ` Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Andres Freund <andres@anarazel.de>
  2016-01-10 16:32 ` Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Robert Haas <robertmhaas@gmail.com>
  0 siblings, 2 replies; 14+ messages in thread

From: Simon Riggs @ 2016-01-09 10:13 UTC (permalink / raw)
  To: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/687f2cd7a0150647794efe432ae0397cb41b60ff

Modified Files
--------------
src/backend/access/nbtree/README      |   24 ++++++++++++++++++++++++
src/backend/access/nbtree/nbtree.c    |   23 ++++++++++++++++++++++-
src/backend/access/nbtree/nbtxlog.c   |   18 ++++++++++++++++--
src/backend/access/rmgrdesc/nbtdesc.c |    2 +-
src/include/access/nbtree.h           |    6 ++++--
5 files changed, 67 insertions(+), 6 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM
  2016-01-09 10:13 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
@ 2016-01-09 12:23 ` Andres Freund <andres@anarazel.de>
  2016-01-09 17:58   ` Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  1 sibling, 1 reply; 14+ messages in thread

From: Andres Freund @ 2016-01-09 12:23 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndQuadrant.com>; +Cc: pgsql-committers

Hi,

On 2016-01-09 10:13:27 +0000, Simon Riggs wrote:
> src/backend/access/rmgrdesc/nbtdesc.c |    2 +-

I've not reviewed the patch, but a very quick glance during a rebase
with conflicts showed:

@@ -48,7 +48,7 @@ btree_desc(StringInfo buf, XLogReaderState *record)
            {
                xl_btree_vacuum *xlrec = (xl_btree_vacuum *) rec;
 
-               appendStringInfo(buf, "lastBlockVacuumed %u",
+               appendStringInfo(buf, "lastBlockVacuumed %d",
                                 xlrec->lastBlockVacuumed);
                break;
            }

which doesn't look right?



-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM
  2016-01-09 10:13 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  2016-01-09 12:23 ` Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Andres Freund <andres@anarazel.de>
@ 2016-01-09 17:58   ` Simon Riggs <simon@2ndQuadrant.com>
  2016-01-09 18:08     ` Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 14+ messages in thread

From: Simon Riggs @ 2016-01-09 17:58 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Simon Riggs <simon@2ndquadrant.com>; pgsql-committers

On 9 January 2016 at 12:23, Andres Freund <andres@anarazel.de> wrote:

> Hi,
>
> On 2016-01-09 10:13:27 +0000, Simon Riggs wrote:
> > src/backend/access/rmgrdesc/nbtdesc.c |    2 +-
>
> I've not reviewed the patch, but a very quick glance during a rebase
> with conflicts showed:
>
> @@ -48,7 +48,7 @@ btree_desc(StringInfo buf, XLogReaderState *record)
>             {
>                 xl_btree_vacuum *xlrec = (xl_btree_vacuum *) rec;
>
> -               appendStringInfo(buf, "lastBlockVacuumed %u",
> +               appendStringInfo(buf, "lastBlockVacuumed %d",
>                                  xlrec->lastBlockVacuumed);
>                 break;
>             }
>
> which doesn't look right?
>

It's right. New value of -1 allowed in that field, so change required to
allow it to display properly for debug.

-- 
Simon Riggs                http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/;
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM
  2016-01-09 10:13 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  2016-01-09 12:23 ` Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Andres Freund <andres@anarazel.de>
  2016-01-09 17:58   ` Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
@ 2016-01-09 18:08     ` Andres Freund <andres@anarazel.de>
  2016-01-09 18:27       ` Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 1 reply; 14+ messages in thread

From: Andres Freund @ 2016-01-09 18:08 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndQuadrant.com>; +Cc: pgsql-committers

On 2016-01-09 17:58:01 +0000, Simon Riggs wrote:
> On 9 January 2016 at 12:23, Andres Freund <andres@anarazel.de> wrote:
> 
> > Hi,
> >
> > On 2016-01-09 10:13:27 +0000, Simon Riggs wrote:
> > > src/backend/access/rmgrdesc/nbtdesc.c |    2 +-
> >
> > I've not reviewed the patch, but a very quick glance during a rebase
> > with conflicts showed:
> >
> > @@ -48,7 +48,7 @@ btree_desc(StringInfo buf, XLogReaderState *record)
> >             {
> >                 xl_btree_vacuum *xlrec = (xl_btree_vacuum *) rec;
> >
> > -               appendStringInfo(buf, "lastBlockVacuumed %u",
> > +               appendStringInfo(buf, "lastBlockVacuumed %d",
> >                                  xlrec->lastBlockVacuumed);
> >                 break;
> >             }
> >
> > which doesn't look right?
> >
> 
> It's right. New value of -1 allowed in that field, so change required to
> allow it to display properly for debug.

Uh. xl_btree_vacuum->lastBlockVacuumed is of type BlockNumber, which in
turn is of type uint32. So no, this isn't correct as is.


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM
  2016-01-09 10:13 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  2016-01-09 12:23 ` Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Andres Freund <andres@anarazel.de>
  2016-01-09 17:58   ` Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  2016-01-09 18:08     ` Re: pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Andres Freund <andres@anarazel.de>
@ 2016-01-09 18:27       ` Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 0 replies; 14+ messages in thread

From: Simon Riggs @ 2016-01-09 18:27 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Simon Riggs <simon@2ndquadrant.com>; pgsql-committers

On 9 January 2016 at 18:08, Andres Freund <andres@anarazel.de> wrote:

> On 2016-01-09 17:58:01 +0000, Simon Riggs wrote:
> > On 9 January 2016 at 12:23, Andres Freund <andres@anarazel.de> wrote:
> >
> > > Hi,
> > >
> > > On 2016-01-09 10:13:27 +0000, Simon Riggs wrote:
> > > > src/backend/access/rmgrdesc/nbtdesc.c |    2 +-
> > >
> > > I've not reviewed the patch, but a very quick glance during a rebase
> > > with conflicts showed:
> > >
> > > @@ -48,7 +48,7 @@ btree_desc(StringInfo buf, XLogReaderState *record)
> > >             {
> > >                 xl_btree_vacuum *xlrec = (xl_btree_vacuum *) rec;
> > >
> > > -               appendStringInfo(buf, "lastBlockVacuumed %u",
> > > +               appendStringInfo(buf, "lastBlockVacuumed %d",
> > >                                  xlrec->lastBlockVacuumed);
> > >                 break;
> > >             }
> > >
> > > which doesn't look right?
> > >
> >
> > It's right. New value of -1 allowed in that field, so change required to
> > allow it to display properly for debug.
>
> Uh. xl_btree_vacuum->lastBlockVacuumed is of type BlockNumber, which in
> turn is of type uint32. So no, this isn't correct as is.
>

OK, agreed. Will fix.

-- 
Simon Riggs                http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/;
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM
  2016-01-09 10:13 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
@ 2016-01-10 16:32 ` Robert Haas <robertmhaas@gmail.com>
  2016-01-10 20:50   ` Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  1 sibling, 1 reply; 14+ messages in thread

From: Robert Haas @ 2016-01-10 16:32 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndquadrant.com>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Sat, Jan 9, 2016 at 5:13 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> 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.

I suspect I might be missing something here, but I don't see how a
test against rel->rd_rel->relnamespace can work during recovery.
Won't the relcache entry we're looking at here be one created by
CreateFakeRelcacheEntry(), and thus that field won't be valid?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM
  2016-01-09 10:13 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  2016-01-10 16:32 ` Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Robert Haas <robertmhaas@gmail.com>
@ 2016-01-10 20:50   ` Simon Riggs <simon@2ndQuadrant.com>
  2016-01-11 01:46     ` Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 14+ messages in thread

From: Simon Riggs @ 2016-01-10 20:50 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Simon Riggs <simon@2ndquadrant.com>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On 10 January 2016 at 16:32, Robert Haas <robertmhaas@gmail.com> wrote:

> On Sat, Jan 9, 2016 at 5:13 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> > 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.
>
> I suspect I might be missing something here, but I don't see how a
> test against rel->rd_rel->relnamespace can work during recovery.
> Won't the relcache entry we're looking at here be one created by
> CreateFakeRelcacheEntry(), and thus that field won't be valid?
>

The test isn't made during recovery, its made on the master.

-- 
Simon Riggs                http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/;
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM
  2016-01-09 10:13 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  2016-01-10 16:32 ` Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Robert Haas <robertmhaas@gmail.com>
  2016-01-10 20:50   ` Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
@ 2016-01-11 01:46     ` Robert Haas <robertmhaas@gmail.com>
  2016-01-11 08:14       ` Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 1 reply; 14+ messages in thread

From: Robert Haas @ 2016-01-11 01:46 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndquadrant.com>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Sun, Jan 10, 2016 at 3:50 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
> On 10 January 2016 at 16:32, Robert Haas <robertmhaas@gmail.com> wrote:
>>
>> On Sat, Jan 9, 2016 at 5:13 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
>> > 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.
>>
>> I suspect I might be missing something here, but I don't see how a
>> test against rel->rd_rel->relnamespace can work during recovery.
>> Won't the relcache entry we're looking at here be one created by
>> CreateFakeRelcacheEntry(), and thus that field won't be valid?
>
> The test isn't made during recovery, its made on the master.

/me crawls into a hole.

Thanks.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM
  2016-01-09 10:13 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  2016-01-10 16:32 ` Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Robert Haas <robertmhaas@gmail.com>
  2016-01-10 20:50   ` Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
  2016-01-11 01:46     ` Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Robert Haas <robertmhaas@gmail.com>
@ 2016-01-11 08:14       ` Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 0 replies; 14+ messages in thread

From: Simon Riggs @ 2016-01-11 08:14 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Simon Riggs <simon@2ndquadrant.com>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On 11 January 2016 at 01:46, Robert Haas <robertmhaas@gmail.com> wrote:


> /me crawls into a hole.
>
> Thanks.


Far from it, thanks very much for thinking about it.

-- 
Simon Riggs                http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/;
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases
@ 2016-04-03 16:47 Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 0 replies; 14+ messages in thread

From: Simon Riggs @ 2016-04-03 16:47 UTC (permalink / raw)
  To: 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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases
@ 2016-11-17 16:32 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 14+ messages in thread

From: Alvaro Herrera @ 2016-11-17 16:32 UTC (permalink / raw)
  To: 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
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/f65b94f63962e9f7e144a469bc1750286ddaee27

Modified Files
--------------
src/backend/access/nbtree/README | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases
@ 2016-11-17 16:32 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 14+ messages in thread

From: Alvaro Herrera @ 2016-11-17 16:32 UTC (permalink / raw)
  To: 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_6_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f5d89443203480e39a6a15e64f1950c3b4d3c9a2

Modified Files
--------------
src/backend/access/nbtree/README | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases
@ 2016-11-17 16:32 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 14+ messages in thread

From: Alvaro Herrera @ 2016-11-17 16:32 UTC (permalink / raw)
  To: 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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases
@ 2016-11-17 16:32 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 14+ messages in thread

From: Alvaro Herrera @ 2016-11-17 16:32 UTC (permalink / raw)
  To: 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_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/30e3cb307d494990cb38cebff6bfc8b4ce27d7ab

Modified Files
--------------
src/backend/access/nbtree/README    | 22 ++++++++++++++++++++++
src/backend/access/nbtree/nbtree.c  | 15 +++++++++++----
src/backend/access/nbtree/nbtxlog.c | 23 +++++++++++++++++++++--
src/include/access/nbtree.h         |  6 ++++--
4 files changed, 58 insertions(+), 8 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 14+ messages in thread


end of thread, other threads:[~2016-11-17 16:32 UTC | newest]

Thread overview: 14+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-09 10:13 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM Simon Riggs <simon@2ndQuadrant.com>
2016-01-09 12:23 ` Andres Freund <andres@anarazel.de>
2016-01-09 17:58   ` Simon Riggs <simon@2ndQuadrant.com>
2016-01-09 18:08     ` Andres Freund <andres@anarazel.de>
2016-01-09 18:27       ` Simon Riggs <simon@2ndQuadrant.com>
2016-01-10 16:32 ` Robert Haas <robertmhaas@gmail.com>
2016-01-10 20:50   ` Simon Riggs <simon@2ndQuadrant.com>
2016-01-11 01:46     ` Robert Haas <robertmhaas@gmail.com>
2016-01-11 08:14       ` Simon Riggs <simon@2ndQuadrant.com>
2016-04-03 16:47 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases Simon Riggs <simon@2ndQuadrant.com>
2016-11-17 16:32 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases Alvaro Herrera <alvherre@alvh.no-ip.org>
2016-11-17 16:32 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases Alvaro Herrera <alvherre@alvh.no-ip.org>
2016-11-17 16:32 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases Alvaro Herrera <alvherre@alvh.no-ip.org>
2016-11-17 16:32 pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM in all cases Alvaro Herrera <alvherre@alvh.no-ip.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox