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,20 +623,29 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) { ...@@ -623,20 +623,29 @@ 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");
printf(" CHARSTR, // interpret as char * \n"); printf(" CHARSTR, // interpret as char * \n");
printf(" UNIXTIME, // interpret as time_t \n"); printf(" UNIXTIME, // interpret as time_t \n");
printf(" TOKUTIME, // interpret as tokutime_t \n"); printf(" TOKUTIME, // interpret as tokutime_t \n");
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;
} }
......
This diff is collapsed.
...@@ -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++) {
......
This diff is collapsed.
...@@ -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