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

Commitb0f6bd4

Browse files
committed
Reset lastOverflowedXid on standby when needed
Currently, lastOverflowedXid is never reset. It's just adjusted on newtransactions known to be overflowed. But if there are no overflowedtransactions for a long time, snapshots could be mistakenly marked assuboverflowed due to wraparound.This commit fixes this issue by resetting lastOverflowedXid when neededaltogether with KnownAssignedXids.Backpatch to all supported versions.Reported-by: Stan HuDiscussion:https://postgr.es/m/CAMBWrQ%3DFp5UAsU_nATY7EMY7NHczG4-DTDU%3DmCvBQZAQ6wa2xQ%40mail.gmail.comAuthor: Kyotaro Horiguchi, Alexander KorotkovReviewed-by: Stan Hu, Simon Riggs, Nikolay Samokhvalov, Andrey Borodin, Dmitry Dolgov
1 parent01a11c7 commitb0f6bd4

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

‎src/backend/storage/ipc/procarray.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4445,24 +4445,41 @@ ExpireTreeKnownAssignedTransactionIds(TransactionId xid, int nsubxids,
44454445

44464446
/*
44474447
* ExpireAllKnownAssignedTransactionIds
4448-
*Remove all entries in KnownAssignedXids
4448+
*Remove all entries in KnownAssignedXids and reset lastOverflowedXid.
44494449
*/
44504450
void
44514451
ExpireAllKnownAssignedTransactionIds(void)
44524452
{
44534453
LWLockAcquire(ProcArrayLock,LW_EXCLUSIVE);
44544454
KnownAssignedXidsRemovePreceding(InvalidTransactionId);
4455+
4456+
/*
4457+
* Reset lastOverflowedXid. Currently, lastOverflowedXid has no use after
4458+
* the call of this function. But do this for unification with what
4459+
* ExpireOldKnownAssignedTransactionIds() do.
4460+
*/
4461+
procArray->lastOverflowedXid=InvalidTransactionId;
44554462
LWLockRelease(ProcArrayLock);
44564463
}
44574464

44584465
/*
44594466
* ExpireOldKnownAssignedTransactionIds
4460-
*Remove KnownAssignedXids entries preceding the given XID
4467+
*Remove KnownAssignedXids entries preceding the given XID and
4468+
*potentially reset lastOverflowedXid.
44614469
*/
44624470
void
44634471
ExpireOldKnownAssignedTransactionIds(TransactionIdxid)
44644472
{
44654473
LWLockAcquire(ProcArrayLock,LW_EXCLUSIVE);
4474+
4475+
/*
4476+
* Reset lastOverflowedXid if we know all transactions that have been
4477+
* possibly running are being gone. Not doing so could cause an incorrect
4478+
* lastOverflowedXid value, which makes extra snapshots be marked as
4479+
* suboverflowed.
4480+
*/
4481+
if (TransactionIdPrecedes(procArray->lastOverflowedXid,xid))
4482+
procArray->lastOverflowedXid=InvalidTransactionId;
44664483
KnownAssignedXidsRemovePreceding(xid);
44674484
LWLockRelease(ProcArrayLock);
44684485
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp