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

Commiteb5ad4f

Browse files
Check that xmax didn't commit in freeze check.
We cannot rely on TransactionIdDidAbort here, since in general it mayreport transactions that were in-progress at the time of an earlier hardcrash as not aborted, effectively behaving as if they were still inprogress even after crash recovery completes. Go back to defensivelyverifying that xmax didn't commit instead.Oversight in commit79d4bf4.Author: Peter Geoghegan <pg@bowt.ie>Reported-By: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/20230104035636.hy5djyr2as4gbc4q@awork3.anarazel.de
1 parent5212d44 commiteb5ad4f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6208,10 +6208,10 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask,
62086208
* been pruned away instead, since updater XID is < OldestXmin).
62096209
* Just remove xmax.
62106210
*/
6211-
if (!TransactionIdDidAbort(update_xact))
6211+
if (TransactionIdDidCommit(update_xact))
62126212
ereport(ERROR,
62136213
(errcode(ERRCODE_DATA_CORRUPTED),
6214-
errmsg_internal("multixact %u containsnon-aborted update XID %u from before removable cutoff %u",
6214+
errmsg_internal("multixact %u containscommitted update XID %u from before removable cutoff %u",
62156215
multi,update_xact,
62166216
cutoffs->OldestXmin)));
62176217
*flags |=FRM_INVALIDATE_XMAX;
@@ -6825,15 +6825,21 @@ heap_freeze_execute_prepared(Relation rel, Buffer buffer,
68256825
errmsg_internal("uncommitted xmin %u needs to be frozen",
68266826
xmin)));
68276827
}
6828+
6829+
/*
6830+
* TransactionIdDidAbort won't work reliably in the presence of XIDs
6831+
* left behind by transactions that were in progress during a crash,
6832+
* so we can only check that xmax didn't commit
6833+
*/
68286834
if (frz->checkflags&HEAP_FREEZE_CHECK_XMAX_ABORTED)
68296835
{
68306836
TransactionIdxmax=HeapTupleHeaderGetRawXmax(htup);
68316837

68326838
Assert(TransactionIdIsNormal(xmax));
6833-
if (unlikely(!TransactionIdDidAbort(xmax)))
6839+
if (unlikely(TransactionIdDidCommit(xmax)))
68346840
ereport(ERROR,
68356841
(errcode(ERRCODE_DATA_CORRUPTED),
6836-
errmsg_internal("cannot freezenon-aborted xmax %u",
6842+
errmsg_internal("cannot freezecommitted xmax %u",
68376843
xmax)));
68386844
}
68396845
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp