MCPcopy Create free account
hub / github.com/apache/impala / Release

Method Release

be/src/util/cache/lirs-cache.cc:997–1021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

995}
996
997void LIRSCacheShard::Release(HandleBase* handle) {
998 DCHECK(initialized_);
999 LIRSHandle* e = static_cast<LIRSHandle*>(handle);
1000 LIRSThreadState tstate;
1001
1002 auto state_transition = e->modify_atomic_state([] (AtomicState& cur_state) {
1003 DCHECK_GT(cur_state.ref_count, 0);
1004 --cur_state.ref_count;
1005 if (cur_state.ref_count == 0) {
1006 if (cur_state.state == TOMBSTONE || cur_state.state == UNINITIALIZED) {
1007 // An entry cannot be evicted until the reference count is zero, so this
1008 // must still be resident. In this circumstance, this thread must do the
1009 // eviction.
1010 DCHECK_EQ(cur_state.residency, RESIDENT);
1011 cur_state.residency = EVICTING;
1012 }
1013 }
1014 });
1015 // If we set the residency to EVICTING, then do the eviction. If this is UNINITIALIZED,
1016 // this will also free it.
1017 if (state_transition.after.residency == EVICTING) {
1018 tstate.handles_to_evict.push_back(e);
1019 CleanupThreadState(&tstate);
1020 }
1021}
1022
1023HandleBase* LIRSCacheShard::Insert(HandleBase* e_in,
1024 Cache::EvictionCallback *eviction_callback) {

Callers

nothing calls this directly

Calls 2

modify_atomic_stateMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected