_bt_delitems_delete() should use XLogRegisterBufData(), not XLogRegisterData()

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: _bt_delitems_delete() should use XLogRegisterBufData(), not XLogRegisterData()
Date: 2020-01-01 21:00:59
Message-ID: CAH2-Wzkz4TjmezzfAbaV1zYrh=fr0bCpzuJTvBe5iUQ3aUPsCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The RelationNeedsWAL() code block within _bt_delitems_delete() has had
the following comment for many years now:

/*
* We need the target-offsets array whether or not we store the whole
* buffer, to allow us to find the latestRemovedXid on a standby
* server.
*/
XLogRegisterData((char *) itemnos, nitems * sizeof(OffsetNumber));

However, we don't actually need to do it that way these days. We won't
go on to determine a latestRemovedXid on a standby as of commit
558a9165e08 (that happens on the primary instead), so the comment
seems wrong.

Rather than just changing the comment, I propose that we tweak the
behavior of _bt_delitems_delete() to match its sibling function
_bt_delitems_vacuum(). That is, it should use XLogRegisterBufData(),
not XLogRegisterData(). This is cleaner, and ought to be a minor win.

Attached patch shows what I have in mind. The new comment block has
been copied from _bt_delitems_vacuum().

--
Peter Geoghegan

Attachment Content-Type Size
0001-Associate-LP_DEAD-offsets-with-WAL-record-s-buffer.patch application/x-patch 2.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2020-01-01 21:12:09 Re: WIP: System Versioned Temporal Table
Previous Message David Fetter 2020-01-01 19:09:18 Re: backup manifests