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

Commit36eeb37

Browse files
committed
Ignore invalidated slots while computing oldest catalog Xmin
Once a logical slot has acquired a catalog_xmin, it doesn't let go ofit, even when invalidated by exceeding the max_slot_wal_keep_size, whichmeans that dead catalog tuples are not removed by vacuum anymore sincethe point is invalidated, until the slot is dropped. This could becatastrophic if catalog churn is high.Change the computation of Xmin to ignore invalidated slots,to prevent dead rows from accumulating.Backpatch to 13, where slot invalidation appeared.Author: Sirisha Chamarthi <sirichamarthi22@gmail.com>Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>Discussion:https://postgr.es/m/CAKrAKeUEDeqquN9vwzNeG-CN8wuVsfRYbeOUV9qKO_RHok=j+g@mail.gmail.com
1 parent0e32152 commit36eeb37

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

‎src/backend/replication/slot.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,15 +766,22 @@ ReplicationSlotsComputeRequiredXmin(bool already_locked)
766766
ReplicationSlot*s=&ReplicationSlotCtl->replication_slots[i];
767767
TransactionIdeffective_xmin;
768768
TransactionIdeffective_catalog_xmin;
769+
boolinvalidated;
769770

770771
if (!s->in_use)
771772
continue;
772773

773774
SpinLockAcquire(&s->mutex);
774775
effective_xmin=s->effective_xmin;
775776
effective_catalog_xmin=s->effective_catalog_xmin;
777+
invalidated= (!XLogRecPtrIsInvalid(s->data.invalidated_at)&&
778+
XLogRecPtrIsInvalid(s->data.restart_lsn));
776779
SpinLockRelease(&s->mutex);
777780

781+
/* invalidated slots need not apply */
782+
if (invalidated)
783+
continue;
784+
778785
/* check the data xmin */
779786
if (TransactionIdIsValid(effective_xmin)&&
780787
(!TransactionIdIsValid(agg_xmin)||

‎src/backend/storage/ipc/procarray.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3203,6 +3203,9 @@ ProcArraySetReplicationSlotXmin(TransactionId xmin, TransactionId catalog_xmin,
32033203

32043204
if (!already_locked)
32053205
LWLockRelease(ProcArrayLock);
3206+
3207+
elog(DEBUG1,"xmin required by slots: data %u, catalog %u",
3208+
xmin,catalog_xmin);
32063209
}
32073210

32083211
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp