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

Commitd798ea7

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 parente8e3e67 commitd798ea7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,8 @@ TransactionIdLimitedForOldSnapshots(TransactionId recentXmin,
17771777
{
17781778
if (TransactionIdIsNormal(recentXmin)
17791779
&&old_snapshot_threshold >=0
1780-
&&RelationAllowsEarlyPruning(relation))
1780+
&&RelationAllowsEarlyPruning(relation)
1781+
&&RelationNeedsWAL(relation))
17811782
{
17821783
TimestampTzts=GetSnapshotCurrentTimestamp();
17831784
TransactionIdxlimit=recentXmin;

‎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