Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit69c049c

Browse files
committed
Back out LOCKTAG changes by Rod Taylor, pending code review. Sorry.
1 parente2a618f commit69c049c

File tree

10 files changed

+73
-219
lines changed

10 files changed

+73
-219
lines changed

‎src/backend/commands/typecmds.c

Lines changed: 8 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.31 2003/02/1904:02:53 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.32 2003/02/1923:41:15 momjian Exp $
1212
*
1313
* DESCRIPTION
1414
* The "DefineFoo" routines take the parse tree and pick out the
@@ -353,12 +353,6 @@ RemoveType(List *names, DropBehavior behavior)
353353
elog(ERROR,"Type \"%s\" does not exist",
354354
TypeNameToString(typename));
355355

356-
/*
357-
* Grab an exclusive lock on the type id, the SearchSysCache confirms
358-
* the type still exists after locking
359-
*/
360-
LockObject(typeoid,RelOid_pg_type,AccessExclusiveLock);
361-
362356
tup=SearchSysCache(TYPEOID,
363357
ObjectIdGetDatum(typeoid),
364358
0,0,0);
@@ -382,9 +376,6 @@ RemoveType(List *names, DropBehavior behavior)
382376
object.objectSubId=0;
383377

384378
performDeletion(&object,behavior);
385-
386-
/* Hold the lock until the end of the transaction */
387-
UnlockObject(typeoid,RelOid_pg_type,NoLock);
388379
}
389380

390381

@@ -689,7 +680,7 @@ void
689680
RemoveDomain(List*names,DropBehaviorbehavior)
690681
{
691682
TypeName*typename;
692-
Oiddomainoid;
683+
Oidtypeoid;
693684
HeapTupletup;
694685
chartyptype;
695686
ObjectAddressobject;
@@ -701,26 +692,20 @@ RemoveDomain(List *names, DropBehavior behavior)
701692
typename->arrayBounds=NIL;
702693

703694
/* Use LookupTypeName here so that shell types can be removed. */
704-
domainoid=LookupTypeName(typename);
705-
if (!OidIsValid(domainoid))
695+
typeoid=LookupTypeName(typename);
696+
if (!OidIsValid(typeoid))
706697
elog(ERROR,"Type \"%s\" does not exist",
707698
TypeNameToString(typename));
708699

709-
/*
710-
* Lock the domain. The SearchSysCache confirms the domain still exists
711-
* after locking
712-
*/
713-
LockObject(domainoid,RelOid_pg_type,AccessExclusiveLock);
714-
715700
tup=SearchSysCache(TYPEOID,
716-
ObjectIdGetDatum(domainoid),
701+
ObjectIdGetDatum(typeoid),
717702
0,0,0);
718703
if (!HeapTupleIsValid(tup))
719704
elog(ERROR,"RemoveDomain: type \"%s\" does not exist",
720705
TypeNameToString(typename));
721706

722707
/* Permission check: must own type or its namespace */
723-
if (!pg_type_ownercheck(domainoid,GetUserId())&&
708+
if (!pg_type_ownercheck(typeoid,GetUserId())&&
724709
!pg_namespace_ownercheck(((Form_pg_type)GETSTRUCT(tup))->typnamespace,
725710
GetUserId()))
726711
aclcheck_error(ACLCHECK_NOT_OWNER,TypeNameToString(typename));
@@ -738,13 +723,10 @@ RemoveDomain(List *names, DropBehavior behavior)
738723
* Do the deletion
739724
*/
740725
object.classId=RelOid_pg_type;
741-
object.objectId=domainoid;
726+
object.objectId=typeoid;
742727
object.objectSubId=0;
743728

744729
performDeletion(&object,behavior);
745-
746-
/* Hold the lock until the end of the transaction */
747-
UnlockObject(domainoid,RelOid_pg_type,NoLock);
748730
}
749731

750732

@@ -959,12 +941,6 @@ AlterDomainDefault(List *names, Node *defaultRaw)
959941
elog(ERROR,"Type \"%s\" does not exist",
960942
TypeNameToString(typename));
961943

962-
/*
963-
* Lock the domain. The SearchSysCacheCopy confirms the type
964-
* still exists after locking
965-
*/
966-
LockObject(domainoid,RelOid_pg_type,AccessExclusiveLock);
967-
968944
tup=SearchSysCacheCopy(TYPEOID,
969945
ObjectIdGetDatum(domainoid),
970946
0,0,0);
@@ -1049,7 +1025,6 @@ AlterDomainDefault(List *names, Node *defaultRaw)
10491025
/* Clean up */
10501026
heap_close(rel,NoLock);
10511027
heap_freetuple(newtuple);
1052-
UnlockObject(domainoid,RelOid_pg_type,NoLock);
10531028
};
10541029

10551030
/*
@@ -1081,12 +1056,6 @@ AlterDomainNotNull(List *names, bool notNull)
10811056
elog(ERROR,"Type \"%s\" does not exist",
10821057
TypeNameToString(typename));
10831058

1084-
/*
1085-
* Lock the domain. The SearchSysCacheCopy confirms the domain
1086-
* still exists after locking
1087-
*/
1088-
LockObject(domainoid,RelOid_pg_type,AccessExclusiveLock);
1089-
10901059
tup=SearchSysCacheCopy(TYPEOID,
10911060
ObjectIdGetDatum(domainoid),
10921061
0,0,0);
@@ -1168,7 +1137,6 @@ AlterDomainNotNull(List *names, bool notNull)
11681137
/* Clean up */
11691138
heap_freetuple(tup);
11701139
heap_close(typrel,RowExclusiveLock);
1171-
UnlockObject(domainoid,RelOid_pg_type,NoLock);
11721140
}
11731141

