Re: Clearing locks - Mailing list pgsql-admin

From Matthew Excell
Subject Re: Clearing locks
Date
Msg-id AANLkTimqKX_b5k8QsvoY2oU7yojWYeIMLNlXXNNNSiQO@mail.gmail.com
Whole thread Raw
In response to Re: Clearing locks  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-admin
That did it. Thanks!

Matthew Excell


On Mon, Jun 7, 2010 at 1:46 PM, Alvaro Herrera <alvherre@commandprompt.com> wrote:
Excerpts from Matthew Excell's message of lun jun 07 15:33:27 -0400 2010:
> I'm on PostgreSQL 8.3.11 on Debian.
>
> I have a small piece of DDL (alter table title drop column is_target) that
> hangs "waiting" forever. (I've waited hours - it still shows as waiting in
> pg_top.)  I have restarted the database - even tried it in single-user mode
> - but it still waits.
>
> When I execute a query to get lock info:
>
> select
> pg_class.relname,pg_locks.locktype,mode,virtualtransaction,database,relation,granted
> from pg_class,pg_locks where pg_class.relfilenode=pg_locks.relation;
>
> (These are all the columns in pg_locks with anything but null in them.)
>
>                relname                | locktype |      mode       |
> virtualtransaction | database | relation | granted
> --------------------------------------+----------+-----------------+--------------------+----------+----------+---------
>  property_key_name_index              | relation | AccessShareLock |
> -1/22805859        |    64197 |   361377 | t

uh.  Check pg_prepared_transactions (or was it pg_prepared_xacts?) and
do a ROLLBACK PREPARED (or COMMIT PREPARED) if there's anything that
shouldn't be there.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-admin by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Clearing locks
Next
From: "Gnanakumar"
Date:
Subject: Re: PITR Recovery Question