> > * Allow LOCK TABLE tab1, tab2, tab3 so all tables locked in unison
Let me add to this. One problem is that my description would sometimes
lock the tables in different orders, and that is a recipe for deadlock.
If you have to release earlier locks to wait on a later lock, once you
get the later lock, you must release it and then start from the
beginning, locking them in order again. If you don't, the system could
report a deadlock at random times, which would be very bad.
I'll add something, too. :) I think this derived from a suggestion I
made long ago. My idea was that when multiple tables need locking, a
deadlock can occur in the process of doing them one at a time. My
suggested solution was based on an analogy with the way ethernet
packets work.
- go through the list locking tables along the way.
- if a lock cannot be obtained within some time, release some (all?) locks,
and try again after some random time.
- keep trying (and releasing as needed) until some other timeout
passes, and then punt.
My thought was that if colliding locks are occuring, some sequence of
relinquishing locks (not necessarily all of them with each trial),
waiting, and reasserting them should work around the collisions.
Introducing random components to this might reduce the overall waiting
time, but I suppose a careful analysis of this needs to be done.
Perhaps just releasing all of the locks, waiting a random time, and
trying again is enough.
Somehow there has to be a mechanism for atomically asserting locks on
more than one table.
Cheers,
Brook
************
From owner-pgsql-patches@hub.org Sat Dec 18 22:51:06 1999
Received: from renoir.op.net (root@renoir.op.net [207.29.195.4])
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id XAA18409
for <pgman@candle.pha.pa.us>; Sat, 18 Dec 1999 23:51:05 -0500 (EST)
Received: from hub.org (hub.org [216.126.84.1]) by renoir.op.net (o1/$Revision: 1.1 $) with ESMTP id XAA27570 for <pgman@candle.pha.pa.us>; Sat, 18 Dec 1999 23:49:19 -0500 (EST)
Received: from hub.org (hub.org [216.126.84.1])
by hub.org (8.9.3/8.9.3) with ESMTP id XAA52323;
Sat, 18 Dec 1999 23:45:32 -0500 (EST)
(envelope-from owner-pgsql-patches@hub.org)
Received: by hub.org (TLB v0.10a (1.23 tibbs 1997/01/09 00:29:32)); Sat, 18 Dec 1999 23:44:37 +0000 (EST)
Received: (from majordom@localhost)
by hub.org (8.9.3/8.9.3) id XAA52107
for pgsql-patches-outgoing; Sat, 18 Dec 1999 23:43:37 -0500 (EST)