Re: [HACKERS] some question about deadlock

2006-05-29 Thread Tom Lane
"ipig" <[EMAIL PROTECTED]> writes: >In your example, it seems that process B is the first such waiter( the > request of B conflicts AccessShareLock). No. Better go study http://developer.postgresql.org/docs/postgres/explicit-locking.html#LOCKING-TABLES After looking at the example again, co

Re: [HACKERS] some question about deadlock

2006-05-29 Thread ipig
" ; Sent: Monday, May 29, 2006 11:51 PM Subject: Re: [HACKERS] some question about deadlock > "ipig" <[EMAIL PROTECTED]> writes: >> That is to say, if p0 wants to lock A again, then p0 will be put before >> p1, and p0 will be at the head of the queue. Why

Re: [HACKERS] some question about deadlock

2006-05-29 Thread Tom Lane
"ipig" <[EMAIL PROTECTED]> writes: > That is to say, if p0 wants to lock A again, then p0 will be put before > p1, and p0 will be at the head of the queue. Why do we need to find the first > waiter which conflicts p0? I think that p0 must be added at the head of the > wait queue. Your analy

Re: [HACKERS] some question about deadlock

2006-05-29 Thread ipig
head, since the first waiter in the queue must conflict with the lock-held process. Best wishes. - Original Message - From: "Bruce Momjian" To: "ipig" <[EMAIL PROTECTED]> Cc: Sent: Monday, May 29, 2006 11:26 PM Subject: Re: [HACKERS] some question about dead

Re: [HACKERS] some question about deadlock

2006-05-29 Thread Bruce Momjian
Alvaro Herrera wrote: > ipig wrote: > > Hi, > > Thanks for your reply. > > I changed the format to plain text. > > > > For the question, suppose that process p0 held the lock of object A, > > and the wait queue for A is p1,p2,p3,, that process p1 is the first > > waiter in the qu

Re: [HACKERS] some question about deadlock

2006-05-29 Thread Bruce Momjian
ipig wrote: > Hi, > Thanks for your reply. > I changed the format to plain text. > > For the question, suppose that process p0 held the lock of object A, and > the wait queue for A is p1,p2,p3,, that process p1 is the first waiter in > the queue. > Since p1 is in the wait que

Re: [HACKERS] some question about deadlock

2006-05-29 Thread ipig
- From: "Bruce Momjian" To: "ipig" <[EMAIL PROTECTED]> Cc: Sent: Monday, May 29, 2006 9:49 PM Subject: Re: [HACKERS] some question about deadlock > ipig wrote: >> Hi, >> >> Below is the notes from postgresql-8.1.3/src/backend/storage/lmgr/README: >&g

Re: [HACKERS] some question about deadlock

2006-05-29 Thread Bruce Momjian
ipig wrote: > Hi, > > Below is the notes from postgresql-8.1.3/src/backend/storage/lmgr/README: > > > Lock acquisition (routines LockAcquire and ProcSleep) follows these rules: > > 1. A lock request is granted immediately if it does not conflict with > any existing or waiting lock request, or i

[HACKERS] some question about deadlock

2006-05-29 Thread ipig
Hi,   Below is the notes from postgresql-8.1.3/src/backend/storage/lmgr/README:     Lock acquisition (routines LockAcquire and ProcSleep) follows these rules:   1. A lock request is granted immediately if it does not conflict withany existing or waiting lock request, or if the pr