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