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

Commitd6b0c2b

Browse files
committed
Improve truncation of pg_serial/, removing "apparent wraparound" LOGs
It is possible that the tail XID of pg_serial/ gets ahead of its headXID, which would cause the truncation of pg_serial/ done duringcheckpoints to show up as a "wraparound" LOG in SimpleLruTruncate(),which is confusing. This also wastes a bit of disk space until the headpage is reclaimed again.CheckPointPredicate() is changed so as the cutoff page for thetruncation is switched to the head page if the tail XID has advancedbeyond the head XID, rather than the tail page. This prevents theconfusing LOG message about a wraparound while allowing some truncationto be done to cut in disk space.This could be considered as a bug fix, but the original behavior isharmless as well, resulting only in disk space temporarily wasted, sono backpatch is done.Author: Sami ImseihReviewed-by: Heikki Linnakangas, Michael PaquierDiscussion:https://postgr.es/m/755E19CA-D02C-4A4C-80D3-74F775410C48@amazon.com
1 parent6fcaeb0 commitd6b0c2b

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

‎src/backend/storage/lmgr/predicate.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ SerialSetActiveSerXmin(TransactionId xid)
10041004
void
10051005
CheckPointPredicate(void)
10061006
{
1007-
inttailPage;
1007+
inttruncateCutoffPage;
10081008

10091009
LWLockAcquire(SerialSLRULock,LW_EXCLUSIVE);
10101010

@@ -1017,8 +1017,24 @@ CheckPointPredicate(void)
10171017

10181018
if (TransactionIdIsValid(serialControl->tailXid))
10191019
{
1020-
/* We can truncate the SLRU up to the page containing tailXid */
1020+
inttailPage;
1021+
10211022
tailPage=SerialPage(serialControl->tailXid);
1023+
1024+
/*
1025+
* It is possible for the tailXid to be ahead of the headXid. This
1026+
* occurs if we checkpoint while there are in-progress serializable
1027+
* transaction(s) advancing the tail but we are yet to summarize the
1028+
* transactions. In this case, we cutoff up to the headPage and the
1029+
* next summary will advance the headXid.
1030+
*/
1031+
if (SerialPagePrecedesLogically(tailPage,serialControl->headPage))
1032+
{
1033+
/* We can truncate the SLRU up to the page containing tailXid */
1034+
truncateCutoffPage=tailPage;
1035+
}
1036+
else
1037+
truncateCutoffPage=serialControl->headPage;
10221038
}
10231039
else
10241040
{
@@ -1051,14 +1067,14 @@ CheckPointPredicate(void)
10511067
* transaction instigating the summarize fails in
10521068
* SimpleLruReadPage().
10531069
*/
1054-
tailPage=serialControl->headPage;
1070+
truncateCutoffPage=serialControl->headPage;
10551071
serialControl->headPage=-1;
10561072
}
10571073

10581074
LWLockRelease(SerialSLRULock);
10591075

10601076
/* Truncate away pages that are no longer required */
1061-
SimpleLruTruncate(SerialSlruCtl,tailPage);
1077+
SimpleLruTruncate(SerialSlruCtl,truncateCutoffPage);
10621078

10631079
/*
10641080
* Write dirty SLRU pages to disk

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp