Commit b007ef01 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5696 possible fix for drd issues, and for what seems like a typo condition


git-svn-id: file:///svn/toku/tokudb@50158 c7de825b-a66e-492c-adef-691d508d4ae1
parent 09ff3e9c
...@@ -3002,8 +3002,17 @@ int cleaner::run_cleaner(void) { ...@@ -3002,8 +3002,17 @@ int cleaner::run_cleaner(void) {
// Advance the cleaner head. // Advance the cleaner head.
long score = 0; long score = 0;
// only bother with this pair if it has no current users // only bother with this pair if it has no current users
if (m_pl->m_cleaner_head->value_rwlock.users() > 0) { if (m_pl->m_cleaner_head->value_rwlock.users() == 0) {
// cleaner_thread_rate_pair will read this. The
// contract is that to look at p->attr, you need
// either the pair's value_rwlock write-locked, or you
// need the pair_lock *and* the pair's value_rwlock
// read-locked. Here we know nobody else has it
// write-locked so it's safe, but DRD seems not to
// understand that.
TOKU_DRD_IGNORE_VAR(m_pl->m_cleaner_head->attr.cache_pressure_size);
score = cleaner_thread_rate_pair(m_pl->m_cleaner_head); score = cleaner_thread_rate_pair(m_pl->m_cleaner_head);
TOKU_DRD_STOP_IGNORING_VAR(m_pl->m_cleaner_head->attr.cache_pressure_size);
if (score > best_score) { if (score > best_score) {
best_score = score; best_score = score;
best_pair = m_pl->m_cleaner_head; best_pair = m_pl->m_cleaner_head;
...@@ -3019,7 +3028,10 @@ int cleaner::run_cleaner(void) { ...@@ -3019,7 +3028,10 @@ int cleaner::run_cleaner(void) {
else { else {
n_seen++; n_seen++;
long score = 0; long score = 0;
// See above
TOKU_DRD_IGNORE_VAR(m_pl->m_cleaner_head->attr.cache_pressure_size);
score = cleaner_thread_rate_pair(m_pl->m_cleaner_head); score = cleaner_thread_rate_pair(m_pl->m_cleaner_head);
TOKU_DRD_STOP_IGNORING_VAR(m_pl->m_cleaner_head->attr.cache_pressure_size);
if (score > best_score) { if (score > best_score) {
best_score = score; best_score = score;
// Since we found a new best pair, we need to // Since we found a new best pair, we need to
...@@ -3074,8 +3086,7 @@ int cleaner::run_cleaner(void) { ...@@ -3074,8 +3086,7 @@ int cleaner::run_cleaner(void) {
// it's theoretically possible that after writing a PAIR for checkpoint, the // it's theoretically possible that after writing a PAIR for checkpoint, the
// PAIR's heuristic tells us nothing needs to be done. It is not possible // PAIR's heuristic tells us nothing needs to be done. It is not possible
// in Dr. Noga, but unit tests verify this behavior works properly. // in Dr. Noga, but unit tests verify this behavior works properly.
if (cleaner_thread_rate_pair(best_pair) > 0) if (cleaner_thread_rate_pair(best_pair) > 0) {
{
r = best_pair->cleaner_callback(best_pair->value_data, r = best_pair->cleaner_callback(best_pair->value_data,
best_pair->key, best_pair->key,
best_pair->fullhash, best_pair->fullhash,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment