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

Commitbc153c9

Browse files
author
Amit Kapila
committed
Attach FPI to the first record after full_page_writes is turned on.
XLogInsert fails to attach a required FPI to the first record afterfull_page_writes is turned on by the last checkpoint. This bug gotintroduced in 9.5 due to code rearrangement in commits2c03216 and2076db2. Fix it by ensuring that XLogInsertRecord performs arecomputation when the given record is generated with FPW as off butfound that the flag has been turned on while actually inserting therecord.Reported-by: Kyotaro HoriguchiAuthor: Kyotaro HoriguchiReviewed-by: Amit KapilaBackpatch-through: 9.5 where this problem was introducedDiscussion:https://postgr.es/m/20180420.151043.74298611.horiguchi.kyotaro@lab.ntt.co.jp
1 parent514a731 commitbc153c9

File tree

1 file changed

+13
-6
lines changed
  • src/backend/access/transam

1 file changed

+13
-6
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ static void WALInsertLockUpdateInsertingAt(XLogRecPtr insertingAt);
944944
*
945945
* If 'fpw_lsn' is valid, it is the oldest LSN among the pages that this
946946
* WAL record applies to, that were not included in the record as full page
947-
* images. If fpw_lsn>= RedoRecPtr, the function does not perform the
947+
* images. If fpw_lsn<= RedoRecPtr, the function does not perform the
948948
* insertion and returns InvalidXLogRecPtr. The caller can then recalculate
949949
* which pages need a full-page image, and retry. If fpw_lsn is invalid, the
950950
* record is always inserted.
@@ -977,6 +977,7 @@ XLogInsertRecord(XLogRecData *rdata,
977977
info==XLOG_SWITCH);
978978
XLogRecPtrStartPos;
979979
XLogRecPtrEndPos;
980+
boolprevDoPageWrites=doPageWrites;
980981

981982
/* we assume that all of the record header is in the first chunk */
982983
Assert(rdata->len >=SizeOfXLogRecord);
@@ -1024,10 +1025,14 @@ XLogInsertRecord(XLogRecData *rdata,
10241025
WALInsertLockAcquire();
10251026

10261027
/*
1027-
* Check to see if my copy of RedoRecPtr or doPageWrites is out of date.
1028-
* If so, may have to go back and have the caller recompute everything.
1029-
* This can only happen just after a checkpoint, so it's better to be slow
1030-
* in this case and fast otherwise.
1028+
* Check to see if my copy of RedoRecPtr is out of date. If so, may have
1029+
* to go back and have the caller recompute everything. This can only
1030+
* happen just after a checkpoint, so it's better to be slow in this case
1031+
* and fast otherwise.
1032+
*
1033+
* Also check to see if fullPageWrites or forcePageWrites was just turned
1034+
* on; if we weren't already doing full-page writes then go back and
1035+
* recompute.
10311036
*
10321037
* If we aren't doing full-page writes then RedoRecPtr doesn't actually
10331038
* affect the contents of the XLOG record, so we'll update our local copy
@@ -1042,7 +1047,9 @@ XLogInsertRecord(XLogRecData *rdata,
10421047
}
10431048
doPageWrites= (Insert->fullPageWrites||Insert->forcePageWrites);
10441049

1045-
if (fpw_lsn!=InvalidXLogRecPtr&&fpw_lsn <=RedoRecPtr&&doPageWrites)
1050+
if (doPageWrites&&
1051+
(!prevDoPageWrites||
1052+
(fpw_lsn!=InvalidXLogRecPtr&&fpw_lsn <=RedoRecPtr)))
10461053
{
10471054
/*
10481055
* Oops, some buffer now needs to be backed up that the caller didn't

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp