diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-07 21:45:59 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-07 21:45:59 +0000 |
commit | 6d6d14b6d52f7a709fba8fd23244a7de014f2048 (patch) | |
tree | b7785d952d5e841684cdd1054087f63a04bbb009 /src/backend/storage/ipc | |
parent | 24ee8af57378ee3b065f6a0d62aeb5a5c7313284 (diff) |
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.
Diffstat (limited to 'src/backend/storage/ipc')
-rw-r--r-- | src/backend/storage/ipc/procarray.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 287d3b4ee56..9d290ba9739 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -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); |