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

Function CatCacheRemoveCTup

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

* CatCacheRemoveCTup * * Unlink and delete the given cache entry * * NB: if it is a member of a CatCList, the CatCList is deleted too. * Both the cache entry and the list had better have zero refcount. */

Source from the content-addressed store, hash-verified

455 * Both the cache entry and the list had better have zero refcount.
456 */
457static void
458CatCacheRemoveCTup(CatCache *cache, CatCTup *ct)
459{
460 Assert(ct->refcount == 0);
461 Assert(ct->my_cache == cache);
462
463 if (ct->c_list)
464 {
465 /*
466 * The cleanest way to handle this is to call CatCacheRemoveCList,
467 * which will recurse back to me, and the recursive call will do the
468 * work. Set the "dead" flag to make sure it does recurse.
469 */
470 ct->dead = true;
471 CatCacheRemoveCList(cache, ct->c_list);
472 return; /* nothing left to do */
473 }
474
475 /* delink from linked list */
476 dlist_delete(&ct->cache_elem);
477
478 /*
479 * Free keys when we're dealing with a negative entry, normal entries just
480 * point into tuple, allocated together with the CatCTup.
481 */
482 if (ct->negative)
483 CatCacheFreeKeys(cache->cc_tupdesc, cache->cc_nkeys,
484 cache->cc_keyno, ct->keys);
485
486 pfree(ct);
487
488 --cache->cc_ntup;
489 --CacheHdr->ch_ntup;
490}
491
492/*
493 * CatCacheRemoveCList

Callers 5

CatCacheRemoveCListFunction · 0.85
CatCacheInvalidateFunction · 0.85
ResetCatalogCacheFunction · 0.85
ReleaseCatCacheFunction · 0.85
SearchCatCacheListFunction · 0.85

Calls 4

CatCacheRemoveCListFunction · 0.85
dlist_deleteFunction · 0.85
CatCacheFreeKeysFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected