Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e26c539

Browse files
committed
Wrap calls to SearchSysCache and related functions using macros.
The purpose of this change is to eliminate the need for every caller of SearchSysCache, SearchSysCacheCopy, SearchSysCacheExists, GetSysCacheOid, and SearchSysCacheList to know the maximum number of allowable keys for a syscache entry (currently 4). This will make it far easier to increase the maximum number of keys in a future release should we choose to do so, and it makes the code shorter, too. Design and review by Tom Lane.
1 parent 1012492 commit e26c539

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1125
-2061
lines changed

contrib/dblink/dblink.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Darko Prenosil <Darko.Prenosil@finteh.hr>
99
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
1010
*
11-
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.88 2010/02/03 23:01:11 joe Exp $
11+
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.89 2010/02/14 18:42:11 rhaas Exp $
1212
* Copyright (c) 2001-2010, PostgreSQL Global Development Group
1313
* ALL RIGHTS RESERVED;
1414
*
@@ -2180,9 +2180,7 @@ generate_relation_name(Oid relid)
21802180
char *nspname;
21812181
char *result;
21822182

2183-
tp = SearchSysCache(RELOID,
2184-
ObjectIdGetDatum(relid),
2185-
0, 0, 0);
2183+
tp = SearchSysCache1(RELOID, ObjectIdGetDatum(relid));
21862184
if (!HeapTupleIsValid(tp))
21872185
elog(ERROR, "cache lookup failed for relation %u", relid);
21882186

src/backend/access/common/tupdesc.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.132 2010/01/22 16:40:18 rhaas Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.133 2010/02/14 18:42:12 rhaas Exp $
1212
*
1313
* NOTES
1414
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -478,9 +478,7 @@ TupleDescInitEntry(TupleDesc desc,
478478
att->attinhcount = 0;
479479
/* attacl and attoptions are not present in tupledescs */
480480

481-
tuple = SearchSysCache(TYPEOID,
482-
ObjectIdGetDatum(oidtypeid),
483-
0, 0, 0);
481+
tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(oidtypeid));
484482
if (!HeapTupleIsValid(tuple))
485483
elog(ERROR, "cache lookup failed for type %u", oidtypeid);
486484
typeForm = (Form_pg_type) GETSTRUCT(tuple);

src/backend/access/heap/heapam.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.286 2010/02/08 04:33:52 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.287 2010/02/14 18:42:12 rhaas Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -935,9 +935,7 @@ try_relation_open(Oid relationId, LOCKMODE lockmode)
935935
* Now that we have the lock, probe to see if the relation really exists
936936
* or not.
937937
*/
938-
if (!SearchSysCacheExists(RELOID,
939-
ObjectIdGetDatum(relationId),
940-
0, 0, 0))
938+
if (!SearchSysCacheExists1(RELOID, ObjectIdGetDatum(relationId)))
941939
{
942940
/* Release useless lock */
943941
if (lockmode != NoLock)

src/backend/access/transam/varsup.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.87 2010/01/02 16:57:35 momjian Exp $
9+
* $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.88 2010/02/14 18:42:12 rhaas Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -402,9 +402,7 @@ ForceTransactionIdLimitUpdate(void)
402402
if (TransactionIdFollowsOrEquals(nextXid, xidVacLimit) &&
403403
TransactionIdIsValid(xidVacLimit))
404404
return true; /* past VacLimit, don't delay updating */
405-
if (!SearchSysCacheExists(DATABASEOID,
406-
ObjectIdGetDatum(oldestXidDB),
407-
0, 0, 0))
405+
if (!SearchSysCacheExists1(DATABASEOID, ObjectIdGetDatum(oldestXidDB)))
408406
return true; /* could happen, per comments above */
409407
return false;
410408
}

0 commit comments

Comments
 (0)