Skip to content

Commit 0f6101e

Browse files
committed
Add lock todo items
1 parent bb8bda3 commit 0f6101e

File tree

3 files changed

+149
-1
lines changed

3 files changed

+149
-1
lines changed

doc/TODO

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ CLIENTS
136136
* Update reltuples from COPY command
137137
* fix array handling for ECPG
138138
* add pg_dump option to dump type names as standard ANSI types
139+
* make pg_dump dump in oid order, so dependencies are resolved
139140
* allow psql \d to show primary and foreign keys
140141
* allow psql \d to show temporary table schema
141142

doc/TODO.detail/lock

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
From owner-pgsql-hackers@hub.org Sat Dec 18 17:22:09 1999
2+
Received: from hub.org (hub.org [216.126.84.1])
3+
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id SAA10300
4+
for <pgman@candle.pha.pa.us>; Sat, 18 Dec 1999 18:21:57 -0500 (EST)
5+
Received: from localhost (majordom@localhost)
6+
by hub.org (8.9.3/8.9.3) with SMTP id SAA74681;
7+
Sat, 18 Dec 1999 18:17:56 -0500 (EST)
8+
(envelope-from owner-pgsql-hackers)
9+
Received: by hub.org (bulk_mailer v1.5); Sat, 18 Dec 1999 18:17:33 -0500
10+
Received: (from majordom@localhost)
11+
by hub.org (8.9.3/8.9.3) id SAA74549
12+
for pgsql-hackers-outgoing; Sat, 18 Dec 1999 18:16:38 -0500 (EST)
13+
(envelope-from owner-pgsql-hackers@postgreSQL.org)
14+
Received: from biology.nmsu.edu (biology.NMSU.Edu [128.123.5.72])
15+
by hub.org (8.9.3/8.9.3) with ESMTP id SAA74401
16+
for <pgsql-hackers@postgreSQL.org>; Sat, 18 Dec 1999 18:15:20 -0500 (EST)
17+
(envelope-from brook@biology.nmsu.edu)
18+
Received: (from brook@localhost)
19+
by biology.nmsu.edu (8.8.8/8.8.8) id QAA03433;
20+
Sat, 18 Dec 1999 16:14:50 -0700 (MST)
21+
Date: Sat, 18 Dec 1999 16:14:50 -0700 (MST)
22+
Message-Id: <199912182314.QAA03433@biology.nmsu.edu>
23+
X-Authentication-Warning: biology.nmsu.edu: brook set sender to brook@biology.nmsu.edu using -f
24+
From: Brook Milligan <brook@biology.nmsu.edu>
25+
To: pgman@candle.pha.pa.us
26+
CC: peter_e@gmx.net, pgsql-hackers@postgreSQL.org
27+
In-reply-to: <199912182026.PAA05926@candle.pha.pa.us> (message from Bruce
28+
Momjian on Sat, 18 Dec 1999 15:26:15 -0500 (EST))
29+
Subject: Re: [HACKERS] Re: [PATCHES] Lock
30+
References: <199912182026.PAA05926@candle.pha.pa.us>
31+
Sender: owner-pgsql-hackers@postgreSQL.org
32+
Status: OR
33+
34+
> > * Allow LOCK TABLE tab1, tab2, tab3 so all tables locked in unison
35+
36+
Let me add to this. One problem is that my description would sometimes
37+
lock the tables in different orders, and that is a recipe for deadlock.
38+
39+
If you have to release earlier locks to wait on a later lock, once you
40+
get the later lock, you must release it and then start from the
41+
beginning, locking them in order again. If you don't, the system could
42+
report a deadlock at random times, which would be very bad.
43+
44+
I'll add something, too. :) I think this derived from a suggestion I
45+
made long ago. My idea was that when multiple tables need locking, a
46+
deadlock can occur in the process of doing them one at a time. My
47+
suggested solution was based on an analogy with the way ethernet
48+
packets work.
49+
50+
- go through the list locking tables along the way.
51+
52+
- if a lock cannot be obtained within some time, release some (all?) locks,
53+
and try again after some random time.
54+
55+
- keep trying (and releasing as needed) until some other timeout
56+
passes, and then punt.
57+
58+
My thought was that if colliding locks are occuring, some sequence of
59+
relinquishing locks (not necessarily all of them with each trial),
60+
waiting, and reasserting them should work around the collisions.
61+
Introducing random components to this might reduce the overall waiting
62+
time, but I suppose a careful analysis of this needs to be done.
63+
Perhaps just releasing all of the locks, waiting a random time, and
64+
trying again is enough.
65+
66+
Somehow there has to be a mechanism for atomically asserting locks on
67+
more than one table.
68+
69+
Cheers,
70+
Brook
71+
72+
************
73+
74+
From owner-pgsql-patches@hub.org Sat Dec 18 22:51:06 1999
75+
Received: from renoir.op.net (root@renoir.op.net [207.29.195.4])
76+
by candle.pha.pa.us (8.9.0/8.9.0) with ESMTP id XAA18409
77+
for <pgman@candle.pha.pa.us>; Sat, 18 Dec 1999 23:51:05 -0500 (EST)
78+
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)
79+
Received: from hub.org (hub.org [216.126.84.1])
80+
by hub.org (8.9.3/8.9.3) with ESMTP id XAA52323;
81+
Sat, 18 Dec 1999 23:45:32 -0500 (EST)
82+
(envelope-from owner-pgsql-patches@hub.org)
83+
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)
84+
Received: (from majordom@localhost)
85+
by hub.org (8.9.3/8.9.3) id XAA52107
86+
for pgsql-patches-outgoing; Sat, 18 Dec 1999 23:43:37 -0500 (EST)
87+
(envelope-from owner-pgsql-patches@postgreSQL.org)
88+
Received: from fw.wintelcom.net (bright@ns1.wintelcom.net [209.1.153.20])
89+
by hub.org (8.9.3/8.9.3) with ESMTP id XAA52012
90+
for <patches@postgreSQL.org>; Sat, 18 Dec 1999 23:42:44 -0500 (EST)
91+
(envelope-from bright@wintelcom.net)
92+
Received: from localhost (bright@localhost)
93+
by fw.wintelcom.net (8.9.3/8.9.3) with ESMTP id VAA19594;
94+
Sat, 18 Dec 1999 21:12:09 -0800 (PST)
95+
Date: Sat, 18 Dec 1999 21:12:09 -0800 (PST)
96+
From: Alfred Perlstein <bright@wintelcom.net>
97+
To: Bruce Momjian <pgman@candle.pha.pa.us>
98+
cc: Peter Eisentraut <peter_e@gmx.net>, patches@postgreSQL.org
99+
Subject: Re: [PATCHES] Lock
100+
In-Reply-To: <199912181828.NAA01486@candle.pha.pa.us>
101+
Message-ID: <Pine.BSF.4.21.9912182107170.12109-100000@fw.wintelcom.net>
102+
MIME-Version: 1.0
103+
Content-Type: TEXT/PLAIN; charset=US-ASCII
104+
Sender: owner-pgsql-patches@postgreSQL.org
105+
Precedence: bulk
106+
Status: OR
107+
108+
On Sat, 18 Dec 1999, Bruce Momjian wrote:
109+
110+
> [Charset ISO-8859-1 unsupported, filtering to ASCII...]
111+
> > I was looking at this
112+
> >
113+
> > * Allow LOCK TABLE tab1, tab2, tab3 so all tables locked in unison
114+
> >
115+
> > but I'm not sure if my solution is really what was wanted, because it
116+
> > doesn't actually guarantee an all-or-nothing lock, it just locks each
117+
> > table in order. Thus it's more like a syntax simplification and reduces
118+
> > overhead.
119+
> >
120+
>
121+
> It took a few minutes, but I remember the use for this. If you are
122+
> going to hang waiting to lock tab3, you don't want to lock tab1 and tab2
123+
> while you are waiting for tab3 lock. The user wanted all tables to lock
124+
> in one operation without holding locks while waiting to complete all
125+
> locking.
126+
>
127+
> Can you do the locks, and if one fails, not hang, but unlock the
128+
> previous tables, go lock/hang on the failure, and go back and lock the
129+
> others? Seems it would have to be some kind of lock/fail/unlock/wait
130+
> loop.
131+
>
132+
> Does this make sense? It did to me.
133+
134+
Guys, have a look at:
135+
136+
http://www.freebsd.org/~terry/iml.txt
137+
http://jazz.external.hp.com/training/sqltables/c5s17.html
138+
139+
It's a way to do locking with deadlock detection, and without loosing
140+
your place in line for locks, very nifty imo.
141+
142+
-Alfred
143+
144+
145+
************
146+
147+

doc/src/FAQ.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ <H1>
77
Frequently Asked Questions (FAQ) for PostgreSQL
88
</H1>
99
<P>
10-
Last updated: Tue Mar 21 16:09:11 EST 2000
10+
Last updated: Thu Jun 1 13:57:15 EDT 2000
1111
<P>
1212
Current maintainer: Bruce Momjian (<A
1313
HREF="mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR><P>

0 commit comments

Comments
 (0)