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

Method CleanupThreadState

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

Source from the content-addressed store, hash-verified

1091}
1092
1093void LIRSCacheShard::CleanupThreadState(LIRSThreadState* tstate) {
1094 // evict things that need to be evicted
1095 for (LIRSHandle* e : tstate->handles_to_evict) {
1096 DCHECK_EQ(e->residency(), EVICTING);
1097 DCHECK_EQ(e->num_references(), 0);
1098 if (e->eviction_callback_) {
1099 e->eviction_callback_->EvictedEntry(e->key(), e->value());
1100 }
1101 UpdateMemTracker(-static_cast<int64_t>(e->charge()));
1102 // The eviction is done, set the residency back to NOT_RESIDENT
1103 auto state_transition = e->modify_atomic_state([] (AtomicState& cur_state) {
1104 DCHECK_EQ(cur_state.residency, EVICTING);
1105 DCHECK_EQ(cur_state.ref_count, 0);
1106 cur_state.residency = NOT_RESIDENT;
1107 });
1108 // If the handle transitioned to UNINITIALIZED before we set it to NOT_RESIDENT,
1109 // then we are responsible for freeing it.
1110 if (state_transition.before.state == UNINITIALIZED) {
1111 Free(e);
1112 }
1113 }
1114 tstate->handles_to_evict.clear();
1115 for (LIRSHandle* e : tstate->handles_to_free) {
1116 Free(e);
1117 }
1118 tstate->handles_to_free.clear();
1119}
1120
1121void LIRSCacheShard::Erase(const Slice& key, uint32_t hash) {
1122 DCHECK(initialized_);

Callers

nothing calls this directly

Calls 8

residencyMethod · 0.80
num_referencesMethod · 0.80
chargeMethod · 0.80
modify_atomic_stateMethod · 0.80
clearMethod · 0.65
EvictedEntryMethod · 0.45
keyMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected