MCPcopy Create free account
hub / github.com/apache/cloudberry / CatalogCacheComputeHashValue

Function CatalogCacheComputeHashValue

src/backend/utils/cache/catcache.c:270–312  ·  view source on GitHub ↗

* CatalogCacheComputeHashValue * * Compute the hash value associated with a given set of lookup keys */

Source from the content-addressed store, hash-verified

268 * Compute the hash value associated with a given set of lookup keys
269 */
270static uint32
271CatalogCacheComputeHashValue(CatCache *cache, int nkeys,
272 Datum v1, Datum v2, Datum v3, Datum v4)
273{
274 uint32 hashValue = 0;
275 uint32 oneHash;
276 CCHashFN *cc_hashfunc = cache->cc_hashfunc;
277
278 CACHE_elog(DEBUG2, "CatalogCacheComputeHashValue %s %d %p",
279 cache->cc_relname, nkeys, cache);
280
281 switch (nkeys)
282 {
283 case 4:
284 oneHash = (cc_hashfunc[3]) (v4);
285
286 hashValue ^= oneHash << 24;
287 hashValue ^= oneHash >> 8;
288 /* FALLTHROUGH */
289 case 3:
290 oneHash = (cc_hashfunc[2]) (v3);
291
292 hashValue ^= oneHash << 16;
293 hashValue ^= oneHash >> 16;
294 /* FALLTHROUGH */
295 case 2:
296 oneHash = (cc_hashfunc[1]) (v2);
297
298 hashValue ^= oneHash << 8;
299 hashValue ^= oneHash >> 24;
300 /* FALLTHROUGH */
301 case 1:
302 oneHash = (cc_hashfunc[0]) (v1);
303
304 hashValue ^= oneHash;
305 break;
306 default:
307 elog(FATAL, "wrong number of hash keys: %d", nkeys);
308 break;
309 }
310
311 return hashValue;
312}
313
314/*
315 * CatalogCacheComputeTupleHashValue

Callers 4

SearchCatCacheInternalFunction · 0.85
GetCatCacheHashValueFunction · 0.85
SearchCatCacheListFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected