mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Redefine IsTransactionState() to only return true for TRANS_INPROGRESS state,
which is the only state in which it's safe to initiate database queries. It turns out that all but two of the callers thought that's what it meant; and the other two were using it as a proxy for "will GetTopTransactionId() return a nonzero XID"? Since it was in fact an unreliable guide to that, make those two just invoke GetTopTransactionId() always, then deal with a zero result if they get one.
This commit is contained in:
@ -23,7 +23,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.25 2007/06/01 19:38:07 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.26 2007/06/07 21:45:59 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -422,9 +422,8 @@ GetOldestXmin(bool allDbs, bool ignoreVacuum)
|
||||
* are no xacts running at all, that will be the subtrans truncation
|
||||
* point!)
|
||||
*/
|
||||
if (IsTransactionState())
|
||||
result = GetTopTransactionId();
|
||||
else
|
||||
result = GetTopTransactionId();
|
||||
if (!TransactionIdIsValid(result))
|
||||
result = ReadNewTransactionId();
|
||||
|
||||
LWLockAcquire(ProcArrayLock, LW_SHARED);
|
||||
|
Reference in New Issue
Block a user