Need help understanding pg_locks - Mailing list pgsql-hackers

From Bruce Momjian
Subject Need help understanding pg_locks
Date
Msg-id 201107100401.p6A41JR02682@momjian.us
Whole thread Raw
Responses Re: Need help understanding pg_locks
List pgsql-hackers
Can someone help me understand pg_locks?  There are three fields related
to virtual and real xids:
virtualtransaction | text     |transactionid      | xid      |virtualxid         | text     |

Our docs say 'virtualtransaction'  is:
      Virtual ID of the transaction that is holding or awaiting this lock

This field was clear to me.

and 'transactionid' is documented as:
      ID of a transaction, or null if the object is not a transaction ID

In my testing it was the (non-virtual) xid of the lock holder.  Is that
correct?  Can it be a waiter?

'virtualxid' is documented as:
      Virtual ID of a transaction, or null if the object is not a      virtual transaction ID

In my testing this field is for locking your own vxid, meaning it owned
by its own vxid.

I looked at the C code in /pg/backend/utils/adt/lockfuncs.c and was
confused.

Clearly our documentation is lacking in this area and I would like to
clarify it.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: per-column generic option
Next
From: Alvaro Herrera
Date:
Subject: Re: Extra check in 9.0 exclusion constraint unintended consequences