summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2025-11-17 12:26:41 +1300
committerDavid Rowley <drowley@postgresql.org>2025-11-17 12:26:41 +1300
commit9c047da51f270b25fe03ee114e1de0c64aa9cc18 (patch)
treec668c5e03c9174d5777d455d9f527a06dc497ec2 /src/backend
parente7cde9dad285acb579b189e82a57fa7b98f23a11 (diff)
Get rid of long datatype in CATCACHE_STATS enabled builds
"long" is 32 bits on Windows 64-bit. Switch to a datatype that's 64-bit on all platforms. While we're there, use an unsigned type as these fields count things that have occurred, of which it's not possible to have negative numbers of. Author: David Rowley <dgrowleyml@gmail.com> Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://postgr.es/m/CAApHDvoGFjSA3aNyVQ3ivbyc4ST=CC5L-_VjEUQ92HbE2Cxovg@mail.gmail.com
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/cache/catcache.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index b6408d46e2b..02ae7d5a831 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -461,14 +461,14 @@ static void
CatCachePrintStats(int code, Datum arg)
{
slist_iter iter;
- long cc_searches = 0;
- long cc_hits = 0;
- long cc_neg_hits = 0;
- long cc_newloads = 0;
- long cc_invals = 0;
- long cc_nlists = 0;
- long cc_lsearches = 0;
- long cc_lhits = 0;
+ uint64 cc_searches = 0;
+ uint64 cc_hits = 0;
+ uint64 cc_neg_hits = 0;
+ uint64 cc_newloads = 0;
+ uint64 cc_invals = 0;
+ uint64 cc_nlists = 0;
+ uint64 cc_lsearches = 0;
+ uint64 cc_lhits = 0;
slist_foreach(iter, &CacheHdr->ch_caches)
{
@@ -476,7 +476,10 @@ CatCachePrintStats(int code, Datum arg)
if (cache->cc_ntup == 0 && cache->cc_searches == 0)
continue; /* don't print unused caches */
- elog(DEBUG2, "catcache %s/%u: %d tup, %ld srch, %ld+%ld=%ld hits, %ld+%ld=%ld loads, %ld invals, %d lists, %ld lsrch, %ld lhits",
+ elog(DEBUG2, "catcache %s/%u: %d tup, %" PRIu64 " srch, %" PRIu64 "+%"
+ PRIu64 "=%" PRIu64 " hits, %" PRIu64 "+%" PRIu64 "=%"
+ PRIu64 " loads, %" PRIu64 " invals, %d lists, %" PRIu64
+ " lsrch, %" PRIu64 " lhits",
cache->cc_relname,
cache->cc_indexoid,
cache->cc_ntup,
@@ -500,7 +503,10 @@ CatCachePrintStats(int code, Datum arg)
cc_lsearches += cache->cc_lsearches;
cc_lhits += cache->cc_lhits;
}
- elog(DEBUG2, "catcache totals: %d tup, %ld srch, %ld+%ld=%ld hits, %ld+%ld=%ld loads, %ld invals, %ld lists, %ld lsrch, %ld lhits",
+ elog(DEBUG2, "catcache totals: %d tup, %" PRIu64 " srch, %" PRIu64 "+%"
+ PRIu64 "=%" PRIu64 " hits, %" PRIu64 "+%" PRIu64 "=%" PRIu64
+ " loads, %" PRIu64 " invals, %" PRIu64 " lists, %" PRIu64
+ " lsrch, %" PRIu64 " lhits",
CacheHdr->ch_ntup,
cc_searches,
cc_hits,