*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.191 2010/01/23 16:37:12 sriggs Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.192 2010/01/28 10:05:37 sriggs Exp $
*
* NOTES
* A lock table is a shared memory hash table. When
VirtualTransactionId *
GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode)
{
- VirtualTransactionId *vxids;
+ static VirtualTransactionId *vxids = NULL;
LOCKMETHODID lockmethodid = locktag->locktag_lockmethodid;
LockMethod lockMethodTable;
LOCK *lock;
* need enough space for MaxBackends + a terminator, since prepared xacts
* don't count.
*/
- vxids = (VirtualTransactionId *)
- palloc0(sizeof(VirtualTransactionId) * (MaxBackends + 1));
+ if (!InHotStandby)
+ vxids = (VirtualTransactionId *)
+ palloc0(sizeof(VirtualTransactionId) * (MaxBackends + 1));
+ else
+ {
+ if (vxids == NULL)
+ {
+ vxids = (VirtualTransactionId *)
+ malloc(sizeof(VirtualTransactionId) * (MaxBackends + 1));
+ if (vxids == NULL)
+ ereport(ERROR,
+ (errcode(ERRCODE_OUT_OF_MEMORY),
+ errmsg("out of memory")));
+
+ }
+ }
/*
* Look up the lock object matching the tag.