Hi!

Platform: PostgreSQL 7.1.3, Linux 2.4.8, egcs 2.91.66

PostgreSQL forgets to release lock until shutdown in this scenario:

CREATE TABLE dummy (X integer);


session1                       session2
------------------------------------------------------------
BEGIN;                       |
                             |BEGIN;
SELECT * FROM dummy;         |
                             |SELECT * FROM dummy;
LOCK TABLE dummy;            |
                             |LOCK TABLE dummy;
                              deadlock....                 
\q                            \q

Deadlock is OK here, but I can't access dummy table until I restart postmaster

Everything's fine, when I comment out * marked lines in
backend/storage/lmgr/proc.c:

      if (myHeldLocks != 0)
      {
          int         aheadRequests = 0;

          proc = (PROC *) MAKE_PTR(waitQueue->links.next);
          for (i = 0; i < waitQueue->size; i++)
          {
              /* Must he wait for me? */
              if (lockctl->conflictTab[proc->waitLockMode] & myHeldLocks)
              {
                  /* Must I wait for him ? */
*                 if (lockctl->conflictTab[lockmode] & proc->heldLocks)
*                 {
*                     /* Yes, can report deadlock failure immediately */
*                     MyProc->errType = STATUS_ERROR;
*                     return STATUS_ERROR;
*                 }

Then the standard deadlock detection procedure is used.

greetings,
tom

-- 
.signature: Too many levels of symbolic links

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to