diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-29 22:28:24 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-29 22:28:24 +0000 |
commit | 3a694bb0a16fea1662f1ffd31506a72effdd4a93 (patch) | |
tree | 50bbf16b3117aada49b2709f524b3bdcf1a36815 /src/backend/utils/adt/lockfuncs.c | |
parent | 32d3b47e6f05c7137debddb68730a25fe1bb0cd6 (diff) | |
download | postgresql-3a694bb0a16fea1662f1ffd31506a72effdd4a93.tar.gz postgresql-3a694bb0a16fea1662f1ffd31506a72effdd4a93.zip |
Restructure LOCKTAG as per discussions of a couple months ago.
Essentially, we shoehorn in a lockable-object-type field by taking
a byte away from the lockmethodid, which can surely fit in one byte
instead of two. This allows less artificial definitions of all the
other fields of LOCKTAG; we can get rid of the special pg_xactlock
pseudo-relation, and also support locks on individual tuples and
general database objects (including shared objects). None of those
possibilities are actually exploited just yet, however.
I removed pg_xactlock from pg_class, but did not force initdb for
that change. At this point, relkind 's' (SPECIAL) is unused and
could be removed entirely.
Diffstat (limited to 'src/backend/utils/adt/lockfuncs.c')
-rw-r--r-- | src/backend/utils/adt/lockfuncs.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c index e6e14647daf..6878662b79f 100644 --- a/src/backend/utils/adt/lockfuncs.c +++ b/src/backend/utils/adt/lockfuncs.c @@ -6,7 +6,7 @@ * Copyright (c) 2002-2005, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/lockfuncs.c,v 1.16 2005/01/01 05:43:07 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/lockfuncs.c,v 1.17 2005/04/29 22:28:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -155,20 +155,24 @@ pg_lock_status(PG_FUNCTION_ARGS) MemSet(values, 0, sizeof(values)); MemSet(nulls, ' ', sizeof(nulls)); - if (lock->tag.relId == XactLockTableId && lock->tag.dbId == 0) + switch (lock->tag.locktag_type) { - /* Lock is for transaction ID */ - nulls[0] = 'n'; - nulls[1] = 'n'; - values[2] = TransactionIdGetDatum(lock->tag.objId.xid); - } - else - { - /* Lock is for a relation */ - values[0] = ObjectIdGetDatum(lock->tag.relId); - values[1] = ObjectIdGetDatum(lock->tag.dbId); - nulls[2] = 'n'; - + case LOCKTAG_RELATION: + case LOCKTAG_RELATION_EXTEND: + case LOCKTAG_PAGE: + case LOCKTAG_TUPLE: + values[0] = ObjectIdGetDatum(lock->tag.locktag_field2); + values[1] = ObjectIdGetDatum(lock->tag.locktag_field1); + nulls[2] = 'n'; + break; + case LOCKTAG_TRANSACTION: + nulls[0] = 'n'; + nulls[1] = 'n'; + values[2] = TransactionIdGetDatum(lock->tag.locktag_field1); + break; + default: + /* XXX Ignore all other lock types for now */ + continue; } values[3] = Int32GetDatum(proc->pid); |