pg_locks view versus prepared transactions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: pg_locks view versus prepared transactions
Date: 2005-06-18 15:49:20
Message-ID: 13967.1119109760@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Now that Heikki's two-phase-commit patch is in, we have a bit of a
problem in the pg_locks view: prepared transactions can hold locks,
but you can't tell which prepared transaction is holding which lock.
They all show with "pid 0". (This should probably come out as a NULL
instead of 0, but I didn't change it yet.)

I think the minimum thing we ought to do about this is add an XID
column to pg_locks to show the transaction ID holding each lock.
Then you could join that to pg_prepared_xacts to see what's what.

I was also wondering about adding a current-XID column to
pg_stat_activity, and encouraging people to join pg_locks and
pg_stat_activity on XID instead of PID.

Ultimately we should maybe even remove PID from pg_locks, but probably
for backwards compatibility it'd have to be deprecated for a release
or two first.

Thoughts?

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Juan Pablo Espino 2005-06-18 16:11:31 Login/logout
Previous Message Tom Lane 2005-06-18 15:41:21 Post-mortem: final 2PC patch