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

Commit7da8341

Browse files
committed
Revive "snapshot too old" with wal_level=minimal and SET TABLESPACE.
Given a permanent relation rewritten in the current transaction, theold_snapshot_threshold mechanism assumed the relation had never beensubject to early pruning. Hence, a query could fail to report "snapshottoo old" when the rewrite followed an early truncation. ALTER TABLE SETTABLESPACE is probably the only rewrite mechanism capable of exposingthis bug. REINDEX sets indcheckxmin, avoiding the problem. CLUSTER haszeroed page LSNs since before old_snapshot_threshold existed, soold_snapshot_threshold has never cooperated with it. ALTER TABLE... SET DATA TYPE makes the table look empty to every past snapshot,which is strictly worse. Back-patch to v13, where commitc6b9204 broke this.Kyotaro Horiguchi and Noah MischDiscussion:https://postgr.es/m/20210113.160705.2225256954956139776.horikyota.ntt@gmail.com
1 parent360bd23 commit7da8341

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎src/backend/utils/time/snapmgr.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,11 @@ TransactionIdLimitedForOldSnapshots(TransactionId recentXmin,
17641764
Assert(OldSnapshotThresholdActive());
17651765
Assert(limit_ts!=NULL&&limit_xid!=NULL);
17661766

1767-
if (!RelationAllowsEarlyPruning(relation))
1767+
/*
1768+
* TestForOldSnapshot() assumes early pruning advances the page LSN, so we
1769+
* can't prune early when skipping WAL.
1770+
*/
1771+
if (!RelationAllowsEarlyPruning(relation)|| !RelationNeedsWAL(relation))
17681772
return false;
17691773

17701774
ts=GetSnapshotCurrentTimestamp();

‎src/include/utils/snapmgr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838
#defineRelationAllowsEarlyPruning(rel) \
3939
( \
40-
RelationNeedsWAL(rel)\
40+
(rel)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT\
4141
&& !IsCatalogRelation(rel) \
4242
&& !RelationIsAccessibleInLogicalDecoding(rel) \
4343
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp