diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-04-04 17:40:36 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-04-04 17:40:36 +0000 |
commit | c973051ae69228129aeb8eb413d451ba4b326cad (patch) | |
tree | 63f48e51738810a7602043ceaad8f94f8b6f56ee /src/include/storage/lock.h | |
parent | 1c2d408c013ecbbaa03ee0871c1867585f2d4903 (diff) | |
download | postgresql-c973051ae69228129aeb8eb413d451ba4b326cad.tar.gz postgresql-c973051ae69228129aeb8eb413d451ba4b326cad.zip |
A session that does not have any live snapshots does not have to be waited for
when we are waiting for old snapshots to go away during a concurrent index
build. In particular, this rule lets us avoid waiting for
idle-in-transaction sessions.
This logic could be improved further if we had some way to wake up when
the session we are currently waiting for goes idle-in-transaction. However
that would be a significantly more complex/invasive patch, so it'll have to
wait for some other day.
Simon Riggs, with some improvements by Tom.
Diffstat (limited to 'src/include/storage/lock.h')
-rw-r--r-- | src/include/storage/lock.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index 7ec3a24cb6e..e2b27ccb98b 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.115 2009/01/01 17:24:01 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.116 2009/04/04 17:40:36 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -67,6 +67,12 @@ typedef struct #define VirtualTransactionIdIsValid(vxid) \ (((vxid).backendId != InvalidBackendId) && \ LocalTransactionIdIsValid((vxid).localTransactionId)) +#define VirtualTransactionIdEquals(vxid1, vxid2) \ + ((vxid1).backendId == (vxid2).backendId && \ + (vxid1).localTransactionId == (vxid2).localTransactionId) +#define SetInvalidVirtualTransactionId(vxid) \ + ((vxid).backendId = InvalidBackendId, \ + (vxid).localTransactionId = InvalidLocalTransactionId) #define GET_VXID_FROM_PGPROC(vxid, proc) \ ((vxid).backendId = (proc).backendId, \ (vxid).localTransactionId = (proc).lxid) |