* Hiroshi Inoue <Inoue@tpf.co.jp> [000515 02:07] wrote:
> > -----Original Message-----
> > From: pgsql-hackers-owner@hub.org [mailto:pgsql-hackers-owner@hub.org]On
> > Behalf Of Alfred Perlstein
> >
> > Basically I was running two instances of psql, in one I issued:
> >
> > one two
> >
> > begin;
> > lock data; -- some table
> > lock data;^C -- cancel
> > select * from data;^C -- cancel
> > end;
> >
> > lock data;^C -- HUNG then aborted
> >
> > It's annoying that I can't seem to reproduce this, and I know LOCKs
> > are only to be requested during a transaction, but it did happen.
> >
>
> Could the following example explain your HUNG problem ?
>
> Session-1
> # begin;
> BEGIN
> =# lock t;
> LOCK TABLE
>
> Session-2
> =# begin;
> BEGIN
> =# lock t;
> [blocked] ^C
> Cancel request sent
> ERROR: Query cancel requested while waiting lock
> reindex=# select * from t;
> [blocked]
>
> Session-1
> =# commit;
> COMMIT
>
> Session-2
> ERROR: LockRelation: LockAcquire failed
> =# abort;
> ROLLBACK
> =# lock t;
> [blocked]
That looks pretty much like the sequence of events that lead up to
the problem, the problem is that I was just manually testing out
the way locks work and didn't write down the exact steps I took.
This is probably exactly the right steps though.
--
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."