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

Method MoveToRecencyListBack

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

Source from the content-addressed store, hash-verified

617}
618
619void LIRSCacheShard::MoveToRecencyListBack(LIRSThreadState* tstate, LIRSHandle *e,
620 bool expected_in_list) {
621 // Remove and add to the back of the list as the most recent element
622 bool in_list = e->recency_list_hook_.is_linked();
623 CHECK(!expected_in_list || in_list);
624 bool need_trim = false;
625 if (in_list) {
626 // Is this the oldest entry in the list (the front)?
627 LIRSHandle* oldest = &recency_list_.front();
628 // Invariant: the oldest entry in the list is always a protected entry
629 CHECK_EQ(oldest->state(), PROTECTED);
630 if (oldest == e) {
631 need_trim = true;
632 }
633 recency_list_.erase(recency_list_.iterator_to(*e));
634 }
635 recency_list_.push_back(*e);
636 if (need_trim) {
637 TrimRecencyList(tstate);
638 }
639}
640
641void LIRSCacheShard::AddToUnprotectedList(LIRSHandle* e) {
642 DCHECK(!e->unprotected_tombstone_list_hook_.is_linked());

Callers

nothing calls this directly

Calls 4

frontMethod · 0.80
eraseMethod · 0.80
push_backMethod · 0.80
stateMethod · 0.45

Tested by

no test coverage detected