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

Commit1b3ed75

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 parent385b317 commit1b3ed75

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
@@ -778,15 +778,22 @@ ReplicationSlotsComputeRequiredXmin(bool already_locked)
778778
ReplicationSlot*s=&ReplicationSlotCtl->replication_slots[i];
779779
TransactionIdeffective_xmin;
780780
TransactionIdeffective_catalog_xmin;
781+
boolinvalidated;
781782

782783
if (!s->in_use)
783784
continue;
784785

785786
SpinLockAcquire(&s->mutex);
786787
effective_xmin=s->effective_xmin;
787788
effective_catalog_xmin=s->effective_catalog_xmin;
789+
invalidated= (!XLogRecPtrIsInvalid(s->data.invalidated_at)&&
790+
XLogRecPtrIsInvalid(s->data.restart_lsn));
788791
SpinLockRelease(&s->mutex);
789792

793+
/* invalidated slots need not apply */
794+
if (invalidated)
795+
continue;
796+
790797
/* check the data xmin */
791798
if (TransactionIdIsValid(effective_xmin)&&
792799
(!TransactionIdIsValid(agg_xmin)||

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

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

39473947
if (!already_locked)
39483948
LWLockRelease(ProcArrayLock);
3949+
3950+
elog(DEBUG1,"xmin required by slots: data %u, catalog %u",
3951+
xmin,catalog_xmin);
39493952
}
39503953

39513954
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp