initprocess-assert.patch

text/plain

Filename: initprocess-assert.patch
Type: text/plain
Part: 0
Message: Re: FATAL: lock AccessShareLock on object 0/1260/0 is already held
--- postgresql-9.0.4/src/backend/storage/lmgr/proc.c	2011-04-14 20:15:53.000000000 -0700
+++ postgresql-9.0.4.dg/src/backend/storage/lmgr/proc.c	2011-08-23 17:30:03.505176019 -0700
@@ -323,7 +323,15 @@
 	MyProc->waitLock = NULL;
 	MyProc->waitProcLock = NULL;
 	for (i = 0; i < NUM_LOCK_PARTITIONS; i++)
+	{
+		SHM_QUEUE *queue = &(MyProc->myProcLocks[i]);
+		if (! (!queue->prev || queue->prev == queue ||
+		       !queue->next || queue->next == queue)
+                   )
+			elog(FATAL, "Initprocess myProclocks[%d] not empty: queue %p (prev %p, next %p) ",
+				i, queue, queue->prev, queue->next);
 		SHMQueueInit(&(MyProc->myProcLocks[i]));
+	}
 	MyProc->recoveryConflictPending = false;
 
 	/*