11741142
/*
@@ -1204,12 +1172,6 @@ AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior beha
12041172
elog(ERROR,"Type \"%s\" does not exist",
12051173
TypeNameToString(typename));
12061174

1207-
/*
1208-
* Lock the domain. The SearchSysCacheCopy confirms the type still
1209-
* exists after locking.
1210-
*/
1211-
LockObject(domainoid,RelOid_pg_type,AccessExclusiveLock);
1212-
12131175
tup=SearchSysCacheCopy(TYPEOID,
12141176
ObjectIdGetDatum(domainoid),
12151177
0,0,0);
@@ -1257,7 +1219,6 @@ AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior beha
12571219
heap_close(conrel,RowExclusiveLock);
12581220

12591221
heap_close(rel,NoLock);
1260-
UnlockObject(domainoid,RelOid_pg_type,NoLock);
12611222
};
12621223

12631224
/*
@@ -1298,12 +1259,6 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
12981259
elog(ERROR,"Type \"%s\" does not exist",
12991260
TypeNameToString(typename));
13001261

1301-
/*
1302-
* Lock the domain. The SearchSysCacheCopy confirms the domain
1303-
* still exists after locking.
1304-
*/
1305-
LockObject(domainoid,RelOid_pg_type,AccessExclusiveLock);
1306-
13071262
tup=SearchSysCacheCopy(TYPEOID,
13081263
ObjectIdGetDatum(domainoid),
13091264
0,0,0);
@@ -1438,7 +1393,6 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
14381393

14391394
/* Clean up */
14401395
heap_close(typrel,RowExclusiveLock);
1441-
UnlockObject(domainoid,RelOid_pg_type,NoLock);
14421396
}
14431397

14441398
/*
@@ -1742,10 +1696,7 @@ GetDomainConstraints(Oid typeOid)
17421696
Form_pg_typetypTup;
17431697
ScanKeyDatakey[1];
17441698
SysScanDescscan;
1745-
1746-
/* Lock the domain */
1747-
LockObject(typeOid,RelOid_pg_type,AccessShareLock);
1748-
1699+
17491700
tup=SearchSysCache(TYPEOID,
17501701
ObjectIdGetDatum(typeOid),
17511702
0,0,0);
@@ -1873,12 +1824,6 @@ AlterTypeOwner(List *names, AclId newOwnerSysId)
18731824
elog(ERROR,"Type \"%s\" does not exist",
18741825
TypeNameToString(typename));
18751826

1876-
/*
1877-
* Lock the type. The SearchSysCacheCopy serves to confirm the
1878-
* domain still exists after locking
1879-
*/
1880-
LockObject(typeOid,RelOid_pg_type,AccessExclusiveLock);
1881-
18821827
tup=SearchSysCacheCopy(TYPEOID,
18831828
ObjectIdGetDatum(typeOid),
18841829
0,0,0);
@@ -1901,5 +1846,4 @@ AlterTypeOwner(List *names, AclId newOwnerSysId)
19011846

19021847
/* Clean up */
19031848
heap_close(rel,RowExclusiveLock);
1904-
UnlockObject(typeOid,RelOid_pg_type,NoLock);
19051849
}

‎src/backend/parser/parse_type.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.52 2003/02/1904:02:53 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.53 2003/02/1923:41:15 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -23,7 +23,6 @@
2323
#include"parser/parser.h"
2424
#include"parser/parse_expr.h"
2525
#include"parser/parse_type.h"
26-
#include"storage/lmgr.h"
2726
#include"utils/builtins.h"
2827
#include"utils/lsyscache.h"
2928
#include"utils/syscache.h"
@@ -128,15 +127,6 @@ LookupTypeName(const TypeName *typename)
128127
}
129128
}
130129

131-
/*
132-
* Lock the type as having been read for remainder of the transaction
133-
*
134-
* XXX: There is a small time between the above and now when the type
135-
*could dissapear. We *should* recheck to confirm the type still
136-
*exists, but won't for speed.
137-
*/
138-
LockObject(restype,RelOid_pg_type,AccessShareLock);
139-
140130
returnrestype;
141131
}
142132

‎src/backend/storage/lmgr/deadlock.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.18 2003/02/1904:02:53 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.19 2003/02/1923:41:15 momjian Exp $
1616
*
1717
*Interface:
1818
*
@@ -855,25 +855,22 @@ DeadLockReport(void)
855855
else
856856
nextpid=deadlockDetails[0].pid;
857857

858-
if (info->locktag.objId==InvalidOid
859-
&&info->locktag.classId==XactLockTableId
860-
&&info->locktag.dbId==InvalidOid)
858+
if (info->locktag.relId==XactLockTableId&&info->locktag.dbId==0)
861859
{
862860
/* Lock is for transaction ID */
863861
elog(NOTICE,"Proc %d waits for %s on transaction %u; blocked by %d",
864862
info->pid,
865863
GetLockmodeName(info->lockmode),
866-
info->locktag.objsubId.xid,
864+
info->locktag.objId.xid,
867865
nextpid);
868866
}
869867
else
870868
{
871869
/* Lock is for a relation */
872-
elog(NOTICE,"Proc %d waits for %s onobject %u class %u database %u; blocked by %d",
870+
elog(NOTICE,"Proc %d waits for %s onrelation %u database %u; blocked by %d",
873871
info->pid,
874872
GetLockmodeName(info->lockmode),
875-
info->locktag.objId,
876-
info->locktag.classId,
873+
info->locktag.relId,
877874
info->locktag.dbId,
878875
nextpid);
879876
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp