From 9057d69d17a8f37b33251ba14c8eebc51be07cfb Mon Sep 17 00:00:00 2001 From: Barry Perlman <barry@tokutek.com> Date: Wed, 19 Oct 2011 15:55:44 +0000 Subject: [PATCH] [t:3988] #3988 Make thrashing stats available via engine status. Must still display in handlerton. git-svn-id: file:///svn/toku/tokudb@35888 c7de825b-a66e-492c-adef-691d508d4ae1 --- buildheader/db.h_4_1 | 7 +++++++ buildheader/db.h_4_3 | 7 +++++++ buildheader/db.h_4_4 | 7 +++++++ buildheader/db.h_4_5 | 7 +++++++ buildheader/db.h_4_6 | 7 +++++++ buildheader/make_db_h.c | 7 +++++++ buildheader/tdb.h | 7 +++++++ include/db.h | 7 +++++++ src/ydb.c | 14 ++++++++++++++ 9 files changed, 70 insertions(+) diff --git a/buildheader/db.h_4_1 b/buildheader/db.h_4_1 index da9d12d7d1..762174b2f6 100644 --- a/buildheader/db.h_4_1 +++ b/buildheader/db.h_4_1 @@ -156,6 +156,13 @@ typedef struct __toku_engine_status { u_int64_t msn_discards; /* how many messages were ignored by leaf because of msn */ u_int64_t max_workdone; /* max workdone value of any buffer */ u_int64_t dsn_gap; /* dsn has detected a gap in continuity of root-to-leaf path (internal node was evicted and re-read) */ + 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 */ + uint64_t search_tries_gt_height; /* number of searches that required more tries than the height of the tree */ + uint64_t search_tries_gt_heightplus3; /* number of searches that required more tries than the height of the tree plus three */ u_int64_t point_queries; /* ydb point queries */ u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t le_max_committed_xr; /* max committed transaction records in any packed le */ diff --git a/buildheader/db.h_4_3 b/buildheader/db.h_4_3 index 77d27b4983..37608496fe 100644 --- a/buildheader/db.h_4_3 +++ b/buildheader/db.h_4_3 @@ -156,6 +156,13 @@ typedef struct __toku_engine_status { u_int64_t msn_discards; /* how many messages were ignored by leaf because of msn */ u_int64_t max_workdone; /* max workdone value of any buffer */ u_int64_t dsn_gap; /* dsn has detected a gap in continuity of root-to-leaf path (internal node was evicted and re-read) */ + 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 */ + uint64_t search_tries_gt_height; /* number of searches that required more tries than the height of the tree */ + uint64_t search_tries_gt_heightplus3; /* number of searches that required more tries than the height of the tree plus three */ u_int64_t point_queries; /* ydb point queries */ u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t le_max_committed_xr; /* max committed transaction records in any packed le */ diff --git a/buildheader/db.h_4_4 b/buildheader/db.h_4_4 index 53e9403098..1fc87ae8bd 100644 --- a/buildheader/db.h_4_4 +++ b/buildheader/db.h_4_4 @@ -156,6 +156,13 @@ typedef struct __toku_engine_status { u_int64_t msn_discards; /* how many messages were ignored by leaf because of msn */ u_int64_t max_workdone; /* max workdone value of any buffer */ u_int64_t dsn_gap; /* dsn has detected a gap in continuity of root-to-leaf path (internal node was evicted and re-read) */ + 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 */ + uint64_t search_tries_gt_height; /* number of searches that required more tries than the height of the tree */ + uint64_t search_tries_gt_heightplus3; /* number of searches that required more tries than the height of the tree plus three */ u_int64_t point_queries; /* ydb point queries */ u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t le_max_committed_xr; /* max committed transaction records in any packed le */ diff --git a/buildheader/db.h_4_5 b/buildheader/db.h_4_5 index 53937fb657..043bd65d31 100644 --- a/buildheader/db.h_4_5 +++ b/buildheader/db.h_4_5 @@ -156,6 +156,13 @@ typedef struct __toku_engine_status { u_int64_t msn_discards; /* how many messages were ignored by leaf because of msn */ u_int64_t max_workdone; /* max workdone value of any buffer */ u_int64_t dsn_gap; /* dsn has detected a gap in continuity of root-to-leaf path (internal node was evicted and re-read) */ + 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 */ + uint64_t search_tries_gt_height; /* number of searches that required more tries than the height of the tree */ + uint64_t search_tries_gt_heightplus3; /* number of searches that required more tries than the height of the tree plus three */ u_int64_t point_queries; /* ydb point queries */ u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t le_max_committed_xr; /* max committed transaction records in any packed le */ diff --git a/buildheader/db.h_4_6 b/buildheader/db.h_4_6 index 133ae83740..361fd3f816 100644 --- a/buildheader/db.h_4_6 +++ b/buildheader/db.h_4_6 @@ -156,6 +156,13 @@ typedef struct __toku_engine_status { u_int64_t msn_discards; /* how many messages were ignored by leaf because of msn */ u_int64_t max_workdone; /* max workdone value of any buffer */ u_int64_t dsn_gap; /* dsn has detected a gap in continuity of root-to-leaf path (internal node was evicted and re-read) */ + 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 */ + uint64_t search_tries_gt_height; /* number of searches that required more tries than the height of the tree */ + uint64_t search_tries_gt_heightplus3; /* number of searches that required more tries than the height of the tree plus three */ u_int64_t point_queries; /* ydb point queries */ u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t le_max_committed_xr; /* max committed transaction records in any packed le */ diff --git a/buildheader/make_db_h.c b/buildheader/make_db_h.c index beac885352..c0941cbf04 100644 --- a/buildheader/make_db_h.c +++ b/buildheader/make_db_h.c @@ -550,6 +550,13 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__ printf(" u_int64_t msn_discards; /* how many messages were ignored by leaf because of msn */ \n"); printf(" u_int64_t max_workdone; /* max workdone value of any buffer */ \n"); printf(" u_int64_t dsn_gap; /* dsn has detected a gap in continuity of root-to-leaf path (internal node was evicted and re-read) */ \n"); + printf(" uint64_t total_searches; /* total number of searches */ \n"); + printf(" uint64_t total_retries; /* total number of search retries due to TRY_AGAIN */ \n"); + printf(" uint64_t max_search_excess_retries; /* max number of excess search retries (retries - treeheight) due to TRY_AGAIN */ \n"); + printf(" uint64_t max_search_root_tries; /* max number of times root node was fetched in a single search */ \n"); + printf(" uint64_t search_root_retries; /* number of searches that required the root node to be fetched more than once */ \n"); + printf(" uint64_t search_tries_gt_height; /* number of searches that required more tries than the height of the tree */ \n"); + printf(" uint64_t search_tries_gt_heightplus3; /* number of searches that required more tries than the height of the tree plus three */ \n"); printf(" u_int64_t point_queries; /* ydb point queries */ \n"); printf(" u_int64_t sequential_queries; /* ydb sequential queries */ \n"); printf(" u_int64_t le_max_committed_xr; /* max committed transaction records in any packed le */ \n"); diff --git a/buildheader/tdb.h b/buildheader/tdb.h index d608220d31..8e984510e7 100644 --- a/buildheader/tdb.h +++ b/buildheader/tdb.h @@ -156,6 +156,13 @@ typedef struct __toku_engine_status { u_int64_t msn_discards; /* how many messages were ignored by leaf because of msn */ u_int64_t max_workdone; /* max workdone value of any buffer */ u_int64_t dsn_gap; /* dsn has detected a gap in continuity of root-to-leaf path (internal node was evicted and re-read) */ + 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 */ + uint64_t search_tries_gt_height; /* number of searches that required more tries than the height of the tree */ + uint64_t search_tries_gt_heightplus3; /* number of searches that required more tries than the height of the tree plus three */ u_int64_t point_queries; /* ydb point queries */ u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t le_max_committed_xr; /* max committed transaction records in any packed le */ diff --git a/include/db.h b/include/db.h index d608220d31..8e984510e7 100644 --- a/include/db.h +++ b/include/db.h @@ -156,6 +156,13 @@ typedef struct __toku_engine_status { u_int64_t msn_discards; /* how many messages were ignored by leaf because of msn */ u_int64_t max_workdone; /* max workdone value of any buffer */ u_int64_t dsn_gap; /* dsn has detected a gap in continuity of root-to-leaf path (internal node was evicted and re-read) */ + 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 */ + uint64_t search_tries_gt_height; /* number of searches that required more tries than the height of the tree */ + uint64_t search_tries_gt_heightplus3; /* number of searches that required more tries than the height of the tree plus three */ u_int64_t point_queries; /* ydb point queries */ u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t le_max_committed_xr; /* max committed transaction records in any packed le */ diff --git a/src/ydb.c b/src/ydb.c index 067ad76707..2a3e374ef3 100644 --- a/src/ydb.c +++ b/src/ydb.c @@ -1969,6 +1969,13 @@ env_get_engine_status(DB_ENV * env, ENGINE_STATUS * engstat, char * env_panic_st engstat->msn_discards = brt_stat.msn_discards; engstat->max_workdone = brt_stat.max_workdone; engstat->dsn_gap = brt_stat.dsn_gap; + engstat->total_searches = brt_stat.total_searches; + engstat->total_retries = brt_stat.total_retries; + engstat->max_search_excess_retries = brt_stat.max_search_excess_retries; + engstat->max_search_root_tries = brt_stat.max_search_root_tries; + engstat->search_root_retries = brt_stat.search_root_retries; + engstat->search_tries_gt_height = brt_stat.search_tries_gt_height; + engstat->search_tries_gt_heightplus3 = brt_stat.search_tries_gt_heightplus3; engstat->cachetable_size_leaf = brt_stat.bytes_leaf; engstat->cachetable_size_nonleaf = brt_stat.bytes_nonleaf; } @@ -2181,6 +2188,13 @@ env_get_engine_status_text(DB_ENV * env, char * buff, int bufsiz) { n += snprintf(buff + n, bufsiz - n, "msn_discards %"PRIu64"\n", engstat.msn_discards); n += snprintf(buff + n, bufsiz - n, "max_workdone %"PRIu64"\n", engstat.max_workdone); n += snprintf(buff + n, bufsiz - n, "dsn_gap %"PRIu64"\n", engstat.dsn_gap); + n += snprintf(buff + n, bufsiz - n, "total_searches %"PRIu64"\n", engstat.total_searches); + n += snprintf(buff + n, bufsiz - n, "total_retries %"PRIu64"\n", engstat.total_retries); + n += snprintf(buff + n, bufsiz - n, "max_search_excess_retries %"PRIu64"\n", engstat.max_search_excess_retries); + n += snprintf(buff + n, bufsiz - n, "max_search_root_tries %"PRIu64"\n", engstat.max_search_root_tries); + n += snprintf(buff + n, bufsiz - n, "search_root_retries %"PRIu64"\n", engstat.search_root_retries); + n += snprintf(buff + n, bufsiz - n, "search_tries_gt_height %"PRIu64"\n", engstat.search_tries_gt_height); + n += snprintf(buff + n, bufsiz - n, "search_tries_gt_heightplus3 %"PRIu64"\n", engstat.search_tries_gt_heightplus3); n += snprintf(buff + n, bufsiz - n, "multi_inserts %"PRIu64"\n", engstat.multi_inserts); n += snprintf(buff + n, bufsiz - n, "multi_inserts_fail %"PRIu64"\n", engstat.multi_inserts_fail); n += snprintf(buff + n, bufsiz - n, "multi_deletes %"PRIu64"\n", engstat.multi_deletes); -- 2.30.9