lmgr changed

Started by Vadim Mikheevover 26 years ago3 messages
#1Vadim Mikheev
vadim@krasnet.ru

Hi!

Changes:

1. Check for other waiters is moved from LockResolveConflict
to LockAquire.
2. Don't take other waiters into account if either lock
aquired by MyProc don't conflict with locks aquired by
waiters or MyProc already holds conflicting lock.
3. ProcSleep uses conflict table to order waiters. Priority
not used.
4. ProcLockWakeup stops attempts to wakeup waiters if lock
conflict found _and_ someone was already wakeuped.
5. DeadLockCheck is able to wakeup MyProc or other proc
to prevent deadlock.

Below are tests I run. Hope that lmgr issues are closed.

---

Blocked by "higher priority" lock waiting:

1:
begin;
lock t1 in row exclusive mode;
2:
begin;
lock table t1 in share row exclusive mode; -- blocked by 1
3:
begin;
lock table t2 in share row exclusive mode;
lock table t1 in row exclusive mode; -- blocked by 2
1:
lock t2 in row exclusive mode; -- blocked by 3
-- was: DeadLock: 3 waits for 2 waiting for 1
-- now: 3 granted lock on t1 and wakeuped

Blocked by other:

1:
begin;
lock t1 in row share mode;
2:
begin;
lock table t1 in row exclusive mode;
3:
begin;
lock table t2 in share row exclusive mode;
lock table t1 in share row exclusive mode; -- blocked by 2
1:
lock t2 in row exclusive mode; -- blocked by 3
-- was: DeadLock: 3 waits for lock on t1 and 1 hold lock on t1
-- now: no DeadLock: 3 blocked not by 1

Blocked by other II:

1:
begin;
lock table t1 in row share mode;
2:
begin;
lock table t1 in row exclusive mode;
3:
begin;
lock table t2 in exclusive mode;
1:
lock t2 in row share mode; -- blocked by 3
3:
lock table t1 in share row exclusive mode; -- blocked by 2
-- was: DeadLock: 3 waits for lock on t1 and 1 hold lock on t1
-- now: no DeadLock: 3 blocked not by 1
4:
begin;
lock table t3 in exclusive mode;
2:
lock table t3 in row share mode; -- blocked by 4
4:
lock table t1 in row exclusive mode; -- blocked by 3
-- was: not possible
-- now: self wakeing up

Vadim

#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Vadim Mikheev (#1)
Re: [HACKERS] lmgr changed

Hi!

Changes:

1. Check for other waiters is moved from LockResolveConflict
to LockAquire.
2. Don't take other waiters into account if either lock
aquired by MyProc don't conflict with locks aquired by
waiters or MyProc already holds conflicting lock.
3. ProcSleep uses conflict table to order waiters. Priority
not used.
4. ProcLockWakeup stops attempts to wakeup waiters if lock
conflict found _and_ someone was already wakeuped.
5. DeadLockCheck is able to wakeup MyProc or other proc
to prevent deadlock.

Below are tests I run. Hope that lmgr issues are closed.

Thanks Vadim. I don't think I could have made those changes myself.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#3Vadim Mikheev
vadim@krasnet.ru
In reply to: Bruce Momjian (#2)
Re: [HACKERS] lmgr changed

Bruce Momjian wrote:

1. Check for other waiters is moved from LockResolveConflict
to LockAquire.
2. Don't take other waiters into account if either lock
aquired by MyProc don't conflict with locks aquired by
waiters or MyProc already holds conflicting lock.
3. ProcSleep uses conflict table to order waiters. Priority
not used.
4. ProcLockWakeup stops attempts to wakeup waiters if lock
conflict found _and_ someone was already wakeuped.
5. DeadLockCheck is able to wakeup MyProc or other proc
to prevent deadlock.

Below are tests I run. Hope that lmgr issues are closed.

Thanks Vadim. I don't think I could have made those changes myself.

I should took locking into account before beta!
Sorry.

Vadim