diff --git a/ft/cachetable.cc b/ft/cachetable.cc index b895ee869bc513019ed9b05a536138dfa650af89..59ac82d5b1d9998e7fc5fd401dcb3a722c7b2b42 100644 --- a/ft/cachetable.cc +++ b/ft/cachetable.cc @@ -2967,12 +2967,15 @@ int cleaner::run_cleaner(void) { if (best_pair && m_pl->m_cleaner_head->mutex == best_pair->mutex) { // Advance the cleaner head. long score = 0; - score = cleaner_thread_rate_pair(m_pl->m_cleaner_head); - if (score > best_score) { - best_score = score; - best_pair = m_pl->m_cleaner_head; + // only bother with this pair if it has no current users + if (m_pl->m_cleaner_head->value_rwlock.users() > 0) { + score = cleaner_thread_rate_pair(m_pl->m_cleaner_head); + if (score > best_score) { + best_score = score; + best_pair = m_pl->m_cleaner_head; + } + m_pl->m_cleaner_head = m_pl->m_cleaner_head->clock_next; } - m_pl->m_cleaner_head = m_pl->m_cleaner_head->clock_next; continue; } pair_lock(m_pl->m_cleaner_head);