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

Commit90cfa49

Browse files
committed
Use varargs macro for CACHEDEBUG
Reviewed-by: Andres Freund <andres@anarazel.de>
1 parent315dcff commit90cfa49

File tree

1 file changed

+31
-45
lines changed

1 file changed

+31
-45
lines changed

‎src/backend/utils/cache/catcache.c

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,9 @@
5656
*/
5757

5858
#ifdefCACHEDEBUG
59-
#defineCACHE1_elog(a,b)elog(a,b)
60-
#defineCACHE2_elog(a,b,c)elog(a,b,c)
61-
#defineCACHE3_elog(a,b,c,d)elog(a,b,c,d)
62-
#defineCACHE4_elog(a,b,c,d,e)elog(a,b,c,d,e)
63-
#defineCACHE5_elog(a,b,c,d,e,f)elog(a,b,c,d,e,f)
64-
#defineCACHE6_elog(a,b,c,d,e,f,g)elog(a,b,c,d,e,f,g)
59+
#defineCACHE_elog(...)elog(__VA_ARGS__)
6560
#else
66-
#defineCACHE1_elog(a,b)
67-
#defineCACHE2_elog(a,b,c)
68-
#defineCACHE3_elog(a,b,c,d)
69-
#defineCACHE4_elog(a,b,c,d,e)
70-
#defineCACHE5_elog(a,b,c,d,e,f)
71-
#defineCACHE6_elog(a,b,c,d,e,f,g)
61+
#defineCACHE_elog(...)
7262
#endif
7363

