Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcaf1f67

Browse files
committed
Don't set ThisTimeLineID when there's no reason to do so.
In slotfuncs.c, pg_replication_slot_advance() needs to determinethe LSN up to which the slot should be advanced, but that doesn'trequire us to update ThisTimeLineID, because none of the code calledfrom 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 sureit's up to date. If the replication slot is physical, the timelineisn't used for anything at all.In logicalfuncs.c, pg_logical_slot_get_changes_guts() has the sameissue: the only code we're going to run that cares about timelinesis in or downstream of read_local_xlog_page, which already makessure 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
1 parentd74b54b commitcaf1f67

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

‎src/backend/replication/logical/logicalfuncs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,12 @@ pg_logical_slot_get_changes_guts(FunctionCallInfo fcinfo, bool confirm, bool bin
208208
rsinfo->setDesc=p->tupdesc;
209209

210210
/*
211-
* Compute the current end-of-wal and maintain ThisTimeLineID.
212-
* RecoveryInProgress() will update ThisTimeLineID on promotion.
211+
* Compute the current end-of-wal.
213212
*/
214213
if (!RecoveryInProgress())
215214
end_of_wal=GetFlushRecPtr();
216215
else
217-
end_of_wal=GetXLogReplayRecPtr(&ThisTimeLineID);
216+
end_of_wal=GetXLogReplayRecPtr(NULL);
218217

219218
ReplicationSlotAcquire(NameStr(*name), true);
220219

‎src/backend/replication/slotfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ pg_replication_slot_advance(PG_FUNCTION_ARGS)
627627
if (!RecoveryInProgress())
628628
moveto=Min(moveto,GetFlushRecPtr());
629629
else
630-
moveto=Min(moveto,GetXLogReplayRecPtr(&ThisTimeLineID));
630+
moveto=Min(moveto,GetXLogReplayRecPtr(NULL));
631631

632632
/* Acquire the slot so we "own" it */
633633
ReplicationSlotAcquire(NameStr(*slotname), true);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp