Commit 3bdf1bbd authored by Zardosht Kasheff's avatar Zardosht Kasheff

FT-287, have engine status report the amount of cloned data in the cachetable

parent 47f57224
...@@ -516,8 +516,8 @@ class evictor { ...@@ -516,8 +516,8 @@ class evictor {
void add_pair_attr(PAIR_ATTR attr); void add_pair_attr(PAIR_ATTR attr);
void remove_pair_attr(PAIR_ATTR attr); void remove_pair_attr(PAIR_ATTR attr);
void change_pair_attr(PAIR_ATTR old_attr, PAIR_ATTR new_attr); void change_pair_attr(PAIR_ATTR old_attr, PAIR_ATTR new_attr);
void add_to_size_current(long size); void add_cloned_data_size(long size);
void remove_from_size_current(long size); void remove_cloned_data_size(long size);
uint64_t reserve_memory(double fraction, uint64_t upper_bound); uint64_t reserve_memory(double fraction, uint64_t upper_bound);
void release_reserved_memory(uint64_t reserved_memory); void release_reserved_memory(uint64_t reserved_memory);
void run_eviction_thread(); void run_eviction_thread();
...@@ -531,6 +531,8 @@ class evictor { ...@@ -531,6 +531,8 @@ class evictor {
void get_state(long *size_current_ptr, long *size_limit_ptr); void get_state(long *size_current_ptr, long *size_limit_ptr);
void fill_engine_status(); void fill_engine_status();
private: private:
void add_to_size_current(long size);
void remove_from_size_current(long size);
void run_eviction(); void run_eviction();
bool run_eviction_on_pair(PAIR p); bool run_eviction_on_pair(PAIR p);
void try_evict_pair(PAIR p); void try_evict_pair(PAIR p);
...@@ -546,6 +548,7 @@ class evictor { ...@@ -546,6 +548,7 @@ class evictor {
pair_list* m_pl; pair_list* m_pl;
cachefile_list* m_cf_list; cachefile_list* m_cf_list;
int64_t m_size_current; // the sum of the sizes of the pairs in the cachetable int64_t m_size_current; // the sum of the sizes of the pairs in the cachetable
int64_t m_size_cloned_data; // stores amount of cloned data we have, only used for engine status
// changes to these two values are protected // changes to these two values are protected
// by ev_thread_lock // by ev_thread_lock
int64_t m_size_reserved; // How much memory is reserved (e.g., by the loader) int64_t m_size_reserved; // How much memory is reserved (e.g., by the loader)
......
...@@ -144,6 +144,7 @@ status_init(void) { ...@@ -144,6 +144,7 @@ status_init(void) {
STATUS_INIT(CT_SIZE_LEAF, CACHETABLE_SIZE_LEAF, UINT64, "size leaf", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS); STATUS_INIT(CT_SIZE_LEAF, CACHETABLE_SIZE_LEAF, UINT64, "size leaf", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CT_SIZE_ROLLBACK, CACHETABLE_SIZE_ROLLBACK, UINT64, "size rollback", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS); STATUS_INIT(CT_SIZE_ROLLBACK, CACHETABLE_SIZE_ROLLBACK, UINT64, "size rollback", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CT_SIZE_CACHEPRESSURE, CACHETABLE_SIZE_CACHEPRESSURE, UINT64, "size cachepressure", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS); STATUS_INIT(CT_SIZE_CACHEPRESSURE, CACHETABLE_SIZE_CACHEPRESSURE, UINT64, "size cachepressure", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CT_SIZE_CLONED, CACHETABLE_SIZE_CACHEPRESSURE, UINT64, "size currently cloned data for checkpoint", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CT_EVICTIONS, CACHETABLE_EVICTIONS, UINT64, "evictions", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS); STATUS_INIT(CT_EVICTIONS, CACHETABLE_EVICTIONS, UINT64, "evictions", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CT_CLEANER_EXECUTIONS, CACHETABLE_CLEANER_EXECUTIONS, UINT64, "cleaner executions", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS); STATUS_INIT(CT_CLEANER_EXECUTIONS, CACHETABLE_CLEANER_EXECUTIONS, UINT64, "cleaner executions", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CT_CLEANER_PERIOD, CACHETABLE_CLEANER_PERIOD, UINT64, "cleaner period", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS); STATUS_INIT(CT_CLEANER_PERIOD, CACHETABLE_CLEANER_PERIOD, UINT64, "cleaner period", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
...@@ -704,7 +705,7 @@ static void cachetable_only_write_locked_data( ...@@ -704,7 +705,7 @@ static void cachetable_only_write_locked_data(
p->disk_data = disk_data; p->disk_data = disk_data;
if (is_clone) { if (is_clone) {
p->cloned_value_data = NULL; p->cloned_value_data = NULL;
ev->remove_from_size_current(p->cloned_value_size); ev->remove_cloned_data_size(p->cloned_value_size);
p->cloned_value_size = 0; p->cloned_value_size = 0;
} }
} }
...@@ -949,7 +950,7 @@ clone_pair(evictor* ev, PAIR p) { ...@@ -949,7 +950,7 @@ clone_pair(evictor* ev, PAIR p) {
ev->change_pair_attr(old_attr, new_attr); ev->change_pair_attr(old_attr, new_attr);
} }
p->cloned_value_size = clone_size; p->cloned_value_size = clone_size;
ev->add_to_size_current(p->cloned_value_size); ev->add_cloned_data_size(p->cloned_value_size);
} }
static void checkpoint_cloned_pair(void* extra) { static void checkpoint_cloned_pair(void* extra) {
...@@ -3635,6 +3636,7 @@ int evictor::init(long _size_limit, pair_list* _pl, cachefile_list* _cf_list, KI ...@@ -3635,6 +3636,7 @@ int evictor::init(long _size_limit, pair_list* _pl, cachefile_list* _cf_list, KI
m_size_reserved = unreservable_memory(_size_limit); m_size_reserved = unreservable_memory(_size_limit);
m_size_current = 0; m_size_current = 0;
m_size_cloned_data = 0;
m_size_evicting = 0; m_size_evicting = 0;
m_size_nonleaf = create_partitioned_counter(); m_size_nonleaf = create_partitioned_counter();
...@@ -3769,6 +3771,22 @@ void evictor::remove_from_size_current(long size) { ...@@ -3769,6 +3771,22 @@ void evictor::remove_from_size_current(long size) {
(void) toku_sync_fetch_and_sub(&m_size_current, size); (void) toku_sync_fetch_and_sub(&m_size_current, size);
} }
//
// Adds the size of cloned data to necessary variables in the evictor
//
void evictor::add_cloned_data_size(long size) {
(void) toku_sync_fetch_and_add(&m_size_cloned_data, size);
add_to_size_current(size);
}
//
// Removes the size of cloned data to necessary variables in the evictor
//
void evictor::remove_cloned_data_size(long size) {
(void) toku_sync_fetch_and_sub(&m_size_cloned_data, size);
remove_from_size_current(size);
}
// //
// TODO: (Zardosht) comment this function // TODO: (Zardosht) comment this function
// //
...@@ -4333,6 +4351,7 @@ void evictor::fill_engine_status() { ...@@ -4333,6 +4351,7 @@ void evictor::fill_engine_status() {
STATUS_VALUE(CT_SIZE_LEAF) = read_partitioned_counter(m_size_leaf); STATUS_VALUE(CT_SIZE_LEAF) = read_partitioned_counter(m_size_leaf);
STATUS_VALUE(CT_SIZE_ROLLBACK) = read_partitioned_counter(m_size_rollback); STATUS_VALUE(CT_SIZE_ROLLBACK) = read_partitioned_counter(m_size_rollback);
STATUS_VALUE(CT_SIZE_CACHEPRESSURE) = read_partitioned_counter(m_size_cachepressure); STATUS_VALUE(CT_SIZE_CACHEPRESSURE) = read_partitioned_counter(m_size_cachepressure);
STATUS_VALUE(CT_SIZE_CLONED) = m_size_cloned_data;
STATUS_VALUE(CT_WAIT_PRESSURE_COUNT) = read_partitioned_counter(m_wait_pressure_count); STATUS_VALUE(CT_WAIT_PRESSURE_COUNT) = read_partitioned_counter(m_wait_pressure_count);
STATUS_VALUE(CT_WAIT_PRESSURE_TIME) = read_partitioned_counter(m_wait_pressure_time); STATUS_VALUE(CT_WAIT_PRESSURE_TIME) = read_partitioned_counter(m_wait_pressure_time);
STATUS_VALUE(CT_LONG_WAIT_PRESSURE_COUNT) = read_partitioned_counter(m_long_wait_pressure_count); STATUS_VALUE(CT_LONG_WAIT_PRESSURE_COUNT) = read_partitioned_counter(m_long_wait_pressure_count);
......
...@@ -594,6 +594,7 @@ typedef enum { ...@@ -594,6 +594,7 @@ typedef enum {
CT_SIZE_LEAF, // number of bytes in cachetable belonging to leaf nodes CT_SIZE_LEAF, // number of bytes in cachetable belonging to leaf nodes
CT_SIZE_ROLLBACK, // number of bytes in cachetable belonging to rollback nodes CT_SIZE_ROLLBACK, // number of bytes in cachetable belonging to rollback nodes
CT_SIZE_CACHEPRESSURE, // number of bytes causing cache pressure (sum of buffers and workdone counters) CT_SIZE_CACHEPRESSURE, // number of bytes causing cache pressure (sum of buffers and workdone counters)
CT_SIZE_CLONED, // number of bytes of cloned data in the system
CT_EVICTIONS, CT_EVICTIONS,
CT_CLEANER_EXECUTIONS, // number of times the cleaner thread's loop has executed CT_CLEANER_EXECUTIONS, // number of times the cleaner thread's loop has executed
CT_CLEANER_PERIOD, CT_CLEANER_PERIOD,
......
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