Commit 90cfa490 authored by Peter Eisentraut's avatar Peter Eisentraut

Use varargs macro for CACHEDEBUG

Reviewed-by: default avatarAndres Freund <andres@anarazel.de>
parent 315dcffb
...@@ -56,19 +56,9 @@ ...@@ -56,19 +56,9 @@
*/ */
#ifdef CACHEDEBUG #ifdef CACHEDEBUG
#define CACHE1_elog(a,b) elog(a,b) #define CACHE_elog(...) elog(__VA_ARGS__)
#define CACHE2_elog(a,b,c) elog(a,b,c)
#define CACHE3_elog(a,b,c,d) elog(a,b,c,d)
#define CACHE4_elog(a,b,c,d,e) elog(a,b,c,d,e)
#define CACHE5_elog(a,b,c,d,e,f) elog(a,b,c,d,e,f)
#define CACHE6_elog(a,b,c,d,e,f,g) elog(a,b,c,d,e,f,g)
#else #else
#define CACHE1_elog(a,b) #define CACHE_elog(...)
#define CACHE2_elog(a,b,c)
#define CACHE3_elog(a,b,c,d)
#define CACHE4_elog(a,b,c,d,e)
#define CACHE5_elog(a,b,c,d,e,f)
#define CACHE6_elog(a,b,c,d,e,f,g)
#endif #endif
/* Cache management header --- pointer is NULL until created */ /* Cache management header --- pointer is NULL until created */
...@@ -280,10 +270,8 @@ CatalogCacheComputeHashValue(CatCache *cache, int nkeys, ...@@ -280,10 +270,8 @@ CatalogCacheComputeHashValue(CatCache *cache, int nkeys,
uint32 oneHash; uint32 oneHash;
CCHashFN *cc_hashfunc = cache->cc_hashfunc; CCHashFN *cc_hashfunc = cache->cc_hashfunc;
CACHE4_elog(DEBUG2, "CatalogCacheComputeHashValue %s %d %p", CACHE_elog(DEBUG2, "CatalogCacheComputeHashValue %s %d %p",
cache->cc_relname, cache->cc_relname, nkeys, cache);
nkeys,
cache);
switch (nkeys) switch (nkeys)
{ {
...@@ -562,7 +550,7 @@ CatCacheInvalidate(CatCache *cache, uint32 hashValue) ...@@ -562,7 +550,7 @@ CatCacheInvalidate(CatCache *cache, uint32 hashValue)
Index hashIndex; Index hashIndex;
dlist_mutable_iter iter; dlist_mutable_iter iter;
CACHE1_elog(DEBUG2, "CatCacheInvalidate: called"); CACHE_elog(DEBUG2, "CatCacheInvalidate: called");
/* /*
* We don't bother to check whether the cache has finished initialization * We don't bother to check whether the cache has finished initialization
...@@ -602,7 +590,7 @@ CatCacheInvalidate(CatCache *cache, uint32 hashValue) ...@@ -602,7 +590,7 @@ CatCacheInvalidate(CatCache *cache, uint32 hashValue)
} }
else else
CatCacheRemoveCTup(cache, ct); CatCacheRemoveCTup(cache, ct);
CACHE1_elog(DEBUG2, "CatCacheInvalidate: invalidated"); CACHE_elog(DEBUG2, "CatCacheInvalidate: invalidated");
#ifdef CATCACHE_STATS #ifdef CATCACHE_STATS
cache->cc_invals++; cache->cc_invals++;
#endif #endif
...@@ -698,7 +686,7 @@ ResetCatalogCaches(void) ...@@ -698,7 +686,7 @@ ResetCatalogCaches(void)
{ {
slist_iter iter; slist_iter iter;
CACHE1_elog(DEBUG2, "ResetCatalogCaches called"); CACHE_elog(DEBUG2, "ResetCatalogCaches called");
slist_foreach(iter, &CacheHdr->ch_caches) slist_foreach(iter, &CacheHdr->ch_caches)
{ {
...@@ -707,7 +695,7 @@ ResetCatalogCaches(void) ...@@ -707,7 +695,7 @@ ResetCatalogCaches(void)
ResetCatalogCache(cache); ResetCatalogCache(cache);
} }
CACHE1_elog(DEBUG2, "end of ResetCatalogCaches call"); CACHE_elog(DEBUG2, "end of ResetCatalogCaches call");
} }
/* /*
...@@ -728,7 +716,7 @@ CatalogCacheFlushCatalog(Oid catId) ...@@ -728,7 +716,7 @@ CatalogCacheFlushCatalog(Oid catId)
{ {
slist_iter iter; slist_iter iter;
CACHE2_elog(DEBUG2, "CatalogCacheFlushCatalog called for %u", catId); CACHE_elog(DEBUG2, "CatalogCacheFlushCatalog called for %u", catId);
slist_foreach(iter, &CacheHdr->ch_caches) slist_foreach(iter, &CacheHdr->ch_caches)
{ {
...@@ -745,7 +733,7 @@ CatalogCacheFlushCatalog(Oid catId) ...@@ -745,7 +733,7 @@ CatalogCacheFlushCatalog(Oid catId)
} }
} }
CACHE1_elog(DEBUG2, "end of CatalogCacheFlushCatalog call"); CACHE_elog(DEBUG2, "end of CatalogCacheFlushCatalog call");
} }
/* /*
...@@ -966,7 +954,7 @@ CatalogCacheInitializeCache(CatCache *cache) ...@@ -966,7 +954,7 @@ CatalogCacheInitializeCache(CatCache *cache)
table_close(relation, AccessShareLock); table_close(relation, AccessShareLock);
CACHE3_elog(DEBUG2, "CatalogCacheInitializeCache: %s, %d keys", CACHE_elog(DEBUG2, "CatalogCacheInitializeCache: %s, %d keys",
cache->cc_relname, cache->cc_nkeys); cache->cc_relname, cache->cc_nkeys);
/* /*
...@@ -1017,10 +1005,8 @@ CatalogCacheInitializeCache(CatCache *cache) ...@@ -1017,10 +1005,8 @@ CatalogCacheInitializeCache(CatCache *cache)
/* If a catcache key requires a collation, it must be C collation */ /* If a catcache key requires a collation, it must be C collation */
cache->cc_skey[i].sk_collation = C_COLLATION_OID; cache->cc_skey[i].sk_collation = C_COLLATION_OID;
CACHE4_elog(DEBUG2, "CatalogCacheInitializeCache %s %d %p", CACHE_elog(DEBUG2, "CatalogCacheInitializeCache %s %d %p",
cache->cc_relname, cache->cc_relname, i, cache);
i,
cache);
} }
/* /*
...@@ -1284,7 +1270,7 @@ SearchCatCacheInternal(CatCache *cache, ...@@ -1284,7 +1270,7 @@ SearchCatCacheInternal(CatCache *cache,
ct->refcount++; ct->refcount++;
ResourceOwnerRememberCatCacheRef(CurrentResourceOwner, &ct->tuple); ResourceOwnerRememberCatCacheRef(CurrentResourceOwner, &ct->tuple);
CACHE3_elog(DEBUG2, "SearchCatCache(%s): found in bucket %d", CACHE_elog(DEBUG2, "SearchCatCache(%s): found in bucket %d",
cache->cc_relname, hashIndex); cache->cc_relname, hashIndex);
#ifdef CATCACHE_STATS #ifdef CATCACHE_STATS
...@@ -1295,7 +1281,7 @@ SearchCatCacheInternal(CatCache *cache, ...@@ -1295,7 +1281,7 @@ SearchCatCacheInternal(CatCache *cache,
} }
else else
{ {
CACHE3_elog(DEBUG2, "SearchCatCache(%s): found neg entry in bucket %d", CACHE_elog(DEBUG2, "SearchCatCache(%s): found neg entry in bucket %d",
cache->cc_relname, hashIndex); cache->cc_relname, hashIndex);
#ifdef CATCACHE_STATS #ifdef CATCACHE_STATS
...@@ -1410,9 +1396,9 @@ SearchCatCacheMiss(CatCache *cache, ...@@ -1410,9 +1396,9 @@ SearchCatCacheMiss(CatCache *cache,
hashValue, hashIndex, hashValue, hashIndex,
true); true);
CACHE4_elog(DEBUG2, "SearchCatCache(%s): Contains %d/%d tuples", CACHE_elog(DEBUG2, "SearchCatCache(%s): Contains %d/%d tuples",
cache->cc_relname, cache->cc_ntup, CacheHdr->ch_ntup); cache->cc_relname, cache->cc_ntup, CacheHdr->ch_ntup);
CACHE3_elog(DEBUG2, "SearchCatCache(%s): put neg entry in bucket %d", CACHE_elog(DEBUG2, "SearchCatCache(%s): put neg entry in bucket %d",
cache->cc_relname, hashIndex); cache->cc_relname, hashIndex);
/* /*
...@@ -1423,9 +1409,9 @@ SearchCatCacheMiss(CatCache *cache, ...@@ -1423,9 +1409,9 @@ SearchCatCacheMiss(CatCache *cache,
return NULL; return NULL;
} }
CACHE4_elog(DEBUG2, "SearchCatCache(%s): Contains %d/%d tuples", CACHE_elog(DEBUG2, "SearchCatCache(%s): Contains %d/%d tuples",
cache->cc_relname, cache->cc_ntup, CacheHdr->ch_ntup); cache->cc_relname, cache->cc_ntup, CacheHdr->ch_ntup);
CACHE3_elog(DEBUG2, "SearchCatCache(%s): put in bucket %d", CACHE_elog(DEBUG2, "SearchCatCache(%s): put in bucket %d",
cache->cc_relname, hashIndex); cache->cc_relname, hashIndex);
#ifdef CATCACHE_STATS #ifdef CATCACHE_STATS
...@@ -1597,7 +1583,7 @@ SearchCatCacheList(CatCache *cache, ...@@ -1597,7 +1583,7 @@ SearchCatCacheList(CatCache *cache,
cl->refcount++; cl->refcount++;
ResourceOwnerRememberCatCacheListRef(CurrentResourceOwner, cl); ResourceOwnerRememberCatCacheListRef(CurrentResourceOwner, cl);
CACHE2_elog(DEBUG2, "SearchCatCacheList(%s): found list", CACHE_elog(DEBUG2, "SearchCatCacheList(%s): found list",
cache->cc_relname); cache->cc_relname);
#ifdef CATCACHE_STATS #ifdef CATCACHE_STATS
...@@ -1777,7 +1763,7 @@ SearchCatCacheList(CatCache *cache, ...@@ -1777,7 +1763,7 @@ SearchCatCacheList(CatCache *cache,
cl->refcount++; cl->refcount++;
ResourceOwnerRememberCatCacheListRef(CurrentResourceOwner, cl); ResourceOwnerRememberCatCacheListRef(CurrentResourceOwner, cl);
CACHE3_elog(DEBUG2, "SearchCatCacheList(%s): made list of %d members", CACHE_elog(DEBUG2, "SearchCatCacheList(%s): made list of %d members",
cache->cc_relname, nmembers); cache->cc_relname, nmembers);
return cl; return cl;
...@@ -2022,7 +2008,7 @@ PrepareToInvalidateCacheTuple(Relation relation, ...@@ -2022,7 +2008,7 @@ PrepareToInvalidateCacheTuple(Relation relation,
slist_iter iter; slist_iter iter;
Oid reloid; Oid reloid;
CACHE1_elog(DEBUG2, "PrepareToInvalidateCacheTuple: called"); CACHE_elog(DEBUG2, "PrepareToInvalidateCacheTuple: called");
/* /*
* sanity checks * sanity checks
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment