Re: [HACKERS] lock deadlocks

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: brook(at)trillium(dot)NMSU(dot)Edu (Brook Milligan)
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] lock deadlocks
Date: 1999-01-12 17:25:09
Message-ID: 199901121725.MAA09763@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I have just encountered some applications that really need
> transactions and so have been perusing the transaction statements and
> the lock man page. Thinking of the possibility of deadlocks if two
> processes try to acquire locks in opposite order suggested a solution.
>
> Couldn't the parser syntax be expanded to
>
> LOCK [TABLE] table1 [, table2 [, table3 [...]]]
>
> in which case locks on the entire group of tables could be obtained
> atomically. If one fails, the process should release locks on all the
> rest, wait a bit, and retry. This should prevent infinite deadlocks
> since all locks (not just the most recent one of several independent
> locks) would be released at some point, allowing other processes to
> assert theirs.

You give a nice extension of the LOCK statement, that is quite valid,
_and_ can not be simulated with multiple lock statements.

Complex kernel locking systems, mostly multi-cpu kernels, have to do
similar things. You want an 'all or nothing' lock statement. I will
add this to the TODO list.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Ivar Helbekkmo 1999-01-12 19:55:19 Re: [HACKERS] postgres and year 2000
Previous Message Jose' Soares 1999-01-12 16:35:25 Re: [HACKERS] CONSTRAINTS...