lmgr.c:DescribeLockTag was never taught about virtual xids, per Greg Stark.
Also a couple of minor tweaks to try to future-proof the code a bit better against future locktag additions.
This commit is contained in:
parent
bbd3bdba3e
commit
da3df47c84
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lmgr.c,v 1.95 2008/01/01 19:45:52 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lmgr.c,v 1.96 2008/01/08 23:18:50 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -672,7 +672,7 @@ UnlockSharedObject(Oid classid, Oid objid, uint16 objsubid,
|
||||
bool
|
||||
LockTagIsTemp(const LOCKTAG *tag)
|
||||
{
|
||||
switch (tag->locktag_type)
|
||||
switch ((LockTagType) tag->locktag_type)
|
||||
{
|
||||
case LOCKTAG_RELATION:
|
||||
case LOCKTAG_RELATION_EXTEND:
|
||||
@ -686,6 +686,7 @@ LockTagIsTemp(const LOCKTAG *tag)
|
||||
return true;
|
||||
break;
|
||||
case LOCKTAG_TRANSACTION:
|
||||
case LOCKTAG_VIRTUALTRANSACTION:
|
||||
/* there are no temp transactions */
|
||||
break;
|
||||
case LOCKTAG_OBJECT:
|
||||
@ -710,7 +711,7 @@ LockTagIsTemp(const LOCKTAG *tag)
|
||||
void
|
||||
DescribeLockTag(StringInfo buf, const LOCKTAG *tag)
|
||||
{
|
||||
switch (tag->locktag_type)
|
||||
switch ((LockTagType) tag->locktag_type)
|
||||
{
|
||||
case LOCKTAG_RELATION:
|
||||
appendStringInfo(buf,
|
||||
@ -744,6 +745,12 @@ DescribeLockTag(StringInfo buf, const LOCKTAG *tag)
|
||||
_("transaction %u"),
|
||||
tag->locktag_field1);
|
||||
break;
|
||||
case LOCKTAG_VIRTUALTRANSACTION:
|
||||
appendStringInfo(buf,
|
||||
_("virtual transaction %d/%u"),
|
||||
tag->locktag_field1,
|
||||
tag->locktag_field2);
|
||||
break;
|
||||
case LOCKTAG_OBJECT:
|
||||
appendStringInfo(buf,
|
||||
_("object %u of class %u of database %u"),
|
||||
@ -770,7 +777,7 @@ DescribeLockTag(StringInfo buf, const LOCKTAG *tag)
|
||||
default:
|
||||
appendStringInfo(buf,
|
||||
_("unrecognized locktag type %d"),
|
||||
tag->locktag_type);
|
||||
(int) tag->locktag_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Copyright (c) 2002-2008, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/lockfuncs.c,v 1.31 2008/01/01 19:45:52 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/lockfuncs.c,v 1.32 2008/01/08 23:18:51 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -206,7 +206,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
|
||||
MemSet(values, 0, sizeof(values));
|
||||
MemSet(nulls, ' ', sizeof(nulls));
|
||||
|
||||
if (lock->tag.locktag_type <= LOCKTAG_ADVISORY)
|
||||
if (lock->tag.locktag_type <= LOCKTAG_LAST_TYPE)
|
||||
locktypename = LockTagTypeNames[lock->tag.locktag_type];
|
||||
else
|
||||
{
|
||||
@ -217,7 +217,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
|
||||
values[0] = DirectFunctionCall1(textin,
|
||||
CStringGetDatum(locktypename));
|
||||
|
||||
switch (lock->tag.locktag_type)
|
||||
switch ((LockTagType) lock->tag.locktag_type)
|
||||
{
|
||||
case LOCKTAG_RELATION:
|
||||
case LOCKTAG_RELATION_EXTEND:
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.111 2008/01/01 19:45:59 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/storage/lock.h,v 1.112 2008/01/08 23:18:51 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -186,6 +186,8 @@ typedef enum LockTagType
|
||||
LOCKTAG_ADVISORY /* advisory user locks */
|
||||
} LockTagType;
|
||||
|
||||
#define LOCKTAG_LAST_TYPE LOCKTAG_ADVISORY
|
||||
|
||||
/*
|
||||
* The LOCKTAG struct is defined with malice aforethought to fit into 16
|
||||
* bytes with no padding. Note that this would need adjustment if we were
|
||||
|
Loading…
Reference in New Issue
Block a user