Commit fb0cbd42 authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:3988] #3988 Add some more status info. Still need to get into header, ydb and handlerton.

git-svn-id: file:///svn/toku/tokudb@36864 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0fe564b7
...@@ -760,6 +760,12 @@ typedef struct brt_status { ...@@ -760,6 +760,12 @@ typedef struct brt_status {
uint64_t cleaner_max_buffer_workdone; // max workdone value of any message buffer flushed by cleaner thread uint64_t cleaner_max_buffer_workdone; // max workdone value of any message buffer flushed by cleaner thread
uint64_t cleaner_min_buffer_workdone; uint64_t cleaner_min_buffer_workdone;
uint64_t cleaner_total_buffer_workdone; uint64_t cleaner_total_buffer_workdone;
uint64_t msg_bytes_in; // how many bytes of messages injected at root (for all trees)
uint64_t msg_bytes_out; // how many bytes of messages flushed from h1 nodes to leaves
uint64_t msg_bytes_curr; // how many bytes of messages currently in trees (estimate)
uint64_t msg_bytes_max; // how many bytes of messages currently in trees (estimate)
uint64_t msg_num; // how many messages injected at root
uint64_t msg_num_broadcast; // how many broadcast messages injected at root
uint64_t flush_total; // total number of flushes done by flusher threads or cleaner threads uint64_t flush_total; // total number of flushes done by flusher threads or cleaner threads
uint64_t flush_in_memory; // number of in memory flushes uint64_t flush_in_memory; // number of in memory flushes
uint64_t flush_needed_io; // number of flushes that had to read a child (or part) off disk uint64_t flush_needed_io; // number of flushes that had to read a child (or part) off disk
......
...@@ -2511,7 +2511,8 @@ toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, cons ...@@ -2511,7 +2511,8 @@ toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, cons
void void
toku_brt_append_to_child_buffer(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, int childnum, int type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val) { toku_brt_append_to_child_buffer(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, int childnum, int type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val) {
assert(BP_STATE(node,childnum) == PT_AVAIL); assert(BP_STATE(node,childnum) == PT_AVAIL);
int r = toku_bnc_insert_msg(BNC(node, childnum), key->data, key->size, val->data, val->size, type, msn, xids, is_fresh, desc, compare_fun); assert_zero(r); int r = toku_bnc_insert_msg(BNC(node, childnum), key->data, key->size, val->data, val->size, type, msn, xids, is_fresh, desc, compare_fun);
invariant_zero(r);
node->dirty = 1; node->dirty = 1;
} }
...@@ -2582,12 +2583,23 @@ unsigned int toku_brtnode_which_child(BRTNODE node, const DBT *k, ...@@ -2582,12 +2583,23 @@ unsigned int toku_brtnode_which_child(BRTNODE node, const DBT *k,
#endif #endif
} }
// TODO Use this function to clean up other places where bits of messages are passed around
// such as toku_bnc_insert_msg() and the call stack above it.
static size_t
brt_msg_size(BRT_MSG msg) {
size_t keylen = msg->u.id.key->size;
size_t vallen = msg->u.id.val->size;
size_t xids_size = xids_get_serialize_size(msg->xids);
size_t rval = keylen + vallen + KEY_VALUE_OVERHEAD + BRT_CMD_OVERHEAD + xids_size;
return rval;
}
static void brt_nonleaf_cmd_once(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, BRT_MSG cmd, bool is_fresh) static void brt_nonleaf_cmd_once(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, BRT_MSG cmd, bool is_fresh)
// Effect: Insert a message into a nonleaf. We may put it into a child, possibly causing the child to become reactive. // Effect: Insert a message into a nonleaf. We may put it into a child, possibly causing the child to become reactive.
// We don't do the splitting and merging. That's up to the caller after doing all the puts it wants to do. // We don't do the splitting and merging. That's up to the caller after doing all the puts it wants to do.
// The re_array[i] gets set to reactivity of any modified child. // The re_array[i] gets set to reactivity of any modified child.
{ {
/* find the right subtree */ /* find the right subtree */
//TODO: accesses key, val directly //TODO: accesses key, val directly
unsigned int childnum = toku_brtnode_which_child(node, cmd->u.id.key, desc, compare_fun); unsigned int childnum = toku_brtnode_which_child(node, cmd->u.id.key, desc, compare_fun);
...@@ -3097,6 +3109,9 @@ toku_bnc_flush_to_child( ...@@ -3097,6 +3109,9 @@ toku_bnc_flush_to_child(
assert_zero(r); assert_zero(r);
r = toku_omt_clone_pool(&live_list_reverse, logger->live_list_reverse, sizeof(XID_PAIR_S)); r = toku_omt_clone_pool(&live_list_reverse, logger->live_list_reverse, sizeof(XID_PAIR_S));
assert_zero(r); assert_zero(r);
size_t buffsize = bnc->n_bytes_in_buffer;
brt_status.msg_bytes_out += buffsize; // take advantage of surrounding mutex
brt_status.msg_bytes_curr -= buffsize; // may be misleading if there's a broadcast message in there
toku_pthread_mutex_unlock(&logger->txn_list_lock); toku_pthread_mutex_unlock(&logger->txn_list_lock);
} else { } else {
snapshot_txnids = NULL; snapshot_txnids = NULL;
...@@ -3544,6 +3559,14 @@ static void push_something_at_root (BRT brt, BRTNODE *nodep, BRT_MSG cmd) ...@@ -3544,6 +3559,14 @@ static void push_something_at_root (BRT brt, BRTNODE *nodep, BRT_MSG cmd)
node->max_msn_applied_to_node_on_disk = cmd_msn; node->max_msn_applied_to_node_on_disk = cmd_msn;
node->dirty = 1; node->dirty = 1;
} else { } else {
uint64_t msgsize = brt_msg_size(cmd);
brt_status.msg_bytes_in += msgsize;
brt_status.msg_bytes_curr += msgsize;
if (brt_status.msg_bytes_curr > brt_status.msg_bytes_max)
brt_status.msg_bytes_max = brt_status.msg_bytes_curr;
brt_status.msg_num++;
if (brt_msg_applies_all(cmd))
brt_status.msg_num_broadcast++;
brt_nonleaf_put_cmd(brt->compare_fun, &brt->h->descriptor, node, cmd, true); brt_nonleaf_put_cmd(brt->compare_fun, &brt->h->descriptor, node, cmd, true);
} }
} }
......
...@@ -79,6 +79,10 @@ static u_int64_t num_multi_updates; ...@@ -79,6 +79,10 @@ static u_int64_t num_multi_updates;
static u_int64_t num_multi_updates_fail; static u_int64_t num_multi_updates_fail;
static u_int64_t num_point_queries; static u_int64_t num_point_queries;
static u_int64_t num_sequential_queries; static u_int64_t num_sequential_queries;
static u_int64_t num_db_open;
static u_int64_t num_db_close;
static u_int64_t num_open_dbs;
static u_int64_t max_open_dbs;
static u_int64_t directory_read_locks; /* total directory read locks taken */ static u_int64_t directory_read_locks; /* total directory read locks taken */
static u_int64_t directory_read_locks_fail; /* total directory read locks unable to be taken */ static u_int64_t directory_read_locks_fail; /* total directory read locks unable to be taken */
...@@ -3016,6 +3020,10 @@ env_note_db_opened(DB_ENV *env, DB *db) { ...@@ -3016,6 +3020,10 @@ env_note_db_opened(DB_ENV *env, DB *db) {
OMTVALUE dbv; OMTVALUE dbv;
uint32_t idx; uint32_t idx;
env->i->num_open_dbs++; env->i->num_open_dbs++;
num_open_dbs = env->i->num_open_dbs;
num_db_open++;
if (num_open_dbs > max_open_dbs)
max_open_dbs = num_open_dbs;
r = toku_omt_find_zero(env->i->open_dbs, find_db_by_db, db, &dbv, &idx); r = toku_omt_find_zero(env->i->open_dbs, find_db_by_db, db, &dbv, &idx);
assert(r==DB_NOTFOUND); //Must not already be there. assert(r==DB_NOTFOUND); //Must not already be there.
r = toku_omt_insert_at(env->i->open_dbs, db, idx); r = toku_omt_insert_at(env->i->open_dbs, db, idx);
...@@ -3031,6 +3039,8 @@ env_note_db_closed(DB_ENV *env, DB *db) { ...@@ -3031,6 +3039,8 @@ env_note_db_closed(DB_ENV *env, DB *db) {
OMTVALUE dbv; OMTVALUE dbv;
uint32_t idx; uint32_t idx;
env->i->num_open_dbs--; env->i->num_open_dbs--;
num_open_dbs = env->i->num_open_dbs;
num_db_close++;
r = toku_omt_find_zero(env->i->open_dbs, find_db_by_db, db, &dbv, &idx); r = toku_omt_find_zero(env->i->open_dbs, find_db_by_db, db, &dbv, &idx);
assert(r==0); //Must already be there. assert(r==0); //Must already be there.
assert((DB*)dbv == db); assert((DB*)dbv == db);
......
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