Re: timeout on lock feature

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Henryk Szal <szal(at)doctorq(dot)com(dot)pl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: timeout on lock feature
Date: 2001-04-09 17:48:49
Message-ID: 200104091748.NAA13137@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


If you can't handle the SET variable stuff, we can do it over here.

Thanks.

> Hi,
>
> I implement additional server functionality. Currently (v7.0.3), executing
> SQL update statement on the same
> row from inside two different processess results in blocking second process
> to the end of transaction in
> the first one. In real OLTP application second process can't wait too long.
> After few seconds server should
> return to the application message:'lock timeout exceeded'. I modify postgres
> lock manager source code to
> obtain that functionality. I take advantage of deadlock detection mechanism.
> Currently deadlock
> detection routine initialy check for simple deadlock detection between two
> processess, next insert lock
> into lock queue and after DEADLOCK_CHECK_TIMER seconds run HandleDeadLock to
> comprehensive deadlock detection.
> To obtain 'timeout on lock' feature I do as follow:
>
> 1. Add new configure parameter. Currently I add #define statement in file
> include/config.in
> #define NO_WAIT_FOR_LOCK 1
> In the future somebody can add new option to SQL SET command
>
> 2. Modify HandleDeadLock routine. In file backend/storage/lmgr/proc.c change
> lines 866-870
>
> if (!DeadLockCheck(MyProc, MyProc->waitLock))
> {
> UnlockLockTable();
> return;
> }
>
> to
>
> if (!NO_WAIT_FOR_LOCK)
> {
> if (!DeadLockCheck(MyProc, MyProc->waitLock))
> {
> UnlockLockTable();
> return;
> }
> }
>
> With this modyfication every conflicting lock wait DEADLOCK_CHECK_TIMER
> seconds in queue and returns with error
> 'deadlock detect'.
>
> Who can add this simply 'timeout on lock' implementation to the next
> postgres server release?
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(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 Ciaran Johnston 2001-04-09 17:57:00 Re: Configure problems on Solaris 2.7, pgsql 7.02 and 7.03
Previous Message Bruce Momjian 2001-04-09 17:48:27 Re: timeout on lock feature