_bt_delitems_delete() should use XLogRegisterBufData(), not XLogRegisterData() - Mailing list pgsql-hackers

From Peter Geoghegan
Subject _bt_delitems_delete() should use XLogRegisterBufData(), not XLogRegisterData()
Date
Msg-id CAH2-Wzkz4TjmezzfAbaV1zYrh=fr0bCpzuJTvBe5iUQ3aUPsCQ@mail.gmail.com
Whole thread Raw
Responses Re: _bt_delitems_delete() should use XLogRegisterBufData(), not XLogRegisterData()  (Peter Geoghegan <pg@bowt.ie>)
List 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

pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: backup manifests
Next
From: Vik Fearing
Date:
Subject: Re: WIP: System Versioned Temporal Table