Skip to content

[pull] master from postgres:master #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/backend/replication/slot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2079,6 +2079,7 @@ void
CheckPointReplicationSlots(bool is_shutdown)
{
int i;
bool last_saved_restart_lsn_updated = false;

elog(DEBUG1, "performing replication slot checkpoint");

Expand Down Expand Up @@ -2123,15 +2124,23 @@ CheckPointReplicationSlots(bool is_shutdown)
SpinLockRelease(&s->mutex);
}

/*
* Track if we're going to update slot's last_saved_restart_lsn. We
* need this to know if we need to recompute the required LSN.
*/
if (s->last_saved_restart_lsn != s->data.restart_lsn)
last_saved_restart_lsn_updated = true;

SaveSlotToPath(s, path, LOG);
}
LWLockRelease(ReplicationSlotAllocationLock);

/*
* Recompute the required LSN as SaveSlotToPath() updated
* last_saved_restart_lsn for slots.
* Recompute the required LSN if SaveSlotToPath() updated
* last_saved_restart_lsn for any slot.
*/
ReplicationSlotsComputeRequiredLSN();
if (last_saved_restart_lsn_updated)
ReplicationSlotsComputeRequiredLSN();
}

/*
Expand Down