7464
/* Cache management header --- pointer is NULL until created */
@@ -280,10 +270,8 @@ CatalogCacheComputeHashValue(CatCache *cache, int nkeys,
280270
uint32oneHash;
281271
CCHashFN*cc_hashfunc=cache->cc_hashfunc;
282272

283-
CACHE4_elog(DEBUG2,"CatalogCacheComputeHashValue %s %d %p",
284-
cache->cc_relname,
285-
nkeys,
286-
cache);
273+
CACHE_elog(DEBUG2,"CatalogCacheComputeHashValue %s %d %p",
274+
cache->cc_relname,nkeys,cache);
287275

288276
switch (nkeys)
289277
{
@@ -562,7 +550,7 @@ CatCacheInvalidate(CatCache *cache, uint32 hashValue)
562550
IndexhashIndex;
563551
dlist_mutable_iteriter;
564552

565-
CACHE1_elog(DEBUG2,"CatCacheInvalidate: called");
553+
CACHE_elog(DEBUG2,"CatCacheInvalidate: called");
566554

567555
/*
568556
* We don't bother to check whether the cache has finished initialization
@@ -602,7 +590,7 @@ CatCacheInvalidate(CatCache *cache, uint32 hashValue)
602590
}
603591
else
604592
CatCacheRemoveCTup(cache,ct);
605-
CACHE1_elog(DEBUG2,"CatCacheInvalidate: invalidated");
593+
CACHE_elog(DEBUG2,"CatCacheInvalidate: invalidated");
606594
#ifdefCATCACHE_STATS
607595
cache->cc_invals++;
608596
#endif
@@ -698,7 +686,7 @@ ResetCatalogCaches(void)
698686
{
699687
slist_iteriter;
700688

701-
CACHE1_elog(DEBUG2,"ResetCatalogCaches called");
689+
CACHE_elog(DEBUG2,"ResetCatalogCaches called");
702690

703691
slist_foreach(iter,&CacheHdr->ch_caches)
704692
{
@@ -707,7 +695,7 @@ ResetCatalogCaches(void)
707695
ResetCatalogCache(cache);
708696
}
709697

710-
CACHE1_elog(DEBUG2,"end of ResetCatalogCaches call");
698+
CACHE_elog(DEBUG2,"end of ResetCatalogCaches call");
711699
}
712700

713701
/*
@@ -728,7 +716,7 @@ CatalogCacheFlushCatalog(Oid catId)
728716
{
729717
slist_iteriter;
730718

731-
CACHE2_elog(DEBUG2,"CatalogCacheFlushCatalog called for %u",catId);
719+
CACHE_elog(DEBUG2,"CatalogCacheFlushCatalog called for %u",catId);
732720

733721
slist_foreach(iter,&CacheHdr->ch_caches)
734722
{
@@ -745,7 +733,7 @@ CatalogCacheFlushCatalog(Oid catId)
745733
}
746734
}
747735

748-
CACHE1_elog(DEBUG2,"end of CatalogCacheFlushCatalog call");
736+
CACHE_elog(DEBUG2,"end of CatalogCacheFlushCatalog call");
749737
}
750738

751739
/*
@@ -966,8 +954,8 @@ CatalogCacheInitializeCache(CatCache *cache)
966954

967955
table_close(relation,AccessShareLock);
968956

969-
CACHE3_elog(DEBUG2,"CatalogCacheInitializeCache: %s, %d keys",
970-
cache->cc_relname,cache->cc_nkeys);
957+
CACHE_elog(DEBUG2,"CatalogCacheInitializeCache: %s, %d keys",
958+
cache->cc_relname,cache->cc_nkeys);
971959

972960
/*
973961
* initialize cache's key information
@@ -1017,10 +1005,8 @@ CatalogCacheInitializeCache(CatCache *cache)
10171005
/* If a catcache key requires a collation, it must be C collation */
10181006
cache->cc_skey[i].sk_collation=C_COLLATION_OID;
10191007

1020-
CACHE4_elog(DEBUG2,"CatalogCacheInitializeCache %s %d %p",
1021-
cache->cc_relname,
1022-
i,
1023-
cache);
1008+
CACHE_elog(DEBUG2,"CatalogCacheInitializeCache %s %d %p",
1009+
cache->cc_relname,i,cache);
10241010
}
10251011

10261012
/*
@@ -1284,8 +1270,8 @@ SearchCatCacheInternal(CatCache *cache,
12841270
ct->refcount++;
12851271
ResourceOwnerRememberCatCacheRef(CurrentResourceOwner,&ct->tuple);
12861272

1287-
CACHE3_elog(DEBUG2,"SearchCatCache(%s): found in bucket %d",
1288-
cache->cc_relname,hashIndex);
1273+
CACHE_elog(DEBUG2,"SearchCatCache(%s): found in bucket %d",
1274+
cache->cc_relname,hashIndex);
12891275

12901276
#ifdefCATCACHE_STATS
12911277
cache->cc_hits++;
@@ -1295,8 +1281,8 @@ SearchCatCacheInternal(CatCache *cache,
12951281
}
12961282
else
12971283
{
1298-
CACHE3_elog(DEBUG2,"SearchCatCache(%s): found neg entry in bucket %d",
1299-
cache->cc_relname,hashIndex);
1284+
CACHE_elog(DEBUG2,"SearchCatCache(%s): found neg entry in bucket %d",
1285+
cache->cc_relname,hashIndex);
13001286

13011287
#ifdefCATCACHE_STATS
13021288
cache->cc_neg_hits++;
@@ -1410,10 +1396,10 @@ SearchCatCacheMiss(CatCache *cache,
14101396
hashValue,hashIndex,
14111397
true);
14121398

1413-
CACHE4_elog(DEBUG2,"SearchCatCache(%s): Contains %d/%d tuples",
1414-
cache->cc_relname,cache->cc_ntup,CacheHdr->ch_ntup);
1415-
CACHE3_elog(DEBUG2,"SearchCatCache(%s): put neg entry in bucket %d",
1416-
cache->cc_relname,hashIndex);
1399+
CACHE_elog(DEBUG2,"SearchCatCache(%s): Contains %d/%d tuples",
1400+
cache->cc_relname,cache->cc_ntup,CacheHdr->ch_ntup);
1401+
CACHE_elog(DEBUG2,"SearchCatCache(%s): put neg entry in bucket %d",
1402+
cache->cc_relname,hashIndex);
14171403

14181404
/*
14191405
* We are not returning the negative entry to the caller, so leave its
@@ -1423,10 +1409,10 @@ SearchCatCacheMiss(CatCache *cache,
14231409
returnNULL;
14241410
}
14251411

1426-
CACHE4_elog(DEBUG2,"SearchCatCache(%s): Contains %d/%d tuples",
1427-
cache->cc_relname,cache->cc_ntup,CacheHdr->ch_ntup);
1428-
CACHE3_elog(DEBUG2,"SearchCatCache(%s): put in bucket %d",
1429-
cache->cc_relname,hashIndex);
1412+
CACHE_elog(DEBUG2,"SearchCatCache(%s): Contains %d/%d tuples",
1413+
cache->cc_relname,cache->cc_ntup,CacheHdr->ch_ntup);
1414+
CACHE_elog(DEBUG2,"SearchCatCache(%s): put in bucket %d",
1415+
cache->cc_relname,hashIndex);
14301416

14311417
#ifdefCATCACHE_STATS
14321418
cache->cc_newloads++;
@@ -1597,8 +1583,8 @@ SearchCatCacheList(CatCache *cache,
15971583
cl->refcount++;
15981584
ResourceOwnerRememberCatCacheListRef(CurrentResourceOwner,cl);
15991585

1600-
CACHE2_elog(DEBUG2,"SearchCatCacheList(%s): found list",
1601-
cache->cc_relname);
1586+
CACHE_elog(DEBUG2,"SearchCatCacheList(%s): found list",
1587+
cache->cc_relname);
16021588

16031589
#ifdefCATCACHE_STATS
16041590
cache->cc_lhits++;
@@ -1777,8 +1763,8 @@ SearchCatCacheList(CatCache *cache,
17771763
cl->refcount++;
17781764
ResourceOwnerRememberCatCacheListRef(CurrentResourceOwner,cl);
17791765

1780-
CACHE3_elog(DEBUG2,"SearchCatCacheList(%s): made list of %d members",
1781-
cache->cc_relname,nmembers);
1766+
CACHE_elog(DEBUG2,"SearchCatCacheList(%s): made list of %d members",
1767+
cache->cc_relname,nmembers);
17821768

17831769
returncl;
17841770
}
@@ -2022,7 +2008,7 @@ PrepareToInvalidateCacheTuple(Relation relation,
20222008
slist_iteriter;
20232009
Oidreloid;
20242010

2025-
CACHE1_elog(DEBUG2,"PrepareToInvalidateCacheTuple: called");
2011+
CACHE_elog(DEBUG2,"PrepareToInvalidateCacheTuple: called");
20262012

20272013
/*
20282014
* sanity checks

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp