Commit 8ffbb13c authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:3988] #3988 Improve thrashing stats. Still need to make available to engine status.

git-svn-id: file:///svn/toku/tokudb@35880 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6b65ba5c
......@@ -773,6 +773,8 @@ typedef struct brt_status {
u_int64_t dsn_gap; // dsn has detected a gap in continuity of root-to-leaf path (internal node was evicted and re-read)
u_int64_t bytes_leaf; // memory used by leaf nodes
u_int64_t bytes_nonleaf; // memory used by nonleaf nodes
uint64_t total_searches; // total number of searches
uint64_t total_retries; // total number of search retries due to TRY_AGAIN
uint64_t max_search_excess_retries; // max number of excess search retries (retries - treeheight) due to TRY_AGAIN
uint64_t max_search_root_tries; // max number of times root node was fetched in a single search
uint64_t search_root_retries; // number of searches that required the root node to be fetched more than once
......
......@@ -6260,17 +6260,13 @@ toku_brt_search (BRT brt, brt_search_t *search, BRT_GET_CALLBACK_FUNCTION getf,
// All searches are performed through this function.
{
int r;
uint retrycount = 0; // How many retries did it take to get the result?
uint trycount = 0; // How many tries did it take to get the result?
uint root_tries = 0; // How many times did we fetch the root node from disk?
uint tree_height; // How high is the tree? This is the height of the root node plus one (leaf is at height 0).
BOOL retry = false; // Have we attempted this search yet?
try_again:
if (retry) // don't count first attempt as a retry
retrycount++;
retry = true;
trycount++;
assert(brt->h);
u_int32_t fullhash;
......@@ -6372,6 +6368,9 @@ try_again:
}
{ // accounting (to detect and measure thrashing)
uint retrycount = trycount - 1; // how many retries were needed?
brt_status.total_searches++;
brt_status.total_retries += retrycount;
if (root_tries > 1) { // if root was read from disk more than once
brt_status.search_root_retries++;
if (root_tries > brt_status.max_search_root_tries)
......
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