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

Commit84db516

Browse files
committed
Fix one-off bug causing missing commit timestamps for subtransactions
The logic in charge of writing commit timestamps (enabled withtrack_commit_timestamp) for subtransactions had a one-bug bug,where it would be possible that commit timestamps go missing for thelast subtransaction committed.While on it, simplify a bit the iteration logic in the loop writing thecommit timestamps, as per suggestions from Kyotaro Horiguchi and TomLane, so as some variable initializations are not part of the loopitself.Issue introduced in73c986a.Analyzed-by: Alex KingsboroughAuthor: Alex Kingsborough, Kyotaro HoriguchiDiscussion:https://postgr.es/m/73A66172-4050-4F2A-B7F1-13508EDA2144@amazon.comBackpatch-through: 10
1 parentcf680bd commit84db516

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids,
167167
* subxid not on the previous page as head. This way, we only have to
168168
* lock/modify each SLRU page once.
169169
*/
170-
for (i=0,headxid=xid;;)
170+
headxid=xid;
171+
i=0;
172+
for (;;)
171173
{
172174
intpageno=TransactionIdToCTsPage(headxid);
173175
intj;
@@ -183,15 +185,15 @@ TransactionTreeSetCommitTsData(TransactionId xid, int nsubxids,
183185
pageno);
184186

185187
/* if we wrote out all subxids, we're done. */
186-
if (j+1>=nsubxids)
188+
if (j >=nsubxids)
187189
break;
188190

189191
/*
190192
* Set the new head and skip over it, as well as over the subxids we
191193
* just wrote.
192194
*/
193195
headxid=subxids[j];
194-
i+=j-i+1;
196+
i=j+1;
195197
}
196198

197199
/* update the cached value in shared memory */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp