pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add xl_btree_delete optimization.
Date: Fri, 03 Jan 2020 20:19:44 +0000
Message-ID: <E1inTQ8-0005cq-Ld@gemulon.postgresql.org> (raw)

Add xl_btree_delete optimization.

Commit 558a9165e08 taught _bt_delitems_delete() to produce its own XID
horizon on the primary.  Standbys no longer needed to generate their own
latestRemovedXid, since they could just use the explicitly logged value
from the primary instead.  The deleted offset numbers array from the
xl_btree_delete WAL record was no longer used by the REDO routine for
anything other than deleting the items.

This enables a minor optimization:  We now treat the array as buffer
state, not generic WAL data, following _bt_delitems_vacuum()'s example.
This should be a minor win, since it allows us to avoid including the
deleted items array in cases where XLogInsert() stores the whole buffer
anyway.  The primary goal here is to make the code more maintainable,
though.  Removing inessential differences between the two functions
highlights the fundamental differences that remain.

Also change xl_btree_delete to use uint32 for the size of the array of
item offsets being deleted.  This brings xl_btree_delete closer to
xl_btree_vacuum.  Furthermore, it seems like a good idea to use an
explicit-width integer type (the field was previously an "int").

Bump XLOG_PAGE_MAGIC because xl_btree_delete changed.

Discussion: https://postgr.es/m/CAH2-Wzkz4TjmezzfAbaV1zYrh=fr0bCpzuJTvBe5iUQ3aUPsCQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d2e5e20e57111cca9e14f6e5a99a186d4c66a5b7

Modified Files
--------------
src/backend/access/nbtree/nbtpage.c   | 48 +++++++++++++++--------------------
src/backend/access/nbtree/nbtxlog.c   | 11 +++-----
src/backend/access/rmgrdesc/nbtdesc.c |  4 +--
src/include/access/nbtree.h           |  3 ++-
src/include/access/nbtxlog.h          |  6 ++---
src/include/access/xlog_internal.h    |  2 +-
6 files changed, 32 insertions(+), 42 deletions(-)



Message-ID: <E1inTQ8-0005cq-Ld@gemulon.postgresql.org>
Permalink:  ../E1inTQ8-0005cq-Ld@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1inTQ8-0005cq-Ld@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: pg@bowt.ie
  Subject: Re: pgsql: Add xl_btree_delete optimization.
  In-Reply-To: <E1inTQ8-0005cq-Ld@gemulon.postgresql.org>
  References: <E1inTQ8-0005cq-Ld@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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