mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-11-27 07:21:09 +08:00
Fix SxactGlobalXmin tracking.
Commit bb16aba50
broke the code that maintains SxactGlobalXmin. It
could get stuck when a well-timed READ ONLY transaction runs. If
SxactGlobalXmin stops advancing, transactions on the
FinishedSerializableTransactions queue are never cleaned up, so
resources are effectively leaked. Revert that hunk of the commit.
Also revert another similar hunk that was probably harmless, but
unnecessary and unjustified, relating to the DOOMED flag in case of
RO_SAFE early release.
Author: Thomas Munro
Reported-by: Tom Lane
Discussion: https://postgr.es/m/16170.1557251214%40sss.pgh.pa.us
This commit is contained in:
parent
cd805f46d8
commit
47a338cfcd
@ -3438,8 +3438,7 @@ ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe)
|
||||
* cleanup. This means it should not be considered when calculating
|
||||
* SxactGlobalXmin.
|
||||
*/
|
||||
if (!isReadOnlySafe)
|
||||
MySerializableXact->flags |= SXACT_FLAG_DOOMED;
|
||||
MySerializableXact->flags |= SXACT_FLAG_DOOMED;
|
||||
MySerializableXact->flags |= SXACT_FLAG_ROLLED_BACK;
|
||||
|
||||
/*
|
||||
@ -3635,8 +3634,7 @@ ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe)
|
||||
* was launched.
|
||||
*/
|
||||
needToClear = false;
|
||||
if (!isReadOnlySafe &&
|
||||
TransactionIdEquals(MySerializableXact->xmin, PredXact->SxactGlobalXmin))
|
||||
if (TransactionIdEquals(MySerializableXact->xmin, PredXact->SxactGlobalXmin))
|
||||
{
|
||||
Assert(PredXact->SxactGlobalXminCount > 0);
|
||||
if (--(PredXact->SxactGlobalXminCount) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user