Lock freeze ? in MVCC - Mailing list pgsql-hackers

From Hiroshi Inoue
Subject Lock freeze ? in MVCC
Date
Msg-id 000a01be9060$ea21dae0$2801007e@cadzone.tpf.co.jp
Whole thread Raw
Responses Re: [HACKERS] Lock freeze ? in MVCC
List pgsql-hackers
Hello all,

The following example causes the hang of concurrent 
transactions(99/04/26 snapshot).

session-1 => create table tt (id int4);

session-1 => begin;
session-1 => insert into tt values (1);

session-2 => begin;
session-2 => insert into tt values (2);

session-3 => begin;
session-3 => lock table tt;    (blocked)

session-1 => update tt set id=1 where id=1;    (blocked)

session-2 => end;

session-2 returns immediately,but session-3 and session-1 
are still blocked 


This phenomenon seems to be caused by LockResolveCon
flicts() or DeadLockCheck().
Both session-1 and session-2 acquire RowExclusive locks 
by insert operations(InitPlan() in execMain.c). 
The AccessExclusive lock of session-3 is queued waiting 
for the release of above locks.
When the update operation of session-1 is executed,the 
second RowExclusive lock is rejected by LockResolve
Conflicts() and queued after the AccessExclusive lock 
of session-3.  
The state is like deadlock but DeadLockCheck() doesn't 
regard the state as deadlock.

Thanks.

Hiroshi Inoue
Inoue@tpf.co.jp


pgsql-hackers by date:

Previous
From: Todd Graham Lewis
Date:
Subject: Re: [HACKERS] MVCC Question
Next
From: Tom
Date:
Subject: Re: [HACKERS] RE: Mysql comparison