mirror of
https://github.com/postgres/postgres.git
synced 2026-06-09 00:32:10 -04:00
Advance restart_lsn more eagerly in LogicalConfirmReceivedLocation
The existing logic computed an updated replicationSlotMinLSN from all slots' restart_lsn only when catalog_xmin also advanced. This is not a problem in normal (non-repack) cases, because catalog_xmin changes pretty frequently, so the recomputation is triggered frequently enough. However, REPACK does not currently change its catalog snapshot, so that doesn't work very well if no other replication slot is being used. (After this commit, we still don't recycle WAL properly for REPACK, because its background worker is not advancing its restart_lsn either; that will be fixed in a separate commit. However, this preexisting problem in older code is logically separate from that one.) Author: Zhijie Hou <houzj.fnst@fujitsu.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/TY4PR01MB17718B44164522D0798F8E898940A2@TY4PR01MB17718.jpnprd01.prod.outlook.com
This commit is contained in:
parent
5d48d3b14e
commit
38470c2c1e
1 changed files with 7 additions and 1 deletions
|
|
@ -1910,8 +1910,14 @@ LogicalConfirmReceivedLocation(XLogRecPtr lsn)
|
|||
SpinLockRelease(&MyReplicationSlot->mutex);
|
||||
|
||||
ReplicationSlotsComputeRequiredXmin(false);
|
||||
ReplicationSlotsComputeRequiredLSN();
|
||||
}
|
||||
|
||||
/*
|
||||
* Now that the new restart_lsn is safely on disk, recompute the
|
||||
* global WAL retention requirement.
|
||||
*/
|
||||
if (updated_restart)
|
||||
ReplicationSlotsComputeRequiredLSN();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue