Commit f73d5490 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

closes #5421, fix asserts in cachetable

git-svn-id: file:///svn/toku/tokudb@47500 c7de825b-a66e-492c-adef-691d508d4ae1
parent c1c45c65
...@@ -3616,6 +3616,7 @@ void evictor::init(long _size_limit, pair_list* _pl, KIBBUTZ _kibbutz, uint32_t ...@@ -3616,6 +3616,7 @@ void evictor::init(long _size_limit, pair_list* _pl, KIBBUTZ _kibbutz, uint32_t
// //
void evictor::destroy() { void evictor::destroy() {
assert(m_size_evicting == 0); assert(m_size_evicting == 0);
assert(m_size_current == 0);
// Stop the eviction thread. // Stop the eviction thread.
toku_mutex_lock(&m_ev_thread_lock); toku_mutex_lock(&m_ev_thread_lock);
...@@ -3666,7 +3667,6 @@ void evictor::remove_pair_attr(PAIR_ATTR attr) { ...@@ -3666,7 +3667,6 @@ void evictor::remove_pair_attr(PAIR_ATTR attr) {
increment_partitioned_counter(m_size_leaf, 0 - attr.leaf_size); increment_partitioned_counter(m_size_leaf, 0 - attr.leaf_size);
increment_partitioned_counter(m_size_rollback, 0 - attr.rollback_size); increment_partitioned_counter(m_size_rollback, 0 - attr.rollback_size);
increment_partitioned_counter(m_size_cachepressure, 0 - attr.cache_pressure_size); increment_partitioned_counter(m_size_cachepressure, 0 - attr.cache_pressure_size);
assert(m_size_current >= 0);
} }
// //
......
...@@ -130,7 +130,8 @@ void evictor_unit_test::verify_ev_counts() { ...@@ -130,7 +130,8 @@ void evictor_unit_test::verify_ev_counts() {
assert(read_partitioned_counter(m_ev.m_size_nonleaf) == 1); assert(read_partitioned_counter(m_ev.m_size_nonleaf) == 1);
assert(read_partitioned_counter(m_ev.m_size_rollback) == 1); assert(read_partitioned_counter(m_ev.m_size_rollback) == 1);
assert(read_partitioned_counter(m_ev.m_size_cachepressure) == 1); assert(read_partitioned_counter(m_ev.m_size_cachepressure) == 1);
m_ev.m_size_current = 0;
m_ev.destroy(); m_ev.destroy();
this->verify_ev_destroy(); this->verify_ev_destroy();
} }
...@@ -150,6 +151,7 @@ void evictor_unit_test::verify_ev_m_size_reserved() { ...@@ -150,6 +151,7 @@ void evictor_unit_test::verify_ev_m_size_reserved() {
usleep(1*1024*1024); // sleep to give eviction thread a chance to wake up usleep(1*1024*1024); // sleep to give eviction thread a chance to wake up
assert(m_ev.m_num_eviction_thread_runs == 1); assert(m_ev.m_num_eviction_thread_runs == 1);
m_ev.m_size_current = 0;
m_ev.destroy(); m_ev.destroy();
this->verify_ev_destroy(); this->verify_ev_destroy();
} }
...@@ -203,6 +205,7 @@ void evictor_unit_test::verify_ev_handling_cache_pressure() { ...@@ -203,6 +205,7 @@ void evictor_unit_test::verify_ev_handling_cache_pressure() {
m_ev.m_size_evicting = 0; m_ev.m_size_evicting = 0;
m_ev.m_num_sleepers = 0; m_ev.m_num_sleepers = 0;
m_ev.m_size_current = 0;
m_ev.destroy(); m_ev.destroy();
this->verify_ev_destroy(); this->verify_ev_destroy();
} }
...@@ -212,9 +215,6 @@ void evictor_unit_test::run_test() { ...@@ -212,9 +215,6 @@ void evictor_unit_test::run_test() {
this->verify_ev_m_size_reserved(); this->verify_ev_m_size_reserved();
this->verify_ev_handling_cache_pressure(); this->verify_ev_handling_cache_pressure();
return; return;
//this->disable_ev_thread();
//usleep(9*1024*1024);
} }
int int
......
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