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

Function sepgsql_avc_reclaim

contrib/sepgsql/uavc.c:91–125  ·  view source on GitHub ↗

* Reclaim caches recently unreferenced */

Source from the content-addressed store, hash-verified

89 * Reclaim caches recently unreferenced
90 */
91static void
92sepgsql_avc_reclaim(void)
93{
94 ListCell *cell;
95 int index;
96
97 while (avc_num_caches >= avc_threshold - AVC_NUM_RECLAIM)
98 {
99 index = avc_lru_hint;
100
101 foreach(cell, avc_slots[index])
102 {
103 avc_cache *cache = lfirst(cell);
104
105 if (!cache->hot_cache)
106 {
107 avc_slots[index]
108 = foreach_delete_current(avc_slots[index], cell);
109
110 pfree(cache->scontext);
111 pfree(cache->tcontext);
112 if (cache->ncontext)
113 pfree(cache->ncontext);
114 pfree(cache);
115
116 avc_num_caches--;
117 }
118 else
119 {
120 cache->hot_cache = false;
121 }
122 }
123 avc_lru_hint = (avc_lru_hint + 1) % AVC_NUM_SLOTS;
124 }
125}
126
127/* -------------------------------------------------------------------------
128 *

Callers 1

sepgsql_avc_computeFunction · 0.85

Calls 2

foreachFunction · 0.50
pfreeFunction · 0.50

Tested by

no test coverage detected