diff options
author | Robert Haas <rhaas@postgresql.org> | 2021-11-05 12:43:04 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2021-11-05 12:43:04 -0400 |
commit | caf1f675b88d1aa67ea3fb642e8f38b470cc911e (patch) | |
tree | fda9433cd4ab26c088a50ba31e83747f9620adb0 /src/backend/replication/logical/logicalfuncs.c | |
parent | d74b54b3ddf710926a44bf3f9c87c00e6f82d825 (diff) | |
download | postgresql-caf1f675b88d1aa67ea3fb642e8f38b470cc911e.tar.gz postgresql-caf1f675b88d1aa67ea3fb642e8f38b470cc911e.zip |
Don't set ThisTimeLineID when there's no reason to do so.
In slotfuncs.c, pg_replication_slot_advance() needs to determine
the LSN up to which the slot should be advanced, but that doesn't
require us to update ThisTimeLineID, because none of the code called
from here depends on it. If the replication slot is logical,
pg_logical_replication_slot_advance will call read_local_xlog_page,
which does use ThisTimeLineID, but also takes care of making sure
it's up to date. If the replication slot is physical, the timeline
isn't used for anything at all.
In logicalfuncs.c, pg_logical_slot_get_changes_guts() has the same
issue: the only code we're going to run that cares about timelines
is in or downstream of read_local_xlog_page, which already makes
sure that the correct value gets set. Hence, don't do it here.
Patch by me, reviewed and tested by Michael Paquier, Amul Sul, and
Álvaro Herrera.
Discussion: https://postgr.es/m/CA+TgmobfAAqhfWa1kaFBBFvX+5CjM=7TE=n4r4Q1o2bjbGYBpA@mail.gmail.com
Diffstat (limited to 'src/backend/replication/logical/logicalfuncs.c')
-rw-r--r-- | src/backend/replication/logical/logicalfuncs.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/backend/replication/logical/logicalfuncs.c b/src/backend/replication/logical/logicalfuncs.c index e59939aad11..5a7fae4a87d 100644 --- a/src/backend/replication/logical/logicalfuncs.c +++ b/src/backend/replication/logical/logicalfuncs.c @@ -208,13 +208,12 @@ pg_logical_slot_get_changes_guts(FunctionCallInfo fcinfo, bool confirm, bool bin rsinfo->setDesc = p->tupdesc; /* - * Compute the current end-of-wal and maintain ThisTimeLineID. - * RecoveryInProgress() will update ThisTimeLineID on promotion. + * Compute the current end-of-wal. */ if (!RecoveryInProgress()) end_of_wal = GetFlushRecPtr(); else - end_of_wal = GetXLogReplayRecPtr(&ThisTimeLineID); + end_of_wal = GetXLogReplayRecPtr(NULL); ReplicationSlotAcquire(NameStr(*name), true); |