Re: Need help understanding pg_locks - Mailing list pgsql-hackers
From | Bruce Momjian |
---|---|
Subject | Re: Need help understanding pg_locks |
Date | |
Msg-id | 201107131541.p6DFfo518216@momjian.us Whole thread Raw |
In response to | Re: Need help understanding pg_locks (Florian Pflug <fgp@phlo.org>) |
Responses |
Re: Need help understanding pg_locks
|
List | pgsql-hackers |
Florian Pflug wrote: > On Jul11, 2011, at 17:31 , Bruce Momjian wrote: > > Tom Lane wrote: > >> Florian Pflug <fgp@phlo.org> writes: > >>> On Jul11, 2011, at 17:11 , Tom Lane wrote: > >>>> Yeah, I think this patch is going in the wrong direction altogether. > >>>> It would be better to modify the description of virtualtransaction > >>>> and pid to say that those are the "locking" entity. > >> > >>> Hm, we already kinda of say that. Both descriptions include the phrase > >>> "... holding or awaiting this lock.". The column "mode" says > >>> "... held or desired by this process", which I guess is similar enough > >>> to make it clear that these are related. > >> > >>> Its the columns which refer to the locked object which simply say > >>> "object", and thus leave it open if that means locked or a locking. > >> > >>> Could we split that table in two parts, one for the fields referring > >>> to the locked object and one for the locking entity, or does that depart > >>> too far from the way we document other system catalogs and views? > >> > >> Then you'd have to join them, which would not be an improvement from > >> anybody's standpoint. > >> > >> Maybe we could just add a paragraph above the "pg_locks Columns" table > >> that says explicitly that virtualtransaction and pid describe the entity > >> holding or awaiting the lock, and the others describe the object being > >> locked? Any way you slice it, putting this information into the > >> per-column table is going to be repetitive. > > > > Frankly, whenever anyone says "object", they might as well call it > > "thing". It seems to be a content-less word. Maybe just replace the > > word "object" with "lock". > > I like that, as long as we make it ".. lock is/isn't *on* a ...", and not > just "... lock is/isn't a". After all, the lock very clearly isn't a > relation or xid or whatever - it's a, well, lock. > > We'd then have > OID of the database in which the lock exists, or zero if the lock is on a > shared object, or null if the lock is on a transaction ID. > > OID of the relation, or null if the lock is not on a relation or part of a > relation. > > ... > > ID of a transaction, or null if the lock is not on a transaction ID OK, I went with this wording, using "lock object is on" terminology. Applied patch attached --- adjustments welcomed. -- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml new file mode 100644 index d4a1d36..c5851af *** a/doc/src/sgml/catalogs.sgml --- b/doc/src/sgml/catalogs.sgml *************** *** 6930,6936 **** <entry> OID of the database in which the object exists, or zero if the object is a shared object, or ! null if the object is a transaction ID </entry> </row> <row> --- 6930,6936 ---- <entry> OID of the database in which the object exists, or zero if the object is a shared object, or ! null if the lock object is on a transaction ID </entry> </row> <row> *************** *** 6938,6945 **** <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry> <entry> ! OID of the relation, or null if the object is not ! a relation or part of a relation </entry> </row> <row> --- 6938,6945 ---- <entry><type>oid</type></entry> <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry> <entry> ! OID of the relation, or null if the lock object is not ! on a relation or part of a relation </entry> </row> <row> *************** *** 6947,6954 **** <entry><type>integer</type></entry> <entry></entry> <entry> ! Page number within the relation, or null if the object ! is not a tuple or relation page </entry> </row> <row> --- 6947,6954 ---- <entry><type>integer</type></entry> <entry></entry> <entry> ! Page number within the relation, or null if the lock object ! is not on a tuple or relation page </entry> </row> <row> *************** *** 6956,6962 **** <entry><type>smallint</type></entry> <entry></entry> <entry> ! Tuple number within the page, or null if the object is not a tuple </entry> </row> <row> --- 6956,6963 ---- <entry><type>smallint</type></entry> <entry></entry> <entry> ! Tuple number within the page, or null if the lock object is not ! on a tuple </entry> </row> <row> *************** *** 6964,6971 **** <entry><type>text</type></entry> <entry></entry> <entry> ! Virtual ID of a transaction, or null if the object is not a ! virtual transaction ID </entry> </row> <row> --- 6965,6972 ---- <entry><type>text</type></entry> <entry></entry> <entry> ! Virtual ID of a transaction lock, or null if the lock object is not ! on a virtual transaction ID </entry> </row> <row> *************** *** 6973,6979 **** <entry><type>xid</type></entry> <entry></entry> <entry> ! ID of a transaction, or null if the object is not a transaction ID </entry> </row> <row> --- 6974,6980 ---- <entry><type>xid</type></entry> <entry></entry> <entry> ! ID of a transaction lock, or null if the lock object is not on a transaction ID </entry> </row> <row> *************** *** 6982,6988 **** <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry> <entry> OID of the system catalog containing the object, or null if the ! object is not a general database object </entry> </row> <row> --- 6983,6989 ---- <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry> <entry> OID of the system catalog containing the object, or null if the ! lock object is not on a general database object. </entry> </row> <row> *************** *** 6991,6997 **** <entry>any OID column</entry> <entry> OID of the object within its system catalog, or null if the ! object is not a general database object. For advisory locks it is used to distinguish the two key spaces (1 for an int8 key, 2 for two int4 keys). </entry> --- 6992,6998 ---- <entry>any OID column</entry> <entry> OID of the object within its system catalog, or null if the ! lock object is not on a general database object. For advisory locks it is used to distinguish the two key spaces (1 for an int8 key, 2 for two int4 keys). </entry> *************** *** 7004,7010 **** For a table column, this is the column number (the <structfield>classid</> and <structfield>objid</> refer to the table itself). For all other object types, this column is ! zero. Null if the object is not a general database object </entry> </row> <row> --- 7005,7011 ---- For a table column, this is the column number (the <structfield>classid</> and <structfield>objid</> refer to the table itself). For all other object types, this column is ! zero. Null if the lock object is not on a general database object. </entry> </row> <row>
pgsql-hackers by date: