Commit 2ea274c9 authored by Yoni Fogel's avatar Yoni Fogel

refs #5820 Merge information schema to mainline

git-svn-id: file:///svn/toku/tokudb@54478 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6d243ec4
...@@ -335,7 +335,7 @@ static void print_db_env_struct (void) { ...@@ -335,7 +335,7 @@ static void print_db_env_struct (void) {
"int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */", "int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */",
"int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */", "int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */",
"int (*get_engine_status_num_rows) (DB_ENV*, uint64_t*) /* return number of rows in engine status */", "int (*get_engine_status_num_rows) (DB_ENV*, uint64_t*) /* return number of rows in engine status */",
"int (*get_engine_status) (DB_ENV*, TOKU_ENGINE_STATUS_ROW, uint64_t, fs_redzone_state*, uint64_t*, char*, int) /* Fill in status struct and redzone state, possibly env panic string */", "int (*get_engine_status) (DB_ENV*, TOKU_ENGINE_STATUS_ROW, uint64_t, uint64_t*, fs_redzone_state*, uint64_t*, char*, int, toku_engine_status_include_type) /* Fill in status struct and redzone state, possibly env panic string */",
"int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */", "int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */",
"int (*crash) (DB_ENV*, const char*/*expr_as_string*/,const char */*fun*/,const char*/*file*/,int/*line*/, int/*errno*/)", "int (*crash) (DB_ENV*, const char*/*expr_as_string*/,const char */*fun*/,const char*/*file*/,int/*line*/, int/*errno*/)",
"int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */", "int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */",
...@@ -623,6 +623,7 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) { ...@@ -623,6 +623,7 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) {
printf("// engine status info\n"); printf("// engine status info\n");
printf("// engine status is passed to handlerton as an array of TOKU_ENGINE_STATUS_ROW_S[]\n"); printf("// engine status is passed to handlerton as an array of TOKU_ENGINE_STATUS_ROW_S[]\n");
printf("typedef enum {\n"); printf("typedef enum {\n");
printf(" FS_STATE = 0, // interpret as file system state (redzone) enum \n"); printf(" FS_STATE = 0, // interpret as file system state (redzone) enum \n");
printf(" UINT64, // interpret as uint64_t \n"); printf(" UINT64, // interpret as uint64_t \n");
...@@ -632,11 +633,19 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) { ...@@ -632,11 +633,19 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) {
printf(" PARCOUNT // interpret as PARTITIONED_COUNTER\n"); printf(" PARCOUNT // interpret as PARTITIONED_COUNTER\n");
printf("} toku_engine_status_display_type; \n"); printf("} toku_engine_status_display_type; \n");
printf("typedef enum {\n");
printf(" TOKU_ENGINE_STATUS = (1ULL<<0), // Include when asking for engine status\n");
printf(" TOKU_GLOBAL_STATUS = (1ULL<<1), // Include when asking for information_schema.global_status\n");
printf("} toku_engine_status_include_type; \n");
printf("typedef struct __toku_engine_status_row {\n"); printf("typedef struct __toku_engine_status_row {\n");
printf(" const char * keyname; // info schema key, should not change across revisions without good reason \n"); printf(" const char * keyname; // info schema key, should not change across revisions without good reason \n");
printf(" const char * legend; // the text that will appear at user interface \n"); printf(" const char * legend; // the text that will appear at user interface \n");
printf(" toku_engine_status_display_type type; // how to interpret the value \n"); printf(" toku_engine_status_display_type type; // how to interpret the value \n");
printf(" toku_engine_status_include_type include; // which kinds of callers should get read this row?\n");
printf(" union { \n"); printf(" union { \n");
printf(" double dnum; \n");
printf(" uint64_t num; \n"); printf(" uint64_t num; \n");
printf(" const char * str; \n"); printf(" const char * str; \n");
printf(" struct partitioned_counter *parcount;\n"); printf(" struct partitioned_counter *parcount;\n");
......
...@@ -40,39 +40,33 @@ static CACHETABLE_STATUS_S ct_status; ...@@ -40,39 +40,33 @@ static CACHETABLE_STATUS_S ct_status;
// Note, toku_cachetable_get_status() is below, after declaration of cachetable. // Note, toku_cachetable_get_status() is below, after declaration of cachetable.
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(ct_status, k, t, "cachetable: " l, inc)
ct_status.status[k].keyname = #k; \
ct_status.status[k].type = t; \
ct_status.status[k].legend = "cachetable: " l; \
}
static void static void
status_init(void) { status_init(void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(CT_MISS, UINT64, "miss"); STATUS_INIT(CT_MISS, UINT64, "miss", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_MISSTIME, UINT64, "miss time"); STATUS_INIT(CT_MISSTIME, UINT64, "miss time", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_PREFETCHES, UINT64, "prefetches"); STATUS_INIT(CT_PREFETCHES, UINT64, "prefetches", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_SIZE_CURRENT, UINT64, "size current"); STATUS_INIT(CT_SIZE_CURRENT, UINT64, "size current", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CT_SIZE_LIMIT, UINT64, "size limit"); STATUS_INIT(CT_SIZE_LIMIT, UINT64, "size limit", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CT_SIZE_WRITING, UINT64, "size writing"); STATUS_INIT(CT_SIZE_WRITING, UINT64, "size writing", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_SIZE_NONLEAF, UINT64, "size nonleaf"); STATUS_INIT(CT_SIZE_NONLEAF, UINT64, "size nonleaf", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_SIZE_LEAF, UINT64, "size leaf"); STATUS_INIT(CT_SIZE_LEAF, UINT64, "size leaf", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_SIZE_ROLLBACK, UINT64, "size rollback"); STATUS_INIT(CT_SIZE_ROLLBACK, UINT64, "size rollback", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_SIZE_CACHEPRESSURE, UINT64, "size cachepressure"); STATUS_INIT(CT_SIZE_CACHEPRESSURE, UINT64, "size cachepressure", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_EVICTIONS, UINT64, "evictions"); STATUS_INIT(CT_EVICTIONS, UINT64, "evictions", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_CLEANER_EXECUTIONS, UINT64, "cleaner executions"); STATUS_INIT(CT_CLEANER_EXECUTIONS, UINT64, "cleaner executions", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_CLEANER_PERIOD, UINT64, "cleaner period"); STATUS_INIT(CT_CLEANER_PERIOD, UINT64, "cleaner period", TOKU_ENGINE_STATUS);
STATUS_INIT(CT_CLEANER_ITERATIONS, UINT64, "cleaner iterations"); STATUS_INIT(CT_CLEANER_ITERATIONS, UINT64, "cleaner iterations", TOKU_ENGINE_STATUS);
ct_status.initialized = true; ct_status.initialized = true;
} }
#undef STATUS_INIT #undef STATUS_INIT
#define STATUS_VALUE(x) ct_status.status[x].value.num #define STATUS_VALUE(x) ct_status.status[x].value.num
static void * const zero_value = nullptr; static void * const zero_value = nullptr;
static PAIR_ATTR const zero_attr = { static PAIR_ATTR const zero_attr = {
.size = 0, .size = 0,
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "logger.h" #include "logger.h"
#include "checkpoint.h" #include "checkpoint.h"
#include <portability/toku_atomic.h> #include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Engine status // Engine status
...@@ -59,29 +60,25 @@ ...@@ -59,29 +60,25 @@
static CHECKPOINT_STATUS_S cp_status; static CHECKPOINT_STATUS_S cp_status;
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(cp_status, k, t, "checkpoint: " l, inc)
cp_status.status[k].keyname = #k; \
cp_status.status[k].type = t; \
cp_status.status[k].legend = "checkpoint: " l; \
}
static void static void
status_init(void) { status_init(void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(CP_PERIOD, UINT64, "period"); STATUS_INIT(CP_PERIOD, UINT64, "period", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CP_FOOTPRINT, UINT64, "footprint"); STATUS_INIT(CP_FOOTPRINT, UINT64, "footprint", TOKU_ENGINE_STATUS);
STATUS_INIT(CP_TIME_LAST_CHECKPOINT_BEGIN, UNIXTIME, "last checkpoint began "); STATUS_INIT(CP_TIME_LAST_CHECKPOINT_BEGIN, UNIXTIME, "last checkpoint began ", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CP_TIME_LAST_CHECKPOINT_BEGIN_COMPLETE, UNIXTIME, "last complete checkpoint began "); STATUS_INIT(CP_TIME_LAST_CHECKPOINT_BEGIN_COMPLETE, UNIXTIME, "last complete checkpoint began ", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CP_TIME_LAST_CHECKPOINT_END, UNIXTIME, "last complete checkpoint ended"); STATUS_INIT(CP_TIME_LAST_CHECKPOINT_END, UNIXTIME, "last complete checkpoint ended", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(CP_LAST_LSN, UINT64, "last complete checkpoint LSN"); STATUS_INIT(CP_LAST_LSN, UINT64, "last complete checkpoint LSN", TOKU_ENGINE_STATUS);
STATUS_INIT(CP_CHECKPOINT_COUNT, UINT64, "checkpoints taken "); STATUS_INIT(CP_CHECKPOINT_COUNT, UINT64, "checkpoints taken ", TOKU_ENGINE_STATUS);
STATUS_INIT(CP_CHECKPOINT_COUNT_FAIL, UINT64, "checkpoints failed"); STATUS_INIT(CP_CHECKPOINT_COUNT_FAIL, UINT64, "checkpoints failed", TOKU_ENGINE_STATUS);
STATUS_INIT(CP_WAITERS_NOW, UINT64, "waiters now"); STATUS_INIT(CP_WAITERS_NOW, UINT64, "waiters now", TOKU_ENGINE_STATUS);
STATUS_INIT(CP_WAITERS_MAX, UINT64, "waiters max"); STATUS_INIT(CP_WAITERS_MAX, UINT64, "waiters max", TOKU_ENGINE_STATUS);
STATUS_INIT(CP_CLIENT_WAIT_ON_MO, UINT64, "non-checkpoint client wait on mo lock"); STATUS_INIT(CP_CLIENT_WAIT_ON_MO, UINT64, "non-checkpoint client wait on mo lock", TOKU_ENGINE_STATUS);
STATUS_INIT(CP_CLIENT_WAIT_ON_CS, UINT64, "non-checkpoint client wait on cs lock"); STATUS_INIT(CP_CLIENT_WAIT_ON_CS, UINT64, "non-checkpoint client wait on cs lock", TOKU_ENGINE_STATUS);
cp_status.initialized = true; cp_status.initialized = true;
} }
#undef STATUS_INIT #undef STATUS_INIT
......
...@@ -11,52 +11,49 @@ ...@@ -11,52 +11,49 @@
#include <ft.h> #include <ft.h>
#include <toku_assert.h> #include <toku_assert.h>
#include <portability/toku_atomic.h> #include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
/* Status is intended for display to humans to help understand system behavior. /* Status is intended for display to humans to help understand system behavior.
* It does not need to be perfectly thread-safe. * It does not need to be perfectly thread-safe.
*/ */
static FT_FLUSHER_STATUS_S ft_flusher_status; static FT_FLUSHER_STATUS_S ft_flusher_status;
#define STATUS_INIT(k, t, l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(ft_flusher_status, k, t, "brt flusher: " l, inc)
ft_flusher_status.status[k].keyname = #k; \
ft_flusher_status.status[k].type = t; \
ft_flusher_status.status[k].legend = "brt flusher: " l; \
}
#define STATUS_VALUE(x) ft_flusher_status.status[x].value.num #define STATUS_VALUE(x) ft_flusher_status.status[x].value.num
void toku_ft_flusher_status_init(void) { void toku_ft_flusher_status_init(void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(FT_FLUSHER_CLEANER_TOTAL_NODES, UINT64, "total nodes potentially flushed by cleaner thread"); STATUS_INIT(FT_FLUSHER_CLEANER_TOTAL_NODES, UINT64, "total nodes potentially flushed by cleaner thread", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_H1_NODES, UINT64, "height-one nodes flushed by cleaner thread"); STATUS_INIT(FT_FLUSHER_CLEANER_H1_NODES, UINT64, "height-one nodes flushed by cleaner thread", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_HGT1_NODES, UINT64, "height-greater-than-one nodes flushed by cleaner thread"); STATUS_INIT(FT_FLUSHER_CLEANER_HGT1_NODES, UINT64, "height-greater-than-one nodes flushed by cleaner thread", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_EMPTY_NODES, UINT64, "nodes cleaned which had empty buffers"); STATUS_INIT(FT_FLUSHER_CLEANER_EMPTY_NODES, UINT64, "nodes cleaned which had empty buffers", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_NODES_DIRTIED, UINT64, "nodes dirtied by cleaner thread"); STATUS_INIT(FT_FLUSHER_CLEANER_NODES_DIRTIED, UINT64, "nodes dirtied by cleaner thread", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_MAX_BUFFER_SIZE, UINT64, "max bytes in a buffer flushed by cleaner thread"); STATUS_INIT(FT_FLUSHER_CLEANER_MAX_BUFFER_SIZE, UINT64, "max bytes in a buffer flushed by cleaner thread", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_MIN_BUFFER_SIZE, UINT64, "min bytes in a buffer flushed by cleaner thread"); STATUS_INIT(FT_FLUSHER_CLEANER_MIN_BUFFER_SIZE, UINT64, "min bytes in a buffer flushed by cleaner thread", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_TOTAL_BUFFER_SIZE, UINT64, "total bytes in buffers flushed by cleaner thread"); STATUS_INIT(FT_FLUSHER_CLEANER_TOTAL_BUFFER_SIZE, UINT64, "total bytes in buffers flushed by cleaner thread", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_MAX_BUFFER_WORKDONE, UINT64, "max workdone in a buffer flushed by cleaner thread"); STATUS_INIT(FT_FLUSHER_CLEANER_MAX_BUFFER_WORKDONE, UINT64, "max workdone in a buffer flushed by cleaner thread", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_MIN_BUFFER_WORKDONE, UINT64, "min workdone in a buffer flushed by cleaner thread"); STATUS_INIT(FT_FLUSHER_CLEANER_MIN_BUFFER_WORKDONE, UINT64, "min workdone in a buffer flushed by cleaner thread", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_TOTAL_BUFFER_WORKDONE, UINT64, "total workdone in buffers flushed by cleaner thread"); STATUS_INIT(FT_FLUSHER_CLEANER_TOTAL_BUFFER_WORKDONE, UINT64, "total workdone in buffers flushed by cleaner thread", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_STARTED, UINT64, "times cleaner thread tries to merge a leaf"); STATUS_INIT(FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_STARTED, UINT64, "times cleaner thread tries to merge a leaf", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_RUNNING, UINT64, "cleaner thread leaf merges in progress"); STATUS_INIT(FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_RUNNING, UINT64, "cleaner thread leaf merges in progress", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_COMPLETED, UINT64, "cleaner thread leaf merges successful"); STATUS_INIT(FT_FLUSHER_CLEANER_NUM_LEAF_MERGES_COMPLETED, UINT64, "cleaner thread leaf merges successful", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_CLEANER_NUM_DIRTIED_FOR_LEAF_MERGE, UINT64, "nodes dirtied by cleaner thread leaf merges"); STATUS_INIT(FT_FLUSHER_CLEANER_NUM_DIRTIED_FOR_LEAF_MERGE, UINT64, "nodes dirtied by cleaner thread leaf merges", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_FLUSH_TOTAL, UINT64, "total number of flushes done by flusher threads or cleaner threads"); STATUS_INIT(FT_FLUSHER_FLUSH_TOTAL, UINT64, "total number of flushes done by flusher threads or cleaner threads", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_FLUSH_IN_MEMORY, UINT64, "number of in memory flushes"); STATUS_INIT(FT_FLUSHER_FLUSH_IN_MEMORY, UINT64, "number of in memory flushes", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_FLUSH_NEEDED_IO, UINT64, "number of flushes that read something off disk"); STATUS_INIT(FT_FLUSHER_FLUSH_NEEDED_IO, UINT64, "number of flushes that read something off disk", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES, UINT64, "number of flushes that triggered another flush in child"); STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES, UINT64, "number of flushes that triggered another flush in child", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_1, UINT64, "number of flushes that triggered 1 cascading flush"); STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_1, UINT64, "number of flushes that triggered 1 cascading flush", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_2, UINT64, "number of flushes that triggered 2 cascading flushes"); STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_2, UINT64, "number of flushes that triggered 2 cascading flushes", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_3, UINT64, "number of flushes that triggered 3 cascading flushes"); STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_3, UINT64, "number of flushes that triggered 3 cascading flushes", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_4, UINT64, "number of flushes that triggered 4 cascading flushes"); STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_4, UINT64, "number of flushes that triggered 4 cascading flushes", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_5, UINT64, "number of flushes that triggered 5 cascading flushes"); STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_5, UINT64, "number of flushes that triggered 5 cascading flushes", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_GT_5, UINT64, "number of flushes that triggered over 5 cascading flushes"); STATUS_INIT(FT_FLUSHER_FLUSH_CASCADES_GT_5, UINT64, "number of flushes that triggered over 5 cascading flushes", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_SPLIT_LEAF, UINT64, "leaf node splits"); STATUS_INIT(FT_FLUSHER_SPLIT_LEAF, UINT64, "leaf node splits", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_SPLIT_NONLEAF, UINT64, "nonleaf node splits"); STATUS_INIT(FT_FLUSHER_SPLIT_NONLEAF, UINT64, "nonleaf node splits", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_MERGE_LEAF, UINT64, "leaf node merges"); STATUS_INIT(FT_FLUSHER_MERGE_LEAF, UINT64, "leaf node merges", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_MERGE_NONLEAF, UINT64, "nonleaf node merges"); STATUS_INIT(FT_FLUSHER_MERGE_NONLEAF, UINT64, "nonleaf node merges", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FLUSHER_BALANCE_LEAF, UINT64, "leaf node balances"); STATUS_INIT(FT_FLUSHER_BALANCE_LEAF, UINT64, "leaf node balances", TOKU_ENGINE_STATUS);
STATUS_VALUE(FT_FLUSHER_CLEANER_MIN_BUFFER_SIZE) = UINT64_MAX; STATUS_VALUE(FT_FLUSHER_CLEANER_MIN_BUFFER_SIZE) = UINT64_MAX;
STATUS_VALUE(FT_FLUSHER_CLEANER_MIN_BUFFER_WORKDONE) = UINT64_MAX; STATUS_VALUE(FT_FLUSHER_CLEANER_MIN_BUFFER_WORKDONE) = UINT64_MAX;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <ft-internal.h> #include <ft-internal.h>
#include <ft.h> #include <ft.h>
#include <portability/toku_atomic.h> #include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
// Member Descirption: // Member Descirption:
// 1. highest_pivot_key - this is the key that corresponds to the // 1. highest_pivot_key - this is the key that corresponds to the
...@@ -32,21 +33,17 @@ struct hot_flusher_extra { ...@@ -32,21 +33,17 @@ struct hot_flusher_extra {
static FT_HOT_STATUS_S hot_status; static FT_HOT_STATUS_S hot_status;
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(hot_status, k, t, "hot: " l, inc)
hot_status.status[k].keyname = #k; \
hot_status.status[k].type = t; \
hot_status.status[k].legend = "hot: " l; \
}
#define STATUS_VALUE(x) hot_status.status[x].value.num #define STATUS_VALUE(x) hot_status.status[x].value.num
void void
toku_ft_hot_status_init(void) toku_ft_hot_status_init(void)
{ {
STATUS_INIT(FT_HOT_NUM_STARTED, UINT64, "operations ever started"); STATUS_INIT(FT_HOT_NUM_STARTED, UINT64, "operations ever started", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_HOT_NUM_COMPLETED, UINT64, "operations successfully completed"); STATUS_INIT(FT_HOT_NUM_COMPLETED, UINT64, "operations successfully completed", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_HOT_NUM_ABORTED, UINT64, "operations aborted"); STATUS_INIT(FT_HOT_NUM_ABORTED, UINT64, "operations aborted", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_HOT_MAX_ROOT_FLUSH_COUNT, UINT64, "max number of flushes from root ever required to optimize a tree"); STATUS_INIT(FT_HOT_MAX_ROOT_FLUSH_COUNT, UINT64, "max number of flushes from root ever required to optimize a tree", TOKU_ENGINE_STATUS);
hot_status.initialized = true; hot_status.initialized = true;
} }
......
...@@ -146,14 +146,7 @@ static const uint32_t this_version = FT_LAYOUT_VERSION; ...@@ -146,14 +146,7 @@ static const uint32_t this_version = FT_LAYOUT_VERSION;
*/ */
static FT_STATUS_S ft_status; static FT_STATUS_S ft_status;
#define STATUS_INIT(k,t,l) do { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(ft_status, k, t, "brt: " l, inc)
ft_status.status[k].keyname = #k; \
ft_status.status[k].type = t; \
ft_status.status[k].legend = "brt: " l; \
if (t == PARCOUNT) { \
ft_status.status[k].value.parcount = create_partitioned_counter(); \
} \
} while (0)
static toku_mutex_t ft_open_close_lock; static toku_mutex_t ft_open_close_lock;
...@@ -162,126 +155,126 @@ status_init(void) ...@@ -162,126 +155,126 @@ status_init(void)
{ {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(FT_UPDATES, PARCOUNT, "dictionary updates"); STATUS_INIT(FT_UPDATES, PARCOUNT, "dictionary updates", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_UPDATES_BROADCAST, PARCOUNT, "dictionary broadcast updates"); STATUS_INIT(FT_UPDATES_BROADCAST, PARCOUNT, "dictionary broadcast updates", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DESCRIPTOR_SET, PARCOUNT, "descriptor set"); STATUS_INIT(FT_DESCRIPTOR_SET, PARCOUNT, "descriptor set", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_MSN_DISCARDS, PARCOUNT, "messages ignored by leaf due to msn"); STATUS_INIT(FT_MSN_DISCARDS, PARCOUNT, "messages ignored by leaf due to msn", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOTAL_RETRIES, PARCOUNT, "total search retries due to TRY_AGAIN"); STATUS_INIT(FT_TOTAL_RETRIES, PARCOUNT, "total search retries due to TRY_AGAIN", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_SEARCH_TRIES_GT_HEIGHT, PARCOUNT, "searches requiring more tries than the height of the tree"); STATUS_INIT(FT_SEARCH_TRIES_GT_HEIGHT, PARCOUNT, "searches requiring more tries than the height of the tree", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_SEARCH_TRIES_GT_HEIGHTPLUS3, PARCOUNT, "searches requiring more tries than the height of the tree plus three"); STATUS_INIT(FT_SEARCH_TRIES_GT_HEIGHTPLUS3, PARCOUNT, "searches requiring more tries than the height of the tree plus three", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_CREATE_LEAF, PARCOUNT, "leaf nodes created"); STATUS_INIT(FT_CREATE_LEAF, PARCOUNT, "leaf nodes created", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_CREATE_NONLEAF, PARCOUNT, "nonleaf nodes created"); STATUS_INIT(FT_CREATE_NONLEAF, PARCOUNT, "nonleaf nodes created", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DESTROY_LEAF, PARCOUNT, "leaf nodes destroyed"); STATUS_INIT(FT_DESTROY_LEAF, PARCOUNT, "leaf nodes destroyed", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DESTROY_NONLEAF, PARCOUNT, "nonleaf nodes destroyed"); STATUS_INIT(FT_DESTROY_NONLEAF, PARCOUNT, "nonleaf nodes destroyed", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_MSG_BYTES_IN, PARCOUNT, "bytes of messages injected at root (all trees)"); STATUS_INIT(FT_MSG_BYTES_IN, PARCOUNT, "bytes of messages injected at root (all trees)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_MSG_BYTES_OUT, PARCOUNT, "bytes of messages flushed from h1 nodes to leaves"); STATUS_INIT(FT_MSG_BYTES_OUT, PARCOUNT, "bytes of messages flushed from h1 nodes to leaves", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_MSG_BYTES_CURR, PARCOUNT, "bytes of messages currently in trees (estimate)"); STATUS_INIT(FT_MSG_BYTES_CURR, PARCOUNT, "bytes of messages currently in trees (estimate)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_MSG_NUM, PARCOUNT, "messages injected at root"); STATUS_INIT(FT_MSG_NUM, PARCOUNT, "messages injected at root", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_MSG_NUM_BROADCAST, PARCOUNT, "broadcast messages injected at root"); STATUS_INIT(FT_MSG_NUM_BROADCAST, PARCOUNT, "broadcast messages injected at root", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_BASEMENTS_DECOMPRESSED_NORMAL, PARCOUNT, "basements decompressed as a target of a query"); STATUS_INIT(FT_NUM_BASEMENTS_DECOMPRESSED_NORMAL, PARCOUNT, "basements decompressed as a target of a query", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_BASEMENTS_DECOMPRESSED_AGGRESSIVE, PARCOUNT, "basements decompressed for prelocked range"); STATUS_INIT(FT_NUM_BASEMENTS_DECOMPRESSED_AGGRESSIVE, PARCOUNT, "basements decompressed for prelocked range", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_BASEMENTS_DECOMPRESSED_PREFETCH, PARCOUNT, "basements decompressed for prefetch"); STATUS_INIT(FT_NUM_BASEMENTS_DECOMPRESSED_PREFETCH, PARCOUNT, "basements decompressed for prefetch", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_BASEMENTS_DECOMPRESSED_WRITE, PARCOUNT, "basements decompressed for write"); STATUS_INIT(FT_NUM_BASEMENTS_DECOMPRESSED_WRITE, PARCOUNT, "basements decompressed for write", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_MSG_BUFFER_DECOMPRESSED_NORMAL, PARCOUNT, "buffers decompressed as a target of a query"); STATUS_INIT(FT_NUM_MSG_BUFFER_DECOMPRESSED_NORMAL, PARCOUNT, "buffers decompressed as a target of a query", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_MSG_BUFFER_DECOMPRESSED_AGGRESSIVE, PARCOUNT, "buffers decompressed for prelocked range"); STATUS_INIT(FT_NUM_MSG_BUFFER_DECOMPRESSED_AGGRESSIVE, PARCOUNT, "buffers decompressed for prelocked range", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_MSG_BUFFER_DECOMPRESSED_PREFETCH, PARCOUNT, "buffers decompressed for prefetch"); STATUS_INIT(FT_NUM_MSG_BUFFER_DECOMPRESSED_PREFETCH, PARCOUNT, "buffers decompressed for prefetch", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_MSG_BUFFER_DECOMPRESSED_WRITE, PARCOUNT, "buffers decompressed for write"); STATUS_INIT(FT_NUM_MSG_BUFFER_DECOMPRESSED_WRITE, PARCOUNT, "buffers decompressed for write", TOKU_ENGINE_STATUS);
// Eviction statistics: // Eviction statistics:
STATUS_INIT(FT_FULL_EVICTIONS_LEAF, PARCOUNT, "leaf node full evictions"); STATUS_INIT(FT_FULL_EVICTIONS_LEAF, PARCOUNT, "leaf node full evictions", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FULL_EVICTIONS_LEAF_BYTES, PARCOUNT, "leaf node full evictions (bytes)"); STATUS_INIT(FT_FULL_EVICTIONS_LEAF_BYTES, PARCOUNT, "leaf node full evictions (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FULL_EVICTIONS_NONLEAF, PARCOUNT, "nonleaf node full evictions"); STATUS_INIT(FT_FULL_EVICTIONS_NONLEAF, PARCOUNT, "nonleaf node full evictions", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_FULL_EVICTIONS_NONLEAF_BYTES, PARCOUNT, "nonleaf node full evictions (bytes)"); STATUS_INIT(FT_FULL_EVICTIONS_NONLEAF_BYTES, PARCOUNT, "nonleaf node full evictions (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PARTIAL_EVICTIONS_LEAF, PARCOUNT, "leaf node partial evictions"); STATUS_INIT(FT_PARTIAL_EVICTIONS_LEAF, PARCOUNT, "leaf node partial evictions", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PARTIAL_EVICTIONS_LEAF_BYTES, PARCOUNT, "leaf node partial evictions (bytes)"); STATUS_INIT(FT_PARTIAL_EVICTIONS_LEAF_BYTES, PARCOUNT, "leaf node partial evictions (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PARTIAL_EVICTIONS_NONLEAF, PARCOUNT, "nonleaf node partial evictions"); STATUS_INIT(FT_PARTIAL_EVICTIONS_NONLEAF, PARCOUNT, "nonleaf node partial evictions", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PARTIAL_EVICTIONS_NONLEAF_BYTES, PARCOUNT, "nonleaf node partial evictions (bytes)"); STATUS_INIT(FT_PARTIAL_EVICTIONS_NONLEAF_BYTES, PARCOUNT, "nonleaf node partial evictions (bytes)", TOKU_ENGINE_STATUS);
// Disk read statistics: // Disk read statistics:
// //
// Pivots: For queries, prefetching, or writing. // Pivots: For queries, prefetching, or writing.
STATUS_INIT(FT_NUM_PIVOTS_FETCHED_QUERY, PARCOUNT, "pivots fetched for query"); STATUS_INIT(FT_NUM_PIVOTS_FETCHED_QUERY, PARCOUNT, "pivots fetched for query", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_PIVOTS_FETCHED_QUERY, PARCOUNT, "pivots fetched for query (bytes)"); STATUS_INIT(FT_BYTES_PIVOTS_FETCHED_QUERY, PARCOUNT, "pivots fetched for query (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_PIVOTS_FETCHED_QUERY, TOKUTIME, "pivots fetched for query (seconds)"); STATUS_INIT(FT_TOKUTIME_PIVOTS_FETCHED_QUERY, TOKUTIME, "pivots fetched for query (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_PIVOTS_FETCHED_PREFETCH, PARCOUNT, "pivots fetched for prefetch"); STATUS_INIT(FT_NUM_PIVOTS_FETCHED_PREFETCH, PARCOUNT, "pivots fetched for prefetch", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_PIVOTS_FETCHED_PREFETCH, PARCOUNT, "pivots fetched for prefetch (bytes)"); STATUS_INIT(FT_BYTES_PIVOTS_FETCHED_PREFETCH, PARCOUNT, "pivots fetched for prefetch (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_PIVOTS_FETCHED_PREFETCH, TOKUTIME, "pivots fetched for prefetch (seconds)"); STATUS_INIT(FT_TOKUTIME_PIVOTS_FETCHED_PREFETCH, TOKUTIME, "pivots fetched for prefetch (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_PIVOTS_FETCHED_WRITE, PARCOUNT, "pivots fetched for write"); STATUS_INIT(FT_NUM_PIVOTS_FETCHED_WRITE, PARCOUNT, "pivots fetched for write", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_PIVOTS_FETCHED_WRITE, PARCOUNT, "pivots fetched for write (bytes)"); STATUS_INIT(FT_BYTES_PIVOTS_FETCHED_WRITE, PARCOUNT, "pivots fetched for write (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_PIVOTS_FETCHED_WRITE, TOKUTIME, "pivots fetched for write (seconds)"); STATUS_INIT(FT_TOKUTIME_PIVOTS_FETCHED_WRITE, TOKUTIME, "pivots fetched for write (seconds)", TOKU_ENGINE_STATUS);
// Basements: For queries, aggressive fetching in prelocked range, prefetching, or writing. // Basements: For queries, aggressive fetching in prelocked range, prefetching, or writing.
STATUS_INIT(FT_NUM_BASEMENTS_FETCHED_NORMAL, PARCOUNT, "basements fetched as a target of a query"); STATUS_INIT(FT_NUM_BASEMENTS_FETCHED_NORMAL, PARCOUNT, "basements fetched as a target of a query", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_BASEMENTS_FETCHED_NORMAL, PARCOUNT, "basements fetched as a target of a query (bytes)"); STATUS_INIT(FT_BYTES_BASEMENTS_FETCHED_NORMAL, PARCOUNT, "basements fetched as a target of a query (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_BASEMENTS_FETCHED_NORMAL, TOKUTIME, "basements fetched as a target of a query (seconds)"); STATUS_INIT(FT_TOKUTIME_BASEMENTS_FETCHED_NORMAL, TOKUTIME, "basements fetched as a target of a query (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_BASEMENTS_FETCHED_AGGRESSIVE, PARCOUNT, "basements fetched for prelocked range"); STATUS_INIT(FT_NUM_BASEMENTS_FETCHED_AGGRESSIVE, PARCOUNT, "basements fetched for prelocked range", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_BASEMENTS_FETCHED_AGGRESSIVE, PARCOUNT, "basements fetched for prelocked range (bytes)"); STATUS_INIT(FT_BYTES_BASEMENTS_FETCHED_AGGRESSIVE, PARCOUNT, "basements fetched for prelocked range (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_BASEMENTS_FETCHED_AGGRESSIVE, TOKUTIME, "basements fetched for prelocked range (seconds)"); STATUS_INIT(FT_TOKUTIME_BASEMENTS_FETCHED_AGGRESSIVE, TOKUTIME, "basements fetched for prelocked range (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_BASEMENTS_FETCHED_PREFETCH, PARCOUNT, "basements fetched for prefetch"); STATUS_INIT(FT_NUM_BASEMENTS_FETCHED_PREFETCH, PARCOUNT, "basements fetched for prefetch", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_BASEMENTS_FETCHED_PREFETCH, PARCOUNT, "basements fetched for prefetch (bytes)"); STATUS_INIT(FT_BYTES_BASEMENTS_FETCHED_PREFETCH, PARCOUNT, "basements fetched for prefetch (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_BASEMENTS_FETCHED_PREFETCH, TOKUTIME, "basements fetched for prefetch (seconds)"); STATUS_INIT(FT_TOKUTIME_BASEMENTS_FETCHED_PREFETCH, TOKUTIME, "basements fetched for prefetch (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_BASEMENTS_FETCHED_WRITE, PARCOUNT, "basements fetched for write"); STATUS_INIT(FT_NUM_BASEMENTS_FETCHED_WRITE, PARCOUNT, "basements fetched for write", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_BASEMENTS_FETCHED_WRITE, PARCOUNT, "basements fetched for write (bytes)"); STATUS_INIT(FT_BYTES_BASEMENTS_FETCHED_WRITE, PARCOUNT, "basements fetched for write (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_BASEMENTS_FETCHED_WRITE, TOKUTIME, "basements fetched for write (seconds)"); STATUS_INIT(FT_TOKUTIME_BASEMENTS_FETCHED_WRITE, TOKUTIME, "basements fetched for write (seconds)", TOKU_ENGINE_STATUS);
// Buffers: For queries, aggressive fetching in prelocked range, prefetching, or writing. // Buffers: For queries, aggressive fetching in prelocked range, prefetching, or writing.
STATUS_INIT(FT_NUM_MSG_BUFFER_FETCHED_NORMAL, PARCOUNT, "buffers fetched as a target of a query"); STATUS_INIT(FT_NUM_MSG_BUFFER_FETCHED_NORMAL, PARCOUNT, "buffers fetched as a target of a query", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_MSG_BUFFER_FETCHED_NORMAL, PARCOUNT, "buffers fetched as a target of a query (bytes)"); STATUS_INIT(FT_BYTES_MSG_BUFFER_FETCHED_NORMAL, PARCOUNT, "buffers fetched as a target of a query (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_MSG_BUFFER_FETCHED_NORMAL, TOKUTIME, "buffers fetched as a target of a query (seconds)"); STATUS_INIT(FT_TOKUTIME_MSG_BUFFER_FETCHED_NORMAL, TOKUTIME, "buffers fetched as a target of a query (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_MSG_BUFFER_FETCHED_AGGRESSIVE, PARCOUNT, "buffers fetched for prelocked range"); STATUS_INIT(FT_NUM_MSG_BUFFER_FETCHED_AGGRESSIVE, PARCOUNT, "buffers fetched for prelocked range", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_MSG_BUFFER_FETCHED_AGGRESSIVE, PARCOUNT, "buffers fetched for prelocked range (bytes)"); STATUS_INIT(FT_BYTES_MSG_BUFFER_FETCHED_AGGRESSIVE, PARCOUNT, "buffers fetched for prelocked range (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_MSG_BUFFER_FETCHED_AGGRESSIVE, TOKUTIME, "buffers fetched for prelocked range (seconds)"); STATUS_INIT(FT_TOKUTIME_MSG_BUFFER_FETCHED_AGGRESSIVE, TOKUTIME, "buffers fetched for prelocked range (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_MSG_BUFFER_FETCHED_PREFETCH, PARCOUNT, "buffers fetched for prefetch"); STATUS_INIT(FT_NUM_MSG_BUFFER_FETCHED_PREFETCH, PARCOUNT, "buffers fetched for prefetch", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_MSG_BUFFER_FETCHED_PREFETCH, PARCOUNT, "buffers fetched for prefetch (bytes)"); STATUS_INIT(FT_BYTES_MSG_BUFFER_FETCHED_PREFETCH, PARCOUNT, "buffers fetched for prefetch (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_MSG_BUFFER_FETCHED_PREFETCH, TOKUTIME, "buffers fetched for prefetch (seconds)"); STATUS_INIT(FT_TOKUTIME_MSG_BUFFER_FETCHED_PREFETCH, TOKUTIME, "buffers fetched for prefetch (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NUM_MSG_BUFFER_FETCHED_WRITE, PARCOUNT, "buffers fetched for write"); STATUS_INIT(FT_NUM_MSG_BUFFER_FETCHED_WRITE, PARCOUNT, "buffers fetched for write", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_BYTES_MSG_BUFFER_FETCHED_WRITE, PARCOUNT, "buffers fetched for write (bytes)"); STATUS_INIT(FT_BYTES_MSG_BUFFER_FETCHED_WRITE, PARCOUNT, "buffers fetched for write (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_TOKUTIME_MSG_BUFFER_FETCHED_WRITE, TOKUTIME, "buffers fetched for write (seconds)"); STATUS_INIT(FT_TOKUTIME_MSG_BUFFER_FETCHED_WRITE, TOKUTIME, "buffers fetched for write (seconds)", TOKU_ENGINE_STATUS);
// Disk write statistics. // Disk write statistics.
// //
// Leaf/Nonleaf: Not for checkpoint // Leaf/Nonleaf: Not for checkpoint
STATUS_INIT(FT_DISK_FLUSH_LEAF, PARCOUNT, "leaf nodes flushed to disk (not for checkpoint)"); STATUS_INIT(FT_DISK_FLUSH_LEAF, PARCOUNT, "leaf nodes flushed to disk (not for checkpoint)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DISK_FLUSH_LEAF_BYTES, PARCOUNT, "leaf nodes flushed to disk (not for checkpoint) (bytes)"); STATUS_INIT(FT_DISK_FLUSH_LEAF_BYTES, PARCOUNT, "leaf nodes flushed to disk (not for checkpoint) (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DISK_FLUSH_LEAF_UNCOMPRESSED_BYTES, PARCOUNT, "leaf nodes flushed to disk (not for checkpoint) (uncompressed bytes)"); STATUS_INIT(FT_DISK_FLUSH_LEAF_UNCOMPRESSED_BYTES, PARCOUNT, "leaf nodes flushed to disk (not for checkpoint) (uncompressed bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DISK_FLUSH_LEAF_TOKUTIME, TOKUTIME, "leaf nodes flushed to disk (not for checkpoint) (seconds)"); STATUS_INIT(FT_DISK_FLUSH_LEAF_TOKUTIME, TOKUTIME, "leaf nodes flushed to disk (not for checkpoint) (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DISK_FLUSH_NONLEAF, PARCOUNT, "nonleaf nodes flushed to disk (not for checkpoint)"); STATUS_INIT(FT_DISK_FLUSH_NONLEAF, PARCOUNT, "nonleaf nodes flushed to disk (not for checkpoint)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DISK_FLUSH_NONLEAF_BYTES, PARCOUNT, "nonleaf nodes flushed to disk (not for checkpoint) (bytes)"); STATUS_INIT(FT_DISK_FLUSH_NONLEAF_BYTES, PARCOUNT, "nonleaf nodes flushed to disk (not for checkpoint) (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DISK_FLUSH_NONLEAF_UNCOMPRESSED_BYTES, PARCOUNT, "nonleaf nodes flushed to disk (not for checkpoint) (uncompressed bytes)"); STATUS_INIT(FT_DISK_FLUSH_NONLEAF_UNCOMPRESSED_BYTES, PARCOUNT, "nonleaf nodes flushed to disk (not for checkpoint) (uncompressed bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DISK_FLUSH_NONLEAF_TOKUTIME, TOKUTIME, "nonleaf nodes flushed to disk (not for checkpoint) (seconds)"); STATUS_INIT(FT_DISK_FLUSH_NONLEAF_TOKUTIME, TOKUTIME, "nonleaf nodes flushed to disk (not for checkpoint) (seconds)", TOKU_ENGINE_STATUS);
// Leaf/Nonleaf: For checkpoint // Leaf/Nonleaf: For checkpoint
STATUS_INIT(FT_DISK_FLUSH_LEAF_FOR_CHECKPOINT, PARCOUNT, "leaf nodes flushed to disk (for checkpoint)"); STATUS_INIT(FT_DISK_FLUSH_LEAF_FOR_CHECKPOINT, PARCOUNT, "leaf nodes flushed to disk (for checkpoint)", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(FT_DISK_FLUSH_LEAF_BYTES_FOR_CHECKPOINT, PARCOUNT, "leaf nodes flushed to disk (for checkpoint) (bytes)"); STATUS_INIT(FT_DISK_FLUSH_LEAF_BYTES_FOR_CHECKPOINT, PARCOUNT, "leaf nodes flushed to disk (for checkpoint) (bytes)", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(FT_DISK_FLUSH_LEAF_UNCOMPRESSED_BYTES_FOR_CHECKPOINT, PARCOUNT, "leaf nodes flushed to disk (for checkpoint) (uncompressed bytes)"); STATUS_INIT(FT_DISK_FLUSH_LEAF_UNCOMPRESSED_BYTES_FOR_CHECKPOINT, PARCOUNT, "leaf nodes flushed to disk (for checkpoint) (uncompressed bytes)", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(FT_DISK_FLUSH_LEAF_TOKUTIME_FOR_CHECKPOINT, TOKUTIME, "leaf nodes flushed to disk (for checkpoint) (seconds)"); STATUS_INIT(FT_DISK_FLUSH_LEAF_TOKUTIME_FOR_CHECKPOINT, TOKUTIME, "leaf nodes flushed to disk (for checkpoint) (seconds)", TOKU_ENGINE_STATUS|TOKU_GLOBAL_STATUS);
STATUS_INIT(FT_DISK_FLUSH_NONLEAF_FOR_CHECKPOINT, PARCOUNT, "nonleaf nodes flushed to disk (for checkpoint)"); STATUS_INIT(FT_DISK_FLUSH_NONLEAF_FOR_CHECKPOINT, PARCOUNT, "nonleaf nodes flushed to disk (for checkpoint)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DISK_FLUSH_NONLEAF_BYTES_FOR_CHECKPOINT, PARCOUNT, "nonleaf nodes flushed to disk (for checkpoint) (bytes)"); STATUS_INIT(FT_DISK_FLUSH_NONLEAF_BYTES_FOR_CHECKPOINT, PARCOUNT, "nonleaf nodes flushed to disk (for checkpoint) (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DISK_FLUSH_NONLEAF_UNCOMPRESSED_BYTES_FOR_CHECKPOINT, PARCOUNT, "nonleaf nodes flushed to disk (for checkpoint) (uncompressed bytes)"); STATUS_INIT(FT_DISK_FLUSH_NONLEAF_UNCOMPRESSED_BYTES_FOR_CHECKPOINT, PARCOUNT, "nonleaf nodes flushed to disk (for checkpoint) (uncompressed bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_DISK_FLUSH_NONLEAF_TOKUTIME_FOR_CHECKPOINT, TOKUTIME, "nonleaf nodes flushed to disk (for checkpoint) (seconds)"); STATUS_INIT(FT_DISK_FLUSH_NONLEAF_TOKUTIME_FOR_CHECKPOINT, TOKUTIME, "nonleaf nodes flushed to disk (for checkpoint) (seconds)", TOKU_ENGINE_STATUS);
// CPU time statistics for [de]serialization and [de]compression. // CPU time statistics for [de]serialization and [de]compression.
STATUS_INIT(FT_LEAF_COMPRESS_TOKUTIME, TOKUTIME, "leaf compression to memory (seconds)"); STATUS_INIT(FT_LEAF_COMPRESS_TOKUTIME, TOKUTIME, "leaf compression to memory (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_LEAF_SERIALIZE_TOKUTIME, TOKUTIME, "leaf serialization to memory (seconds)"); STATUS_INIT(FT_LEAF_SERIALIZE_TOKUTIME, TOKUTIME, "leaf serialization to memory (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_LEAF_DECOMPRESS_TOKUTIME, TOKUTIME, "leaf decompression to memory (seconds)"); STATUS_INIT(FT_LEAF_DECOMPRESS_TOKUTIME, TOKUTIME, "leaf decompression to memory (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_LEAF_DESERIALIZE_TOKUTIME, TOKUTIME, "leaf deserialization to memory (seconds)"); STATUS_INIT(FT_LEAF_DESERIALIZE_TOKUTIME, TOKUTIME, "leaf deserialization to memory (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NONLEAF_COMPRESS_TOKUTIME, TOKUTIME, "nonleaf compression to memory (seconds)"); STATUS_INIT(FT_NONLEAF_COMPRESS_TOKUTIME, TOKUTIME, "nonleaf compression to memory (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NONLEAF_SERIALIZE_TOKUTIME, TOKUTIME, "nonleaf serialization to memory (seconds)"); STATUS_INIT(FT_NONLEAF_SERIALIZE_TOKUTIME, TOKUTIME, "nonleaf serialization to memory (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NONLEAF_DECOMPRESS_TOKUTIME, TOKUTIME, "nonleaf decompression to memory (seconds)"); STATUS_INIT(FT_NONLEAF_DECOMPRESS_TOKUTIME, TOKUTIME, "nonleaf decompression to memory (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_NONLEAF_DESERIALIZE_TOKUTIME, TOKUTIME, "nonleaf deserialization to memory (seconds)"); STATUS_INIT(FT_NONLEAF_DESERIALIZE_TOKUTIME, TOKUTIME, "nonleaf deserialization to memory (seconds)", TOKU_ENGINE_STATUS);
// Promotion statistics. // Promotion statistics.
STATUS_INIT(FT_PRO_NUM_ROOT_SPLIT, PARCOUNT, "promotion: roots split"); STATUS_INIT(FT_PRO_NUM_ROOT_SPLIT, PARCOUNT, "promotion: roots split", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_ROOT_H0_INJECT, PARCOUNT, "promotion: leaf roots injected into"); STATUS_INIT(FT_PRO_NUM_ROOT_H0_INJECT, PARCOUNT, "promotion: leaf roots injected into", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_ROOT_H1_INJECT, PARCOUNT, "promotion: h1 roots injected into"); STATUS_INIT(FT_PRO_NUM_ROOT_H1_INJECT, PARCOUNT, "promotion: h1 roots injected into", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_INJECT_DEPTH_0, PARCOUNT, "promotion: injections at depth 0"); STATUS_INIT(FT_PRO_NUM_INJECT_DEPTH_0, PARCOUNT, "promotion: injections at depth 0", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_INJECT_DEPTH_1, PARCOUNT, "promotion: injections at depth 1"); STATUS_INIT(FT_PRO_NUM_INJECT_DEPTH_1, PARCOUNT, "promotion: injections at depth 1", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_INJECT_DEPTH_2, PARCOUNT, "promotion: injections at depth 2"); STATUS_INIT(FT_PRO_NUM_INJECT_DEPTH_2, PARCOUNT, "promotion: injections at depth 2", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_INJECT_DEPTH_3, PARCOUNT, "promotion: injections at depth 3"); STATUS_INIT(FT_PRO_NUM_INJECT_DEPTH_3, PARCOUNT, "promotion: injections at depth 3", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_INJECT_DEPTH_GT3, PARCOUNT, "promotion: injections lower than depth 3"); STATUS_INIT(FT_PRO_NUM_INJECT_DEPTH_GT3, PARCOUNT, "promotion: injections lower than depth 3", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_STOP_NONEMPTY_BUF, PARCOUNT, "promotion: stopped because of a nonempty buffer"); STATUS_INIT(FT_PRO_NUM_STOP_NONEMPTY_BUF, PARCOUNT, "promotion: stopped because of a nonempty buffer", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_STOP_H1, PARCOUNT, "promotion: stopped at height 1"); STATUS_INIT(FT_PRO_NUM_STOP_H1, PARCOUNT, "promotion: stopped at height 1", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_STOP_LOCK_CHILD, PARCOUNT, "promotion: stopped because the child was locked or not at all in memory"); STATUS_INIT(FT_PRO_NUM_STOP_LOCK_CHILD, PARCOUNT, "promotion: stopped because the child was locked or not at all in memory", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_STOP_CHILD_INMEM, PARCOUNT, "promotion: stopped because the child was not fully in memory"); STATUS_INIT(FT_PRO_NUM_STOP_CHILD_INMEM, PARCOUNT, "promotion: stopped because the child was not fully in memory", TOKU_ENGINE_STATUS);
STATUS_INIT(FT_PRO_NUM_DIDNT_WANT_PROMOTE, PARCOUNT, "promotion: stopped anyway, after locking the child"); STATUS_INIT(FT_PRO_NUM_DIDNT_WANT_PROMOTE, PARCOUNT, "promotion: stopped anyway, after locking the child", TOKU_ENGINE_STATUS);
ft_status.initialized = true; ft_status.initialized = true;
} }
......
...@@ -113,4 +113,5 @@ void toku_ft_get_garbage(FT ft, uint64_t *total_space, uint64_t *used_space); ...@@ -113,4 +113,5 @@ void toku_ft_get_garbage(FT ft, uint64_t *total_space, uint64_t *used_space);
int get_num_cores(void); int get_num_cores(void);
struct toku_thread_pool *get_ft_pool(void); struct toku_thread_pool *get_ft_pool(void);
void dump_bad_block(unsigned char *vp, uint64_t size); void dump_bad_block(unsigned char *vp, uint64_t size);
#endif #endif
...@@ -11,24 +11,21 @@ ...@@ -11,24 +11,21 @@
#include <util/sort.h> #include <util/sort.h>
#include <util/threadpool.h> #include <util/threadpool.h>
#include "ft.h" #include "ft.h"
#include <util/partitioned_counter.h>
static FT_UPGRADE_STATUS_S ft_upgrade_status; static FT_UPGRADE_STATUS_S ft_upgrade_status;
#define UPGRADE_STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(ft_upgrade_status, k, t, "brt upgrade: " l, inc)
ft_upgrade_status.status[k].keyname = #k; \
ft_upgrade_status.status[k].type = t; \
ft_upgrade_status.status[k].legend = "brt upgrade: " l; \
}
static void static void
status_init(void) status_init(void)
{ {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
UPGRADE_STATUS_INIT(FT_UPGRADE_FOOTPRINT, UINT64, "footprint"); STATUS_INIT(FT_UPGRADE_FOOTPRINT, UINT64, "footprint", TOKU_ENGINE_STATUS);
ft_upgrade_status.initialized = true; ft_upgrade_status.initialized = true;
} }
#undef UPGRADE_STATUS_INIT #undef STATUS_INIT
#define UPGRADE_STATUS_VALUE(x) ft_upgrade_status.status[x].value.num #define UPGRADE_STATUS_VALUE(x) ft_upgrade_status.status[x].value.num
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "log-internal.h" #include "log-internal.h"
#include "txn_manager.h" #include "txn_manager.h"
#include "rollback_log_node_cache.h" #include "rollback_log_node_cache.h"
#include <util/partitioned_counter.h>
static const int log_format_version=TOKU_LOG_VERSION; static const int log_format_version=TOKU_LOG_VERSION;
...@@ -1307,24 +1308,20 @@ void toku_logger_note_checkpoint(TOKULOGGER logger, LSN lsn) { ...@@ -1307,24 +1308,20 @@ void toku_logger_note_checkpoint(TOKULOGGER logger, LSN lsn) {
static LOGGER_STATUS_S logger_status; static LOGGER_STATUS_S logger_status;
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(logger_status, k, t, "logger: " l, inc)
logger_status.status[k].keyname = #k; \
logger_status.status[k].type = t; \
logger_status.status[k].legend = "logger: " l; \
}
static void static void
status_init(void) { status_init(void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(LOGGER_NEXT_LSN, UINT64, "next LSN"); STATUS_INIT(LOGGER_NEXT_LSN, UINT64, "next LSN", TOKU_ENGINE_STATUS);
STATUS_INIT(LOGGER_ILOCK_CTR, UINT64, "ilock count"); STATUS_INIT(LOGGER_ILOCK_CTR, UINT64, "ilock count", TOKU_ENGINE_STATUS);
STATUS_INIT(LOGGER_OLOCK_CTR, UINT64, "olock count"); STATUS_INIT(LOGGER_OLOCK_CTR, UINT64, "olock count", TOKU_ENGINE_STATUS);
STATUS_INIT(LOGGER_SWAP_CTR, UINT64, "swap count"); STATUS_INIT(LOGGER_SWAP_CTR, UINT64, "swap count", TOKU_ENGINE_STATUS);
STATUS_INIT(LOGGER_NUM_WRITES, UINT64, "writes"); STATUS_INIT(LOGGER_NUM_WRITES, UINT64, "writes", TOKU_ENGINE_STATUS);
STATUS_INIT(LOGGER_BYTES_WRITTEN, UINT64, "writes (bytes)"); STATUS_INIT(LOGGER_BYTES_WRITTEN, UINT64, "writes (bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(LOGGER_UNCOMPRESSED_BYTES_WRITTEN, UINT64, "writes (uncompressed bytes)"); STATUS_INIT(LOGGER_UNCOMPRESSED_BYTES_WRITTEN, UINT64, "writes (uncompressed bytes)", TOKU_ENGINE_STATUS);
STATUS_INIT(LOGGER_TOKUTIME_WRITES, TOKUTIME, "writes (seconds)"); STATUS_INIT(LOGGER_TOKUTIME_WRITES, TOKUTIME, "writes (seconds)", TOKU_ENGINE_STATUS);
logger_status.initialized = true; logger_status.initialized = true;
} }
#undef STATUS_INIT #undef STATUS_INIT
......
...@@ -23,23 +23,16 @@ ...@@ -23,23 +23,16 @@
static TXN_STATUS_S txn_status; static TXN_STATUS_S txn_status;
#define STATUS_INIT(k,t,l) do { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(txn_status, k, t, "txn: " l, inc)
txn_status.status[k].keyname = #k; \
txn_status.status[k].type = t; \
txn_status.status[k].legend = "txn: " l; \
if (t == PARCOUNT) { \
txn_status.status[k].value.parcount = create_partitioned_counter(); \
} \
} while (0)
void void
txn_status_init(void) { txn_status_init(void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(TXN_BEGIN, PARCOUNT, "begin"); STATUS_INIT(TXN_BEGIN, PARCOUNT, "begin", TOKU_ENGINE_STATUS);
STATUS_INIT(TXN_READ_BEGIN, PARCOUNT, "begin read only"); STATUS_INIT(TXN_READ_BEGIN, PARCOUNT, "begin read only", TOKU_ENGINE_STATUS);
STATUS_INIT(TXN_COMMIT, PARCOUNT, "successful commits"); STATUS_INIT(TXN_COMMIT, PARCOUNT, "successful commits", TOKU_ENGINE_STATUS);
STATUS_INIT(TXN_ABORT, PARCOUNT, "aborts"); STATUS_INIT(TXN_ABORT, PARCOUNT, "aborts", TOKU_ENGINE_STATUS);
txn_status.initialized = true; txn_status.initialized = true;
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "ule.h" #include "ule.h"
#include "txn_manager.h" #include "txn_manager.h"
#include "ule-internal.h" #include "ule-internal.h"
#include <util/partitioned_counter.h>
#define ULE_DEBUG 0 #define ULE_DEBUG 0
...@@ -44,20 +45,16 @@ static uint32_t ule_get_innermost_numbytes(ULE ule); ...@@ -44,20 +45,16 @@ static uint32_t ule_get_innermost_numbytes(ULE ule);
static LE_STATUS_S le_status; static LE_STATUS_S le_status;
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(le_status, k, t, "le: " l, inc)
le_status.status[k].keyname = #k; \
le_status.status[k].type = t; \
le_status.status[k].legend = "le: " l; \
}
static void static void
status_init(void) { status_init(void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(LE_MAX_COMMITTED_XR, UINT64, "max committed xr"); STATUS_INIT(LE_MAX_COMMITTED_XR, UINT64, "max committed xr", TOKU_ENGINE_STATUS);
STATUS_INIT(LE_MAX_PROVISIONAL_XR, UINT64, "max provisional xr"); STATUS_INIT(LE_MAX_PROVISIONAL_XR, UINT64, "max provisional xr", TOKU_ENGINE_STATUS);
STATUS_INIT(LE_EXPANDED, UINT64, "expanded"); STATUS_INIT(LE_EXPANDED, UINT64, "expanded", TOKU_ENGINE_STATUS);
STATUS_INIT(LE_MAX_MEMSIZE, UINT64, "max memsize"); STATUS_INIT(LE_MAX_MEMSIZE, UINT64, "max memsize", TOKU_ENGINE_STATUS);
le_status.initialized = true; le_status.initialized = true;
} }
#undef STATUS_INIT #undef STATUS_INIT
......
...@@ -220,6 +220,8 @@ public: ...@@ -220,6 +220,8 @@ public:
lt_escalate_cb m_lt_escalate_callback; lt_escalate_cb m_lt_escalate_callback;
void *m_lt_escalate_callback_extra; void *m_lt_escalate_callback_extra;
LTM_STATUS_S status;
omt<locktree *> m_locktree_map; omt<locktree *> m_locktree_map;
// the manager's mutex protects the locktree map // the manager's mutex protects the locktree map
...@@ -229,6 +231,8 @@ public: ...@@ -229,6 +231,8 @@ public:
void mutex_unlock(void); void mutex_unlock(void);
void status_init(void);
// effect: Gets a locktree from the map. // effect: Gets a locktree from the map.
// requires: Manager's mutex is held // requires: Manager's mutex is held
locktree *locktree_map_find(const DICTIONARY_ID &dict_id); locktree *locktree_map_find(const DICTIONARY_ID &dict_id);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <portability/toku_pthread.h> #include <portability/toku_pthread.h>
#include "locktree.h" #include "locktree.h"
#include <util/partitioned_counter.h>
namespace toku { namespace toku {
...@@ -29,6 +30,8 @@ void locktree::manager::create(lt_create_cb create_cb, lt_destroy_cb destroy_cb, ...@@ -29,6 +30,8 @@ void locktree::manager::create(lt_create_cb create_cb, lt_destroy_cb destroy_cb,
ZERO_STRUCT(m_mutex); ZERO_STRUCT(m_mutex);
toku_mutex_init(&m_mutex, nullptr); toku_mutex_init(&m_mutex, nullptr);
ZERO_STRUCT(status);
} }
void locktree::manager::destroy(void) { void locktree::manager::destroy(void) {
...@@ -269,18 +272,35 @@ bool locktree::manager::memory_tracker::out_of_locks(void) const { ...@@ -269,18 +272,35 @@ bool locktree::manager::memory_tracker::out_of_locks(void) const {
return m_mgr->m_current_lock_memory >= m_mgr->m_max_lock_memory; return m_mgr->m_current_lock_memory >= m_mgr->m_max_lock_memory;
} }
#define STATUS_SET(s, k, t, n, l) \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(status, k, t, "locktree: " l, inc)
s->status[k].keyname = #k; \
s->status[k].type = t; \ void locktree::manager::status_init(void) {
s->status[k].value.num = n; \ STATUS_INIT(LTM_SIZE_CURRENT, UINT64, "memory size", TOKU_ENGINE_STATUS);
s->status[k].legend = "locktree: " l; STATUS_INIT(LTM_SIZE_LIMIT, UINT64, "memory size limit", TOKU_ENGINE_STATUS);
STATUS_INIT(LTM_ESCALATION_COUNT, UINT64, "number of times lock escalation ran", TOKU_ENGINE_STATUS);
STATUS_INIT(LTM_ESCALATION_TIME, TOKUTIME, "time spent running escalation (seconds)", TOKU_ENGINE_STATUS);
STATUS_INIT(LTM_ESCALATION_LATEST_RESULT, UINT64, "latest post-escalation memory size", TOKU_ENGINE_STATUS);
STATUS_INIT(LTM_NUM_LOCKTREES, UINT64, "number of locktrees open now", TOKU_ENGINE_STATUS);
STATUS_INIT(LTM_LOCK_REQUESTS_PENDING, UINT64, "number of pending lock requests", TOKU_ENGINE_STATUS);
STATUS_INIT(LTM_STO_NUM_ELIGIBLE, UINT64, "number of locktrees eligible for the STO", TOKU_ENGINE_STATUS);
STATUS_INIT(LTM_STO_END_EARLY_COUNT, UINT64, "number of times a locktree ended the STO early", TOKU_ENGINE_STATUS);
STATUS_INIT(LTM_STO_END_EARLY_TIME, TOKUTIME, "time spent ending the STO early (seconds)", TOKU_ENGINE_STATUS);
status.initialized = true;
}
#undef STATUS_INIT
#define STATUS_VALUE(x) status.status[x].value.num
void locktree::manager::get_status(LTM_STATUS statp) {
if (!status.initialized) {
status_init();
}
void locktree::manager::get_status(LTM_STATUS status) { STATUS_VALUE(LTM_SIZE_CURRENT) = m_current_lock_memory;
STATUS_SET(status, LTM_SIZE_CURRENT, UINT64, m_current_lock_memory, "memory size"); STATUS_VALUE(LTM_SIZE_LIMIT) = m_max_lock_memory;
STATUS_SET(status, LTM_SIZE_LIMIT, UINT64, m_max_lock_memory, "memory size limit"); STATUS_VALUE(LTM_ESCALATION_COUNT) = m_escalation_count;
STATUS_SET(status, LTM_ESCALATION_COUNT, UINT64, m_escalation_count, "number of times lock escalation ran"); STATUS_VALUE(LTM_ESCALATION_TIME) = m_escalation_time;
STATUS_SET(status, LTM_ESCALATION_TIME, TOKUTIME, m_escalation_time, "time spent running escalation (seconds)"); STATUS_VALUE(LTM_ESCALATION_LATEST_RESULT) = m_escalation_latest_result;
STATUS_SET(status, LTM_ESCALATION_LATEST_RESULT, UINT64, m_escalation_latest_result, "latest post-escalation memory size");
mutex_lock(); mutex_lock();
...@@ -306,13 +326,14 @@ void locktree::manager::get_status(LTM_STATUS status) { ...@@ -306,13 +326,14 @@ void locktree::manager::get_status(LTM_STATUS status) {
mutex_unlock(); mutex_unlock();
STATUS_SET(status, LTM_NUM_LOCKTREES, UINT64, num_locktrees, "number of locktrees open now"); STATUS_VALUE(LTM_NUM_LOCKTREES) = num_locktrees;
STATUS_SET(status, LTM_LOCK_REQUESTS_PENDING, UINT64, lock_requests_pending, "number of pending lock requests"); STATUS_VALUE(LTM_LOCK_REQUESTS_PENDING) = lock_requests_pending;
STATUS_SET(status, LTM_STO_NUM_ELIGIBLE, UINT64, sto_num_eligible, "number of locktrees eligible for the STO"); STATUS_VALUE(LTM_STO_NUM_ELIGIBLE) = sto_num_eligible;
STATUS_SET(status, LTM_STO_END_EARLY_COUNT, UINT64, sto_end_early_count, "number of times a locktree ended the STO early"); STATUS_VALUE(LTM_STO_END_EARLY_COUNT) = sto_end_early_count;
STATUS_SET(status, LTM_STO_END_EARLY_TIME, TOKUTIME, sto_end_early_time, "time spent ending the STO early (seconds)"); STATUS_VALUE(LTM_STO_END_EARLY_TIME) = sto_end_early_time;
*statp = status;
} }
#undef STATUS_VALUE
#undef STATUS_SET
} /* namespace toku */ } /* namespace toku */
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <ft/checkpoint.h> #include <ft/checkpoint.h>
#include <portability/toku_atomic.h> #include <portability/toku_atomic.h>
#include "loader.h" #include "loader.h"
#include <util/partitioned_counter.h>
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Engine status // Engine status
...@@ -37,25 +38,21 @@ ...@@ -37,25 +38,21 @@
static INDEXER_STATUS_S indexer_status; static INDEXER_STATUS_S indexer_status;
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(indexer_status, k, t, "indexer: " l, inc)
indexer_status.status[k].keyname = #k; \
indexer_status.status[k].type = t; \
indexer_status.status[k].legend = "indexer: " l; \
}
static void static void
status_init(void) { status_init(void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(INDEXER_CREATE, UINT64, "number of indexers successfully created"); STATUS_INIT(INDEXER_CREATE, UINT64, "number of indexers successfully created", TOKU_ENGINE_STATUS);
STATUS_INIT(INDEXER_CREATE_FAIL, UINT64, "number of calls to toku_indexer_create_indexer() that failed"); STATUS_INIT(INDEXER_CREATE_FAIL, UINT64, "number of calls to toku_indexer_create_indexer() that failed", TOKU_ENGINE_STATUS);
STATUS_INIT(INDEXER_BUILD, UINT64, "number of calls to indexer->build() succeeded"); STATUS_INIT(INDEXER_BUILD, UINT64, "number of calls to indexer->build() succeeded", TOKU_ENGINE_STATUS);
STATUS_INIT(INDEXER_BUILD_FAIL, UINT64, "number of calls to indexer->build() failed"); STATUS_INIT(INDEXER_BUILD_FAIL, UINT64, "number of calls to indexer->build() failed", TOKU_ENGINE_STATUS);
STATUS_INIT(INDEXER_CLOSE, UINT64, "number of calls to indexer->close() that succeeded"); STATUS_INIT(INDEXER_CLOSE, UINT64, "number of calls to indexer->close() that succeeded", TOKU_ENGINE_STATUS);
STATUS_INIT(INDEXER_CLOSE_FAIL, UINT64, "number of calls to indexer->close() that failed"); STATUS_INIT(INDEXER_CLOSE_FAIL, UINT64, "number of calls to indexer->close() that failed", TOKU_ENGINE_STATUS);
STATUS_INIT(INDEXER_ABORT, UINT64, "number of calls to indexer->abort()"); STATUS_INIT(INDEXER_ABORT, UINT64, "number of calls to indexer->abort()", TOKU_ENGINE_STATUS);
STATUS_INIT(INDEXER_CURRENT, UINT64, "number of indexers currently in existence"); STATUS_INIT(INDEXER_CURRENT, UINT64, "number of indexers currently in existence", TOKU_ENGINE_STATUS);
STATUS_INIT(INDEXER_MAX, UINT64, "max number of indexers that ever existed simultaneously"); STATUS_INIT(INDEXER_MAX, UINT64, "max number of indexers that ever existed simultaneously", TOKU_ENGINE_STATUS);
indexer_status.initialized = true; indexer_status.initialized = true;
} }
#undef STATUS_INIT #undef STATUS_INIT
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "ydb_load.h" #include "ydb_load.h"
#include "loader.h" #include "loader.h"
#include <util/partitioned_counter.h>
enum {MAX_FILE_SIZE=256}; enum {MAX_FILE_SIZE=256};
...@@ -40,25 +41,21 @@ enum {MAX_FILE_SIZE=256}; ...@@ -40,25 +41,21 @@ enum {MAX_FILE_SIZE=256};
static LOADER_STATUS_S loader_status; static LOADER_STATUS_S loader_status;
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(loader_status, k, t, "loader: " l, inc)
loader_status.status[k].keyname = #k; \
loader_status.status[k].type = t; \
loader_status.status[k].legend = "loader: " l; \
}
static void static void
status_init(void) { status_init(void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(LOADER_CREATE, UINT64, "number of loaders successfully created"); STATUS_INIT(LOADER_CREATE, UINT64, "number of loaders successfully created", TOKU_ENGINE_STATUS);
STATUS_INIT(LOADER_CREATE_FAIL, UINT64, "number of calls to toku_loader_create_loader() that failed"); STATUS_INIT(LOADER_CREATE_FAIL, UINT64, "number of calls to toku_loader_create_loader() that failed", TOKU_ENGINE_STATUS);
STATUS_INIT(LOADER_PUT, UINT64, "number of calls to loader->put() succeeded"); STATUS_INIT(LOADER_PUT, UINT64, "number of calls to loader->put() succeeded", TOKU_ENGINE_STATUS);
STATUS_INIT(LOADER_PUT_FAIL, UINT64, "number of calls to loader->put() failed"); STATUS_INIT(LOADER_PUT_FAIL, UINT64, "number of calls to loader->put() failed", TOKU_ENGINE_STATUS);
STATUS_INIT(LOADER_CLOSE, UINT64, "number of calls to loader->close() that succeeded"); STATUS_INIT(LOADER_CLOSE, UINT64, "number of calls to loader->close() that succeeded", TOKU_ENGINE_STATUS);
STATUS_INIT(LOADER_CLOSE_FAIL, UINT64, "number of calls to loader->close() that failed"); STATUS_INIT(LOADER_CLOSE_FAIL, UINT64, "number of calls to loader->close() that failed", TOKU_ENGINE_STATUS);
STATUS_INIT(LOADER_ABORT, UINT64, "number of calls to loader->abort()"); STATUS_INIT(LOADER_ABORT, UINT64, "number of calls to loader->abort()", TOKU_ENGINE_STATUS);
STATUS_INIT(LOADER_CURRENT, UINT64, "number of loaders currently in existence"); STATUS_INIT(LOADER_CURRENT, UINT64, "number of loaders currently in existence", TOKU_ENGINE_STATUS);
STATUS_INIT(LOADER_MAX, UINT64, "max number of loaders that ever existed simultaneously"); STATUS_INIT(LOADER_MAX, UINT64, "max number of loaders that ever existed simultaneously", TOKU_ENGINE_STATUS);
loader_status.initialized = true; loader_status.initialized = true;
} }
#undef STATUS_INIT #undef STATUS_INIT
......
...@@ -74,6 +74,7 @@ status_format_time(const time_t *timer, char *buf) { ...@@ -74,6 +74,7 @@ status_format_time(const time_t *timer, char *buf) {
int int
test_main (int argc, char * const argv[]) { test_main (int argc, char * const argv[]) {
uint64_t nrows; uint64_t nrows;
uint64_t max_rows;
fs_redzone_state redzone_state; fs_redzone_state redzone_state;
uint64_t panic; uint64_t panic;
const int panic_string_len = 1024; const int panic_string_len = 1024;
...@@ -84,13 +85,12 @@ test_main (int argc, char * const argv[]) { ...@@ -84,13 +85,12 @@ test_main (int argc, char * const argv[]) {
setup(FLAGS_LOG); setup(FLAGS_LOG);
env->txn_checkpoint(env, 0, 0, 0); env->txn_checkpoint(env, 0, 0, 0);
env->get_engine_status_num_rows(env, &nrows); env->get_engine_status_num_rows(env, &max_rows);
TOKU_ENGINE_STATUS_ROW_S mystat[nrows]; TOKU_ENGINE_STATUS_ROW_S mystat[max_rows];
int r = env->get_engine_status (env, mystat, nrows, &redzone_state, &panic, panic_string, panic_string_len); int r = env->get_engine_status (env, mystat, max_rows, &nrows, &redzone_state, &panic, panic_string, panic_string_len, TOKU_ENGINE_STATUS);
assert(r==0); assert(r==0);
if (verbose) { if (verbose) {
printf("First all the raw fields:\n"); printf("First all the raw fields:\n");
for (uint64_t i = 0; i < nrows; i++) { for (uint64_t i = 0; i < nrows; i++) {
printf("%s ", mystat[i].keyname); printf("%s ", mystat[i].keyname);
......
...@@ -109,13 +109,14 @@ static __attribute__((__unused__)) uint64_t ...@@ -109,13 +109,14 @@ static __attribute__((__unused__)) uint64_t
get_engine_status_val(DB_ENV * UU(env), const char * keyname) { get_engine_status_val(DB_ENV * UU(env), const char * keyname) {
uint64_t rval = 0; uint64_t rval = 0;
uint64_t nrows; uint64_t nrows;
env->get_engine_status_num_rows(env, &nrows); uint64_t max_rows;
TOKU_ENGINE_STATUS_ROW_S mystat[nrows]; env->get_engine_status_num_rows(env, &max_rows);
TOKU_ENGINE_STATUS_ROW_S mystat[max_rows];
fs_redzone_state redzone_state; fs_redzone_state redzone_state;
uint64_t panic; uint64_t panic;
uint32_t panic_string_len = 1024; uint32_t panic_string_len = 1024;
char panic_string[panic_string_len]; char panic_string[panic_string_len];
int r = env->get_engine_status (env, mystat, nrows, &redzone_state, &panic, panic_string, panic_string_len); int r = env->get_engine_status (env, mystat, max_rows, &nrows, &redzone_state, &panic, panic_string, panic_string_len, TOKU_ENGINE_STATUS);
CKERR(r); CKERR(r);
int found = 0; int found = 0;
for (uint64_t i = 0; i < nrows && !found; i++) { for (uint64_t i = 0; i < nrows && !found; i++) {
......
...@@ -111,24 +111,21 @@ typedef struct { ...@@ -111,24 +111,21 @@ typedef struct {
static YDB_LAYER_STATUS_S ydb_layer_status; static YDB_LAYER_STATUS_S ydb_layer_status;
#define STATUS_VALUE(x) ydb_layer_status.status[x].value.num #define STATUS_VALUE(x) ydb_layer_status.status[x].value.num
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l,inc) TOKUDB_STATUS_INIT(ydb_layer_status, k, t, l, inc)
ydb_layer_status.status[k].keyname = #k; \
ydb_layer_status.status[k].type = t; \
ydb_layer_status.status[k].legend = l; \
}
static void static void
ydb_layer_status_init (void) { ydb_layer_status_init (void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(YDB_LAYER_TIME_CREATION, UNIXTIME, "time of environment creation"); STATUS_INIT(YDB_LAYER_TIME_CREATION, UNIXTIME, "time of environment creation", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_TIME_STARTUP, UNIXTIME, "time of engine startup"); STATUS_INIT(YDB_LAYER_TIME_STARTUP, UNIXTIME, "time of engine startup", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_TIME_NOW, UNIXTIME, "time now"); STATUS_INIT(YDB_LAYER_TIME_NOW, UNIXTIME, "time now", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_DB_OPEN, UINT64, "db opens"); STATUS_INIT(YDB_LAYER_NUM_DB_OPEN, UINT64, "db opens", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_DB_CLOSE, UINT64, "db closes"); STATUS_INIT(YDB_LAYER_NUM_DB_CLOSE, UINT64, "db closes", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_OPEN_DBS, UINT64, "num open dbs now"); STATUS_INIT(YDB_LAYER_NUM_OPEN_DBS, UINT64, "num open dbs now", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_MAX_OPEN_DBS, UINT64, "max open dbs"); STATUS_INIT(YDB_LAYER_MAX_OPEN_DBS, UINT64, "max open dbs", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_FSYNC_LOG_PERIOD, UINT64, "period, in ms, that recovery log is automatically fsynced"); STATUS_INIT(YDB_LAYER_FSYNC_LOG_PERIOD, UINT64, "period, in ms, that recovery log is automatically fsynced", TOKU_ENGINE_STATUS);
STATUS_VALUE(YDB_LAYER_TIME_STARTUP) = time(NULL); STATUS_VALUE(YDB_LAYER_TIME_STARTUP) = time(NULL);
ydb_layer_status.initialized = true; ydb_layer_status.initialized = true;
...@@ -503,22 +500,18 @@ typedef struct { ...@@ -503,22 +500,18 @@ typedef struct {
static PERSISTENT_UPGRADE_STATUS_S persistent_upgrade_status; static PERSISTENT_UPGRADE_STATUS_S persistent_upgrade_status;
#define PERSISTENT_UPGRADE_STATUS_INIT(k,t,l) { \ #define PERSISTENT_UPGRADE_STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(persistent_upgrade_status, k, t, "upgrade: " l, inc)
persistent_upgrade_status.status[k].keyname = #k; \
persistent_upgrade_status.status[k].type = t; \
persistent_upgrade_status.status[k].legend = "upgrade: " l; \
}
static void static void
persistent_upgrade_status_init (void) { persistent_upgrade_status_init (void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
PERSISTENT_UPGRADE_STATUS_INIT(PERSISTENT_UPGRADE_ORIGINAL_ENV_VERSION, UINT64, "original version (at time of environment creation)"); PERSISTENT_UPGRADE_STATUS_INIT(PERSISTENT_UPGRADE_ORIGINAL_ENV_VERSION, UINT64, "original version (at time of environment creation)", TOKU_ENGINE_STATUS);
PERSISTENT_UPGRADE_STATUS_INIT(PERSISTENT_UPGRADE_STORED_ENV_VERSION_AT_STARTUP, UINT64, "version at time of startup"); PERSISTENT_UPGRADE_STATUS_INIT(PERSISTENT_UPGRADE_STORED_ENV_VERSION_AT_STARTUP, UINT64, "version at time of startup", TOKU_ENGINE_STATUS);
PERSISTENT_UPGRADE_STATUS_INIT(PERSISTENT_UPGRADE_LAST_LSN_OF_V13, UINT64, "last LSN of version 13"); PERSISTENT_UPGRADE_STATUS_INIT(PERSISTENT_UPGRADE_LAST_LSN_OF_V13, UINT64, "last LSN of version 13", TOKU_ENGINE_STATUS);
PERSISTENT_UPGRADE_STATUS_INIT(PERSISTENT_UPGRADE_V14_TIME, UNIXTIME, "time of upgrade to version 14"); PERSISTENT_UPGRADE_STATUS_INIT(PERSISTENT_UPGRADE_V14_TIME, UNIXTIME, "time of upgrade to version 14", TOKU_ENGINE_STATUS);
PERSISTENT_UPGRADE_STATUS_INIT(PERSISTENT_UPGRADE_V14_FOOTPRINT, UINT64, "footprint from version 13 to 14"); PERSISTENT_UPGRADE_STATUS_INIT(PERSISTENT_UPGRADE_V14_FOOTPRINT, UINT64, "footprint from version 13 to 14", TOKU_ENGINE_STATUS);
persistent_upgrade_status.initialized = true; persistent_upgrade_status.initialized = true;
} }
...@@ -1703,21 +1696,17 @@ typedef struct { ...@@ -1703,21 +1696,17 @@ typedef struct {
static FS_STATUS_S fsstat; static FS_STATUS_S fsstat;
#define FS_STATUS_INIT(k,t,l) { \ #define FS_STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(fsstat, k, t, "filesystem: " l, inc)
fsstat.status[k].keyname = #k; \
fsstat.status[k].type = t; \
fsstat.status[k].legend = "filesystem: " l; \
}
static void static void
fs_status_init(void) { fs_status_init(void) {
FS_STATUS_INIT(FS_ENOSPC_REDZONE_STATE, FS_STATE, "ENOSPC redzone state"); FS_STATUS_INIT(FS_ENOSPC_REDZONE_STATE, FS_STATE, "ENOSPC redzone state", TOKU_ENGINE_STATUS);
FS_STATUS_INIT(FS_ENOSPC_THREADS_BLOCKED, UINT64, "threads currently blocked by full disk"); FS_STATUS_INIT(FS_ENOSPC_THREADS_BLOCKED, UINT64, "threads currently blocked by full disk", TOKU_ENGINE_STATUS);
FS_STATUS_INIT(FS_ENOSPC_REDZONE_CTR, UINT64, "number of operations rejected by enospc prevention (red zone)"); FS_STATUS_INIT(FS_ENOSPC_REDZONE_CTR, UINT64, "number of operations rejected by enospc prevention (red zone)", TOKU_ENGINE_STATUS);
FS_STATUS_INIT(FS_ENOSPC_MOST_RECENT, UNIXTIME, "most recent disk full"); FS_STATUS_INIT(FS_ENOSPC_MOST_RECENT, UNIXTIME, "most recent disk full", TOKU_ENGINE_STATUS);
FS_STATUS_INIT(FS_ENOSPC_COUNT, UINT64, "number of write operations that returned ENOSPC"); FS_STATUS_INIT(FS_ENOSPC_COUNT, UINT64, "number of write operations that returned ENOSPC", TOKU_ENGINE_STATUS);
FS_STATUS_INIT(FS_FSYNC_TIME, UINT64, "fsync time"); FS_STATUS_INIT(FS_FSYNC_TIME, UINT64, "fsync time", TOKU_ENGINE_STATUS);
FS_STATUS_INIT(FS_FSYNC_COUNT, UINT64, "fsync count"); FS_STATUS_INIT(FS_FSYNC_COUNT, UINT64, "fsync count", TOKU_ENGINE_STATUS);
fsstat.initialized = true; fsstat.initialized = true;
} }
#undef FS_STATUS_INIT #undef FS_STATUS_INIT
...@@ -1772,27 +1761,23 @@ typedef struct { ...@@ -1772,27 +1761,23 @@ typedef struct {
static MEMORY_STATUS_S memory_status; static MEMORY_STATUS_S memory_status;
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(memory_status, k, t, "memory: " l, inc)
memory_status.status[k].keyname = #k; \
memory_status.status[k].type = t; \
memory_status.status[k].legend = "memory: " l; \
}
static void static void
memory_status_init(void) { memory_status_init(void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(MEMORY_MALLOC_COUNT, UINT64, "number of malloc operations"); STATUS_INIT(MEMORY_MALLOC_COUNT, UINT64, "number of malloc operations", TOKU_ENGINE_STATUS);
STATUS_INIT(MEMORY_FREE_COUNT, UINT64, "number of free operations"); STATUS_INIT(MEMORY_FREE_COUNT, UINT64, "number of free operations", TOKU_ENGINE_STATUS);
STATUS_INIT(MEMORY_REALLOC_COUNT, UINT64, "number of realloc operations"); STATUS_INIT(MEMORY_REALLOC_COUNT, UINT64, "number of realloc operations", TOKU_ENGINE_STATUS);
STATUS_INIT(MEMORY_MALLOC_FAIL, UINT64, "number of malloc operations that failed"); STATUS_INIT(MEMORY_MALLOC_FAIL, UINT64, "number of malloc operations that failed", TOKU_ENGINE_STATUS);
STATUS_INIT(MEMORY_REALLOC_FAIL, UINT64, "number of realloc operations that failed" ); STATUS_INIT(MEMORY_REALLOC_FAIL, UINT64, "number of realloc operations that failed" , TOKU_ENGINE_STATUS);
STATUS_INIT(MEMORY_REQUESTED, UINT64, "number of bytes requested"); STATUS_INIT(MEMORY_REQUESTED, UINT64, "number of bytes requested", TOKU_ENGINE_STATUS);
STATUS_INIT(MEMORY_USED, UINT64, "number of bytes used (requested + overhead)"); STATUS_INIT(MEMORY_USED, UINT64, "number of bytes used (requested + overhead)", TOKU_ENGINE_STATUS);
STATUS_INIT(MEMORY_FREED, UINT64, "number of bytes freed"); STATUS_INIT(MEMORY_FREED, UINT64, "number of bytes freed", TOKU_ENGINE_STATUS);
STATUS_INIT(MEMORY_MAX_IN_USE, UINT64, "estimated maximum memory footprint"); STATUS_INIT(MEMORY_MAX_IN_USE, UINT64, "estimated maximum memory footprint", TOKU_ENGINE_STATUS);
STATUS_INIT(MEMORY_MALLOCATOR_VERSION, CHARSTR, "mallocator version"); STATUS_INIT(MEMORY_MALLOCATOR_VERSION, CHARSTR, "mallocator version", TOKU_ENGINE_STATUS);
STATUS_INIT(MEMORY_MMAP_THRESHOLD, UINT64, "mmap threshold"); STATUS_INIT(MEMORY_MMAP_THRESHOLD, UINT64, "mmap threshold", TOKU_ENGINE_STATUS);
memory_status.initialized = true; memory_status.initialized = true;
} }
#undef STATUS_INIT #undef STATUS_INIT
...@@ -1855,7 +1840,7 @@ env_get_engine_status_num_rows (DB_ENV * UU(env), uint64_t * num_rowsp) { ...@@ -1855,7 +1840,7 @@ env_get_engine_status_num_rows (DB_ENV * UU(env), uint64_t * num_rowsp) {
// because of a race condition. // because of a race condition.
// Note, engine status is still collected even if the environment or logger is panicked // Note, engine status is still collected even if the environment or logger is panicked
static int static int
env_get_engine_status (DB_ENV * env, TOKU_ENGINE_STATUS_ROW engstat, uint64_t maxrows, fs_redzone_state* redzone_state, uint64_t * env_panicp, char * env_panic_string_buf, int env_panic_string_length) { env_get_engine_status (DB_ENV * env, TOKU_ENGINE_STATUS_ROW engstat, uint64_t maxrows, uint64_t *num_rows, fs_redzone_state* redzone_state, uint64_t * env_panicp, char * env_panic_string_buf, int env_panic_string_length, toku_engine_status_include_type include_flags) {
int r; int r;
if (env_panic_string_buf) { if (env_panic_string_buf) {
...@@ -1869,7 +1854,9 @@ env_get_engine_status (DB_ENV * env, TOKU_ENGINE_STATUS_ROW engstat, uint64_t ma ...@@ -1869,7 +1854,9 @@ env_get_engine_status (DB_ENV * env, TOKU_ENGINE_STATUS_ROW engstat, uint64_t ma
if ( !(env) || if ( !(env) ||
!(env->i) || !(env->i) ||
!(env_opened(env)) ) !(env_opened(env)) ||
!num_rows ||
!include_flags)
r = EINVAL; r = EINVAL;
else { else {
r = 0; r = 0;
...@@ -1880,131 +1867,170 @@ env_get_engine_status (DB_ENV * env, TOKU_ENGINE_STATUS_ROW engstat, uint64_t ma ...@@ -1880,131 +1867,170 @@ env_get_engine_status (DB_ENV * env, TOKU_ENGINE_STATUS_ROW engstat, uint64_t ma
YDB_LAYER_STATUS_S ydb_stat; YDB_LAYER_STATUS_S ydb_stat;
ydb_layer_get_status(env, &ydb_stat); ydb_layer_get_status(env, &ydb_stat);
for (int i = 0; i < YDB_LAYER_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < YDB_LAYER_STATUS_NUM_ROWS && row < maxrows; i++) {
if (ydb_stat.status[i].include & include_flags) {
engstat[row++] = ydb_stat.status[i]; engstat[row++] = ydb_stat.status[i];
} }
} }
}
{ {
YDB_C_LAYER_STATUS_S ydb_c_stat; YDB_C_LAYER_STATUS_S ydb_c_stat;
ydb_c_layer_get_status(&ydb_c_stat); ydb_c_layer_get_status(&ydb_c_stat);
for (int i = 0; i < YDB_C_LAYER_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < YDB_C_LAYER_STATUS_NUM_ROWS && row < maxrows; i++) {
if (ydb_c_stat.status[i].include & include_flags) {
engstat[row++] = ydb_c_stat.status[i]; engstat[row++] = ydb_c_stat.status[i];
} }
} }
}
{ {
YDB_WRITE_LAYER_STATUS_S ydb_write_stat; YDB_WRITE_LAYER_STATUS_S ydb_write_stat;
ydb_write_layer_get_status(&ydb_write_stat); ydb_write_layer_get_status(&ydb_write_stat);
for (int i = 0; i < YDB_WRITE_LAYER_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < YDB_WRITE_LAYER_STATUS_NUM_ROWS && row < maxrows; i++) {
if (ydb_write_stat.status[i].include & include_flags) {
engstat[row++] = ydb_write_stat.status[i]; engstat[row++] = ydb_write_stat.status[i];
} }
} }
}
{ {
LE_STATUS_S lestat; // Rice's vampire LE_STATUS_S lestat; // Rice's vampire
toku_le_get_status(&lestat); toku_le_get_status(&lestat);
for (int i = 0; i < LE_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < LE_STATUS_NUM_ROWS && row < maxrows; i++) {
if (lestat.status[i].include & include_flags) {
engstat[row++] = lestat.status[i]; engstat[row++] = lestat.status[i];
} }
} }
}
{ {
CHECKPOINT_STATUS_S cpstat; CHECKPOINT_STATUS_S cpstat;
toku_checkpoint_get_status(env->i->cachetable, &cpstat); toku_checkpoint_get_status(env->i->cachetable, &cpstat);
for (int i = 0; i < CP_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < CP_STATUS_NUM_ROWS && row < maxrows; i++) {
if (cpstat.status[i].include & include_flags) {
engstat[row++] = cpstat.status[i]; engstat[row++] = cpstat.status[i];
} }
} }
}
{ {
CACHETABLE_STATUS_S ctstat; CACHETABLE_STATUS_S ctstat;
toku_cachetable_get_status(env->i->cachetable, &ctstat); toku_cachetable_get_status(env->i->cachetable, &ctstat);
for (int i = 0; i < CT_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < CT_STATUS_NUM_ROWS && row < maxrows; i++) {
if (ctstat.status[i].include & include_flags) {
engstat[row++] = ctstat.status[i]; engstat[row++] = ctstat.status[i];
} }
} }
}
{ {
LTM_STATUS_S ltmstat; LTM_STATUS_S ltmstat;
env->i->ltm.get_status(&ltmstat); env->i->ltm.get_status(&ltmstat);
for (int i = 0; i < LTM_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < LTM_STATUS_NUM_ROWS && row < maxrows; i++) {
if (ltmstat.status[i].include & include_flags) {
engstat[row++] = ltmstat.status[i]; engstat[row++] = ltmstat.status[i];
} }
} }
}
{ {
FT_STATUS_S ftstat; FT_STATUS_S ftstat;
toku_ft_get_status(&ftstat); toku_ft_get_status(&ftstat);
for (int i = 0; i < FT_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < FT_STATUS_NUM_ROWS && row < maxrows; i++) {
if (ftstat.status[i].include & include_flags) {
engstat[row++] = ftstat.status[i]; engstat[row++] = ftstat.status[i];
} }
} }
}
{ {
FT_FLUSHER_STATUS_S flusherstat; FT_FLUSHER_STATUS_S flusherstat;
toku_ft_flusher_get_status(&flusherstat); toku_ft_flusher_get_status(&flusherstat);
for (int i = 0; i < FT_FLUSHER_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < FT_FLUSHER_STATUS_NUM_ROWS && row < maxrows; i++) {
if (flusherstat.status[i].include & include_flags) {
engstat[row++] = flusherstat.status[i]; engstat[row++] = flusherstat.status[i];
} }
} }
}
{ {
FT_HOT_STATUS_S hotstat; FT_HOT_STATUS_S hotstat;
toku_ft_hot_get_status(&hotstat); toku_ft_hot_get_status(&hotstat);
for (int i = 0; i < FT_HOT_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < FT_HOT_STATUS_NUM_ROWS && row < maxrows; i++) {
if (hotstat.status[i].include & include_flags) {
engstat[row++] = hotstat.status[i]; engstat[row++] = hotstat.status[i];
} }
} }
}
{ {
TXN_STATUS_S txnstat; TXN_STATUS_S txnstat;
toku_txn_get_status(&txnstat); toku_txn_get_status(&txnstat);
for (int i = 0; i < TXN_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < TXN_STATUS_NUM_ROWS && row < maxrows; i++) {
if (txnstat.status[i].include & include_flags) {
engstat[row++] = txnstat.status[i]; engstat[row++] = txnstat.status[i];
} }
} }
}
{ {
LOGGER_STATUS_S loggerstat; LOGGER_STATUS_S loggerstat;
toku_logger_get_status(env->i->logger, &loggerstat); toku_logger_get_status(env->i->logger, &loggerstat);
for (int i = 0; i < LOGGER_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < LOGGER_STATUS_NUM_ROWS && row < maxrows; i++) {
if (loggerstat.status[i].include & include_flags) {
engstat[row++] = loggerstat.status[i]; engstat[row++] = loggerstat.status[i];
} }
} }
}
{ {
INDEXER_STATUS_S indexerstat; INDEXER_STATUS_S indexerstat;
toku_indexer_get_status(&indexerstat); toku_indexer_get_status(&indexerstat);
for (int i = 0; i < INDEXER_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < INDEXER_STATUS_NUM_ROWS && row < maxrows; i++) {
if (indexerstat.status[i].include & include_flags) {
engstat[row++] = indexerstat.status[i]; engstat[row++] = indexerstat.status[i];
} }
} }
}
{ {
LOADER_STATUS_S loaderstat; LOADER_STATUS_S loaderstat;
toku_loader_get_status(&loaderstat); toku_loader_get_status(&loaderstat);
for (int i = 0; i < LOADER_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < LOADER_STATUS_NUM_ROWS && row < maxrows; i++) {
if (loaderstat.status[i].include & include_flags) {
engstat[row++] = loaderstat.status[i]; engstat[row++] = loaderstat.status[i];
} }
} }
}
{ {
// memory_status is local to this file // memory_status is local to this file
memory_get_status(); memory_get_status();
for (int i = 0; i < MEMORY_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < MEMORY_STATUS_NUM_ROWS && row < maxrows; i++) {
if (memory_status.status[i].include & include_flags) {
engstat[row++] = memory_status.status[i]; engstat[row++] = memory_status.status[i];
} }
} }
}
{ {
// Note, fs_get_status() and the fsstat structure are local to this file because they // Note, fs_get_status() and the fsstat structure are local to this file because they
// are used to concentrate file system information collected from various places. // are used to concentrate file system information collected from various places.
fs_get_status(env, redzone_state); fs_get_status(env, redzone_state);
for (int i = 0; i < FS_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < FS_STATUS_NUM_ROWS && row < maxrows; i++) {
if (fsstat.status[i].include & include_flags) {
engstat[row++] = fsstat.status[i]; engstat[row++] = fsstat.status[i];
} }
} }
}
#if 0 #if 0
// enable when upgrade is supported // enable when upgrade is supported
{ {
for (int i = 0; i < PERSISTENT_UPGRADE_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < PERSISTENT_UPGRADE_STATUS_NUM_ROWS && row < maxrows; i++) {
if (persistent_upgrade_status.status[i].include & include_flags) {
engstat[row++] = persistent_upgrade_status.status[i]; engstat[row++] = persistent_upgrade_status.status[i];
} }
}
FT_UPGRADE_STATUS_S ft_upgradestat; FT_UPGRADE_STATUS_S ft_upgradestat;
toku_ft_upgrade_get_status(&ft_upgradestat); toku_ft_upgrade_get_status(&ft_upgradestat);
for (int i = 0; i < FT_UPGRADE_STATUS_NUM_ROWS && row < maxrows; i++) { for (int i = 0; i < FT_UPGRADE_STATUS_NUM_ROWS && row < maxrows; i++) {
if (ft_upgradestat.status[i].include & include_flags) {
engstat[row++] = ft_upgradestat.status[i]; engstat[row++] = ft_upgradestat.status[i];
} }
}
} }
#endif #endif
if (r==0) {
*num_rows = row;
}
} }
return r; return r;
} }
...@@ -2019,13 +2045,14 @@ env_get_engine_status_text(DB_ENV * env, char * buff, int bufsiz) { ...@@ -2019,13 +2045,14 @@ env_get_engine_status_text(DB_ENV * env, char * buff, int bufsiz) {
char panicstring[stringsize]; char panicstring[stringsize];
int n = 0; // number of characters printed so far int n = 0; // number of characters printed so far
uint64_t num_rows; uint64_t num_rows;
uint64_t max_rows;
fs_redzone_state redzone_state; fs_redzone_state redzone_state;
n = snprintf(buff, bufsiz - n, "BUILD_ID = %d\n", BUILD_ID); n = snprintf(buff, bufsiz - n, "BUILD_ID = %d\n", BUILD_ID);
(void) env_get_engine_status_num_rows (env, &num_rows); (void) env_get_engine_status_num_rows (env, &max_rows);
TOKU_ENGINE_STATUS_ROW_S mystat[num_rows]; TOKU_ENGINE_STATUS_ROW_S mystat[max_rows];
int r = env->get_engine_status (env, mystat, num_rows, &redzone_state, &panic, panicstring, stringsize); int r = env->get_engine_status (env, mystat, max_rows, &num_rows, &redzone_state, &panic, panicstring, stringsize, TOKU_ENGINE_STATUS);
if (r) { if (r) {
n += snprintf(buff + n, bufsiz - n, "Engine status not available: "); n += snprintf(buff + n, bufsiz - n, "Engine status not available: ");
......
...@@ -19,11 +19,7 @@ static YDB_C_LAYER_STATUS_S ydb_c_layer_status; ...@@ -19,11 +19,7 @@ static YDB_C_LAYER_STATUS_S ydb_c_layer_status;
#endif #endif
#define STATUS_VALUE(x) ydb_c_layer_status.status[x].value.num #define STATUS_VALUE(x) ydb_c_layer_status.status[x].value.num
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(ydb_c_layer_status, k, t, l, inc)
ydb_c_layer_status.status[k].keyname = #k; \
ydb_c_layer_status.status[k].type = t; \
ydb_c_layer_status.status[k].legend = l; \
}
static void static void
ydb_c_layer_status_init (void) { ydb_c_layer_status_init (void) {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "ydb_load.h" #include "ydb_load.h"
#include "indexer.h" #include "indexer.h"
#include <portability/toku_atomic.h> #include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
static YDB_DB_LAYER_STATUS_S ydb_db_layer_status; static YDB_DB_LAYER_STATUS_S ydb_db_layer_status;
#ifdef STATUS_VALUE #ifdef STATUS_VALUE
...@@ -28,21 +29,17 @@ static YDB_DB_LAYER_STATUS_S ydb_db_layer_status; ...@@ -28,21 +29,17 @@ static YDB_DB_LAYER_STATUS_S ydb_db_layer_status;
#endif #endif
#define STATUS_VALUE(x) ydb_db_layer_status.status[x].value.num #define STATUS_VALUE(x) ydb_db_layer_status.status[x].value.num
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(ydb_db_layer_status, k, t, l, inc)
ydb_db_layer_status.status[k].keyname = #k; \
ydb_db_layer_status.status[k].type = t; \
ydb_db_layer_status.status[k].legend = l; \
}
static void static void
ydb_db_layer_status_init (void) { ydb_db_layer_status_init (void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(YDB_LAYER_DIRECTORY_WRITE_LOCKS, UINT64, "directory write locks"); STATUS_INIT(YDB_LAYER_DIRECTORY_WRITE_LOCKS, UINT64, "directory write locks", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_DIRECTORY_WRITE_LOCKS_FAIL, UINT64, "directory write locks fail"); STATUS_INIT(YDB_LAYER_DIRECTORY_WRITE_LOCKS_FAIL, UINT64, "directory write locks fail", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_LOGSUPPRESS, UINT64, "log suppress"); STATUS_INIT(YDB_LAYER_LOGSUPPRESS, UINT64, "log suppress", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_LOGSUPPRESS_FAIL, UINT64, "log suppress fail"); STATUS_INIT(YDB_LAYER_LOGSUPPRESS_FAIL, UINT64, "log suppress fail", TOKU_ENGINE_STATUS);
ydb_db_layer_status.initialized = true; ydb_db_layer_status.initialized = true;
} }
#undef STATUS_INIT #undef STATUS_INIT
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "ydb_write.h" #include "ydb_write.h"
#include "ydb_db.h" #include "ydb_db.h"
#include <portability/toku_atomic.h> #include <portability/toku_atomic.h>
#include <util/partitioned_counter.h>
static YDB_WRITE_LAYER_STATUS_S ydb_write_layer_status; static YDB_WRITE_LAYER_STATUS_S ydb_write_layer_status;
#ifdef STATUS_VALUE #ifdef STATUS_VALUE
...@@ -20,30 +21,26 @@ static YDB_WRITE_LAYER_STATUS_S ydb_write_layer_status; ...@@ -20,30 +21,26 @@ static YDB_WRITE_LAYER_STATUS_S ydb_write_layer_status;
#endif #endif
#define STATUS_VALUE(x) ydb_write_layer_status.status[x].value.num #define STATUS_VALUE(x) ydb_write_layer_status.status[x].value.num
#define STATUS_INIT(k,t,l) { \ #define STATUS_INIT(k,t,l, inc) TOKUDB_STATUS_INIT(ydb_write_layer_status, k, t, l, inc)
ydb_write_layer_status.status[k].keyname = #k; \
ydb_write_layer_status.status[k].type = t; \
ydb_write_layer_status.status[k].legend = l; \
}
static void static void
ydb_write_layer_status_init (void) { ydb_write_layer_status_init (void) {
// Note, this function initializes the keyname, type, and legend fields. // Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler. // Value fields are initialized to zero by compiler.
STATUS_INIT(YDB_LAYER_NUM_INSERTS, UINT64, "dictionary inserts"); STATUS_INIT(YDB_LAYER_NUM_INSERTS, UINT64, "dictionary inserts", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_INSERTS_FAIL, UINT64, "dictionary inserts fail"); STATUS_INIT(YDB_LAYER_NUM_INSERTS_FAIL, UINT64, "dictionary inserts fail", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_DELETES, UINT64, "dictionary deletes"); STATUS_INIT(YDB_LAYER_NUM_DELETES, UINT64, "dictionary deletes", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_DELETES_FAIL, UINT64, "dictionary deletes fail"); STATUS_INIT(YDB_LAYER_NUM_DELETES_FAIL, UINT64, "dictionary deletes fail", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_UPDATES, UINT64, "dictionary updates"); STATUS_INIT(YDB_LAYER_NUM_UPDATES, UINT64, "dictionary updates", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_UPDATES_FAIL, UINT64, "dictionary updates fail"); STATUS_INIT(YDB_LAYER_NUM_UPDATES_FAIL, UINT64, "dictionary updates fail", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_UPDATES_BROADCAST, UINT64, "dictionary broadcast updates"); STATUS_INIT(YDB_LAYER_NUM_UPDATES_BROADCAST, UINT64, "dictionary broadcast updates", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_UPDATES_BROADCAST_FAIL, UINT64, "dictionary broadcast updates fail"); STATUS_INIT(YDB_LAYER_NUM_UPDATES_BROADCAST_FAIL, UINT64, "dictionary broadcast updates fail", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_MULTI_INSERTS, UINT64, "dictionary multi inserts"); STATUS_INIT(YDB_LAYER_NUM_MULTI_INSERTS, UINT64, "dictionary multi inserts", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_MULTI_INSERTS_FAIL, UINT64, "dictionary multi inserts fail"); STATUS_INIT(YDB_LAYER_NUM_MULTI_INSERTS_FAIL, UINT64, "dictionary multi inserts fail", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_MULTI_DELETES, UINT64, "dictionary multi deletes"); STATUS_INIT(YDB_LAYER_NUM_MULTI_DELETES, UINT64, "dictionary multi deletes", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_MULTI_DELETES_FAIL, UINT64, "dictionary multi deletes fail"); STATUS_INIT(YDB_LAYER_NUM_MULTI_DELETES_FAIL, UINT64, "dictionary multi deletes fail", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_MULTI_UPDATES, UINT64, "dictionary updates multi"); STATUS_INIT(YDB_LAYER_NUM_MULTI_UPDATES, UINT64, "dictionary updates multi", TOKU_ENGINE_STATUS);
STATUS_INIT(YDB_LAYER_NUM_MULTI_UPDATES_FAIL, UINT64, "dictionary updates multi fail"); STATUS_INIT(YDB_LAYER_NUM_MULTI_UPDATES_FAIL, UINT64, "dictionary updates multi fail", TOKU_ENGINE_STATUS);
ydb_write_layer_status.initialized = true; ydb_write_layer_status.initialized = true;
} }
#undef STATUS_INIT #undef STATUS_INIT
......
...@@ -58,6 +58,17 @@ void partitioned_counters_init(void); ...@@ -58,6 +58,17 @@ void partitioned_counters_init(void);
void partitioned_counters_destroy(void); void partitioned_counters_destroy(void);
// Effect: Destroy any partitioned counters data structures. // Effect: Destroy any partitioned counters data structures.
#define TOKUDB_STATUS_INIT(array, k, t, l, inc) do { \
array.status[k].keyname = #k; \
array.status[k].type = t; \
array.status[k].legend = l; \
static_assert((inc) != 0, "Var must be included in at least one place"); \
array.status[k].include = static_cast<toku_engine_status_include_type>(inc); \
if (t == PARCOUNT) { \
array.status[k].value.parcount = create_partitioned_counter(); \
} \
} while (0)
#if 0 #if 0
#include <pthread.h> #include <pthread.h>
#include "fttypes.h" #include "fttypes.h"
......
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