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

[t:2504] Improve engine status.

git-svn-id: file:///svn/toku/tokudb@20077 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2b27ce98
...@@ -57,6 +57,7 @@ struct __toku_loader { ...@@ -57,6 +57,7 @@ struct __toku_loader {
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */ int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char startuptime[26]; /* time of engine startup */
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */ u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */
u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */ u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */
...@@ -76,6 +77,15 @@ typedef struct __toku_engine_status { ...@@ -76,6 +77,15 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin[26]; /* time of last checkpoint begin */ char checkpoint_time_begin[26]; /* time of last checkpoint begin */
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */
u_int64_t txn_close; /* txn completions (should equal commit+abort) */
u_int64_t txn_oldest_live; /* oldest extant txn */
u_int64_t next_lsn; /* lsn that will be assigned to next log entry */
u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */ u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */
u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */ u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */
u_int64_t cachetable_hit; /* how many cache hits */ u_int64_t cachetable_hit; /* how many cache hits */
...@@ -93,27 +103,46 @@ typedef struct __toku_engine_status { ...@@ -93,27 +103,46 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */ int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
int64_t local_checkpoint_files; /* number of files subjec to local checkpoint is taken for commit */
int64_t local_checkpoint_during_checkpoint; /* number of times a local checkpoint happens during normal checkpoint */
u_int32_t range_locks_max; /* max total number of range locks */ u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */ u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */ u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */ u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */ u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */ u_int64_t range_read_locks; /* total range read locks taken */
u_int64_t deletes; /* ydb row delete operations */ u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */
u_int64_t commits; /* ydb txn commit operations */ u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */
u_int64_t aborts; /* ydb txn abort operations */ u_int64_t range_write_locks; /* total range write locks taken */
u_int64_t point_queries; /* ydb point queries */ u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */
u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */
u_int64_t fsync_count; /* number of times fsync performed */ u_int64_t inserts; /* ydb row insert operations */
u_int64_t fsync_time; /* total time required to fsync */ u_int64_t inserts_fail; /* ydb row insert operations that failed */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t deletes_fail; /* ydb row delete operations that failed */
u_int64_t point_queries; /* ydb point queries */
u_int64_t sequential_queries; /* ydb sequential queries */
u_int64_t fsync_count; /* number of times fsync performed */
u_int64_t fsync_time; /* total time required to fsync */
u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */ u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */
u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */ u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */
u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */ u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */
char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */ char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */
u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */ u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */
u_int64_t enospc_total; /* how many times has ENOSPC been returned by disk write */ u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */
u_int64_t enospc_seal_ctr; /* how many times has ENOSPC been returned to user (red zone) */ u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */
u_int64_t enospc_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */ u_int64_t enospc_state; /* state of ydb-level ENOSPC prevention (0 = green, 1 = yellow, 2 = red) */
u_int64_t loader_create; /* number of loaders created */
u_int64_t loader_create_fail; /* number of failed loader creations */
u_int64_t loader_put; /* number of loader puts */
u_int64_t loader_close; /* number of loaders closed (succeed or fail) */
u_int64_t loader_close_fail; /* number of loaders closed with error return */
u_int64_t loader_abort; /* number of loaders aborted */
u_int32_t loader_current; /* number of loaders currently existing */
u_int32_t loader_max; /* max number of loaders extant simultaneously */
u_int64_t logsuppress; /* number of times logging is suppressed */
u_int64_t logsuppressfail; /* number of times logging cannot be suppressed */
} ENGINE_STATUS; } ENGINE_STATUS;
typedef enum { typedef enum {
DB_BTREE=1, DB_BTREE=1,
......
...@@ -57,6 +57,7 @@ struct __toku_loader { ...@@ -57,6 +57,7 @@ struct __toku_loader {
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */ int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char startuptime[26]; /* time of engine startup */
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */ u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */
u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */ u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */
...@@ -76,6 +77,15 @@ typedef struct __toku_engine_status { ...@@ -76,6 +77,15 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin[26]; /* time of last checkpoint begin */ char checkpoint_time_begin[26]; /* time of last checkpoint begin */
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */
u_int64_t txn_close; /* txn completions (should equal commit+abort) */
u_int64_t txn_oldest_live; /* oldest extant txn */
u_int64_t next_lsn; /* lsn that will be assigned to next log entry */
u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */ u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */
u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */ u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */
u_int64_t cachetable_hit; /* how many cache hits */ u_int64_t cachetable_hit; /* how many cache hits */
...@@ -93,27 +103,46 @@ typedef struct __toku_engine_status { ...@@ -93,27 +103,46 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */ int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
int64_t local_checkpoint_files; /* number of files subjec to local checkpoint is taken for commit */
int64_t local_checkpoint_during_checkpoint; /* number of times a local checkpoint happens during normal checkpoint */
u_int32_t range_locks_max; /* max total number of range locks */ u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */ u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */ u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */ u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */ u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */ u_int64_t range_read_locks; /* total range read locks taken */
u_int64_t deletes; /* ydb row delete operations */ u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */
u_int64_t commits; /* ydb txn commit operations */ u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */
u_int64_t aborts; /* ydb txn abort operations */ u_int64_t range_write_locks; /* total range write locks taken */
u_int64_t point_queries; /* ydb point queries */ u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */
u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */
u_int64_t fsync_count; /* number of times fsync performed */ u_int64_t inserts; /* ydb row insert operations */
u_int64_t fsync_time; /* total time required to fsync */ u_int64_t inserts_fail; /* ydb row insert operations that failed */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t deletes_fail; /* ydb row delete operations that failed */
u_int64_t point_queries; /* ydb point queries */
u_int64_t sequential_queries; /* ydb sequential queries */
u_int64_t fsync_count; /* number of times fsync performed */
u_int64_t fsync_time; /* total time required to fsync */
u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */ u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */
u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */ u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */
u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */ u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */
char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */ char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */
u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */ u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */
u_int64_t enospc_total; /* how many times has ENOSPC been returned by disk write */ u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */
u_int64_t enospc_seal_ctr; /* how many times has ENOSPC been returned to user (red zone) */ u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */
u_int64_t enospc_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */ u_int64_t enospc_state; /* state of ydb-level ENOSPC prevention (0 = green, 1 = yellow, 2 = red) */
u_int64_t loader_create; /* number of loaders created */
u_int64_t loader_create_fail; /* number of failed loader creations */
u_int64_t loader_put; /* number of loader puts */
u_int64_t loader_close; /* number of loaders closed (succeed or fail) */
u_int64_t loader_close_fail; /* number of loaders closed with error return */
u_int64_t loader_abort; /* number of loaders aborted */
u_int32_t loader_current; /* number of loaders currently existing */
u_int32_t loader_max; /* max number of loaders extant simultaneously */
u_int64_t logsuppress; /* number of times logging is suppressed */
u_int64_t logsuppressfail; /* number of times logging cannot be suppressed */
} ENGINE_STATUS; } ENGINE_STATUS;
typedef enum { typedef enum {
DB_BTREE=1, DB_BTREE=1,
......
This diff is collapsed.
This diff is collapsed.
...@@ -13,9 +13,9 @@ extern "C" { ...@@ -13,9 +13,9 @@ extern "C" {
#define TOKUDB_NATIVE_H 0 #define TOKUDB_NATIVE_H 0
#define DB_VERSION_MAJOR 4 #define DB_VERSION_MAJOR 4
#define DB_VERSION_MINOR 6 #define DB_VERSION_MINOR 6
#define DB_VERSION_PATCH 19 #define DB_VERSION_PATCH 21
#ifndef _TOKUDB_WRAP_H #ifndef _TOKUDB_WRAP_H
#define DB_VERSION_STRING "Tokutek: TokuDB 4.6.19" #define DB_VERSION_STRING "Tokutek: TokuDB 4.6.21"
#else #else
#define DB_VERSION_STRING_ydb "Tokutek: TokuDB (wrapped bdb)" #define DB_VERSION_STRING_ydb "Tokutek: TokuDB (wrapped bdb)"
#endif #endif
...@@ -57,6 +57,7 @@ struct __toku_loader { ...@@ -57,6 +57,7 @@ struct __toku_loader {
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */ int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char startuptime[26]; /* time of engine startup */
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */ u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */
u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */ u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */
...@@ -76,6 +77,15 @@ typedef struct __toku_engine_status { ...@@ -76,6 +77,15 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin[26]; /* time of last checkpoint begin */ char checkpoint_time_begin[26]; /* time of last checkpoint begin */
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */
u_int64_t txn_close; /* txn completions (should equal commit+abort) */
u_int64_t txn_oldest_live; /* oldest extant txn */
u_int64_t next_lsn; /* lsn that will be assigned to next log entry */
u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */ u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */
u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */ u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */
u_int64_t cachetable_hit; /* how many cache hits */ u_int64_t cachetable_hit; /* how many cache hits */
...@@ -93,27 +103,46 @@ typedef struct __toku_engine_status { ...@@ -93,27 +103,46 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */ int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
int64_t local_checkpoint_files; /* number of files subjec to local checkpoint is taken for commit */
int64_t local_checkpoint_during_checkpoint; /* number of times a local checkpoint happens during normal checkpoint */
u_int32_t range_locks_max; /* max total number of range locks */ u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */ u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */ u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */ u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */ u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */ u_int64_t range_read_locks; /* total range read locks taken */
u_int64_t deletes; /* ydb row delete operations */ u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */
u_int64_t commits; /* ydb txn commit operations */ u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */
u_int64_t aborts; /* ydb txn abort operations */ u_int64_t range_write_locks; /* total range write locks taken */
u_int64_t point_queries; /* ydb point queries */ u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */
u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */
u_int64_t fsync_count; /* number of times fsync performed */ u_int64_t inserts; /* ydb row insert operations */
u_int64_t fsync_time; /* total time required to fsync */ u_int64_t inserts_fail; /* ydb row insert operations that failed */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t deletes_fail; /* ydb row delete operations that failed */
u_int64_t point_queries; /* ydb point queries */
u_int64_t sequential_queries; /* ydb sequential queries */
u_int64_t fsync_count; /* number of times fsync performed */
u_int64_t fsync_time; /* total time required to fsync */
u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */ u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */
u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */ u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */
u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */ u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */
char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */ char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */
u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */ u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */
u_int64_t enospc_total; /* how many times has ENOSPC been returned by disk write */ u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */
u_int64_t enospc_seal_ctr; /* how many times has ENOSPC been returned to user (red zone) */ u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */
u_int64_t enospc_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */ u_int64_t enospc_state; /* state of ydb-level ENOSPC prevention (0 = green, 1 = yellow, 2 = red) */
u_int64_t loader_create; /* number of loaders created */
u_int64_t loader_create_fail; /* number of failed loader creations */
u_int64_t loader_put; /* number of loader puts */
u_int64_t loader_close; /* number of loaders closed (succeed or fail) */
u_int64_t loader_close_fail; /* number of loaders closed with error return */
u_int64_t loader_abort; /* number of loaders aborted */
u_int32_t loader_current; /* number of loaders currently existing */
u_int32_t loader_max; /* max number of loaders extant simultaneously */
u_int64_t logsuppress; /* number of times logging is suppressed */
u_int64_t logsuppressfail; /* number of times logging cannot be suppressed */
} ENGINE_STATUS; } ENGINE_STATUS;
typedef enum { typedef enum {
DB_BTREE=1, DB_BTREE=1,
......
...@@ -418,6 +418,7 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__ ...@@ -418,6 +418,7 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
//engine status info //engine status info
printf("typedef struct __toku_engine_status {\n"); printf("typedef struct __toku_engine_status {\n");
printf(" char startuptime[26]; /* time of engine startup */ \n");
printf(" char now[26]; /* time of engine status query (i.e. now) */ \n"); printf(" char now[26]; /* time of engine status query (i.e. now) */ \n");
printf(" u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */ \n"); printf(" u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */ \n");
printf(" u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */ \n"); printf(" u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */ \n");
...@@ -437,6 +438,15 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__ ...@@ -437,6 +438,15 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
printf(" char checkpoint_time_begin[26]; /* time of last checkpoint begin */ \n"); printf(" char checkpoint_time_begin[26]; /* time of last checkpoint begin */ \n");
printf(" char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ \n"); printf(" char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ \n");
printf(" char checkpoint_time_end[26]; /* time of last checkpoint end */ \n"); printf(" char checkpoint_time_end[26]; /* time of last checkpoint end */ \n");
printf(" u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */ \n");
printf(" u_int32_t checkpoint_count; /* number of checkpoints taken */ \n");
printf(" u_int32_t checkpoint_count_fail; /* number of checkpoints failed */ \n");
printf(" u_int64_t txn_begin; /* number of transactions ever begun */ \n");
printf(" u_int64_t txn_commit; /* txn commit operations */ \n");
printf(" u_int64_t txn_abort; /* txn abort operations */ \n");
printf(" u_int64_t txn_close; /* txn completions (should equal commit+abort) */ \n");
printf(" u_int64_t txn_oldest_live; /* oldest extant txn */ \n");
printf(" u_int64_t next_lsn; /* lsn that will be assigned to next log entry */ \n");
printf(" u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */ \n"); printf(" u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */ \n");
printf(" u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */ \n"); printf(" u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */ \n");
printf(" u_int64_t cachetable_hit; /* how many cache hits */ \n"); printf(" u_int64_t cachetable_hit; /* how many cache hits */ \n");
...@@ -454,27 +464,46 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__ ...@@ -454,27 +464,46 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
printf(" int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */ \n"); printf(" int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */ \n");
printf(" int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ \n"); printf(" int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ \n");
printf(" int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ \n"); printf(" int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ \n");
printf(" int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */ \n");
printf(" int64_t local_checkpoint_files; /* number of files subjec to local checkpoint is taken for commit */ \n");
printf(" int64_t local_checkpoint_during_checkpoint; /* number of times a local checkpoint happens during normal checkpoint */ \n");
printf(" u_int32_t range_locks_max; /* max total number of range locks */ \n"); printf(" u_int32_t range_locks_max; /* max total number of range locks */ \n");
printf(" u_int32_t range_locks_max_per_index; /* max range locks per dictionary */ \n"); printf(" u_int32_t range_locks_max_per_index; /* max range locks per dictionary */ \n");
printf(" u_int32_t range_locks_curr; /* total range locks currently in use */ \n"); printf(" u_int32_t range_locks_curr; /* total range locks currently in use */ \n");
printf(" u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */ \n"); printf(" u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */ \n");
printf(" u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */ \n"); printf(" u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */ \n");
printf(" u_int64_t inserts; /* ydb row insert operations */ \n"); printf(" u_int64_t range_read_locks; /* total range read locks taken */ \n");
printf(" u_int64_t deletes; /* ydb row delete operations */ \n"); printf(" u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */ \n");
printf(" u_int64_t commits; /* ydb txn commit operations */ \n"); printf(" u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */ \n");
printf(" u_int64_t aborts; /* ydb txn abort operations */ \n"); printf(" u_int64_t range_write_locks; /* total range write locks taken */ \n");
printf(" u_int64_t point_queries; /* ydb point queries */ \n"); printf(" u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */ \n");
printf(" u_int64_t sequential_queries; /* ydb sequential queries */ \n"); printf(" u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */ \n");
printf(" u_int64_t fsync_count; /* number of times fsync performed */ \n"); printf(" u_int64_t inserts; /* ydb row insert operations */ \n");
printf(" u_int64_t fsync_time; /* total time required to fsync */ \n"); printf(" u_int64_t inserts_fail; /* ydb row insert operations that failed */ \n");
printf(" u_int64_t deletes; /* ydb row delete operations */ \n");
printf(" u_int64_t deletes_fail; /* ydb row delete operations that failed */ \n");
printf(" u_int64_t point_queries; /* ydb point queries */ \n");
printf(" u_int64_t sequential_queries; /* ydb sequential queries */ \n");
printf(" u_int64_t fsync_count; /* number of times fsync performed */ \n");
printf(" u_int64_t fsync_time; /* total time required to fsync */ \n");
printf(" u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */ \n"); printf(" u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */ \n");
printf(" u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */ \n"); printf(" u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */ \n");
printf(" u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */ \n"); printf(" u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */ \n");
printf(" char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */ \n"); printf(" char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */ \n");
printf(" u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */ \n"); printf(" u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */ \n");
printf(" u_int64_t enospc_total; /* how many times has ENOSPC been returned by disk write */ \n"); printf(" u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */ \n");
printf(" u_int64_t enospc_seal_ctr; /* how many times has ENOSPC been returned to user (red zone) */ \n"); printf(" u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */ \n");
printf(" u_int64_t enospc_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */ \n"); printf(" u_int64_t enospc_state; /* state of ydb-level ENOSPC prevention (0 = green, 1 = yellow, 2 = red) */ \n");
printf(" u_int64_t loader_create; /* number of loaders created */ \n");
printf(" u_int64_t loader_create_fail; /* number of failed loader creations */ \n");
printf(" u_int64_t loader_put; /* number of loader puts */ \n");
printf(" u_int64_t loader_close; /* number of loaders closed (succeed or fail) */ \n");
printf(" u_int64_t loader_close_fail; /* number of loaders closed with error return */ \n");
printf(" u_int64_t loader_abort; /* number of loaders aborted */ \n");
printf(" u_int32_t loader_current; /* number of loaders currently existing */ \n");
printf(" u_int32_t loader_max; /* max number of loaders extant simultaneously */ \n");
printf(" u_int64_t logsuppress; /* number of times logging is suppressed */ \n");
printf(" u_int64_t logsuppressfail; /* number of times logging cannot be suppressed */ \n");
printf("} ENGINE_STATUS;\n"); printf("} ENGINE_STATUS;\n");
print_dbtype(); print_dbtype();
......
...@@ -57,6 +57,7 @@ struct __toku_loader { ...@@ -57,6 +57,7 @@ struct __toku_loader {
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */ int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char startuptime[26]; /* time of engine startup */
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */ u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */
u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */ u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */
...@@ -76,6 +77,15 @@ typedef struct __toku_engine_status { ...@@ -76,6 +77,15 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin[26]; /* time of last checkpoint begin */ char checkpoint_time_begin[26]; /* time of last checkpoint begin */
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */
u_int64_t txn_close; /* txn completions (should equal commit+abort) */
u_int64_t txn_oldest_live; /* oldest extant txn */
u_int64_t next_lsn; /* lsn that will be assigned to next log entry */
u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */ u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */
u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */ u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */
u_int64_t cachetable_hit; /* how many cache hits */ u_int64_t cachetable_hit; /* how many cache hits */
...@@ -93,27 +103,46 @@ typedef struct __toku_engine_status { ...@@ -93,27 +103,46 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */ int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
int64_t local_checkpoint_files; /* number of files subjec to local checkpoint is taken for commit */
int64_t local_checkpoint_during_checkpoint; /* number of times a local checkpoint happens during normal checkpoint */
u_int32_t range_locks_max; /* max total number of range locks */ u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */ u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */ u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */ u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */ u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */ u_int64_t range_read_locks; /* total range read locks taken */
u_int64_t deletes; /* ydb row delete operations */ u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */
u_int64_t commits; /* ydb txn commit operations */ u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */
u_int64_t aborts; /* ydb txn abort operations */ u_int64_t range_write_locks; /* total range write locks taken */
u_int64_t point_queries; /* ydb point queries */ u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */
u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */
u_int64_t fsync_count; /* number of times fsync performed */ u_int64_t inserts; /* ydb row insert operations */
u_int64_t fsync_time; /* total time required to fsync */ u_int64_t inserts_fail; /* ydb row insert operations that failed */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t deletes_fail; /* ydb row delete operations that failed */
u_int64_t point_queries; /* ydb point queries */
u_int64_t sequential_queries; /* ydb sequential queries */
u_int64_t fsync_count; /* number of times fsync performed */
u_int64_t fsync_time; /* total time required to fsync */
u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */ u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */
u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */ u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */
u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */ u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */
char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */ char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */
u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */ u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */
u_int64_t enospc_total; /* how many times has ENOSPC been returned by disk write */ u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */
u_int64_t enospc_seal_ctr; /* how many times has ENOSPC been returned to user (red zone) */ u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */
u_int64_t enospc_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */ u_int64_t enospc_state; /* state of ydb-level ENOSPC prevention (0 = green, 1 = yellow, 2 = red) */
u_int64_t loader_create; /* number of loaders created */
u_int64_t loader_create_fail; /* number of failed loader creations */
u_int64_t loader_put; /* number of loader puts */
u_int64_t loader_close; /* number of loaders closed (succeed or fail) */
u_int64_t loader_close_fail; /* number of loaders closed with error return */
u_int64_t loader_abort; /* number of loaders aborted */
u_int32_t loader_current; /* number of loaders currently existing */
u_int32_t loader_max; /* max number of loaders extant simultaneously */
u_int64_t logsuppress; /* number of times logging is suppressed */
u_int64_t logsuppressfail; /* number of times logging cannot be suppressed */
} ENGINE_STATUS; } ENGINE_STATUS;
typedef enum { typedef enum {
DB_BTREE=1, DB_BTREE=1,
......
...@@ -57,6 +57,7 @@ struct __toku_loader { ...@@ -57,6 +57,7 @@ struct __toku_loader {
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */ int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
}; };
typedef struct __toku_engine_status { typedef struct __toku_engine_status {
char startuptime[26]; /* time of engine startup */
char now[26]; /* time of engine status query (i.e. now) */ char now[26]; /* time of engine status query (i.e. now) */
u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */ u_int64_t ydb_lock_ctr; /* how many times has ydb lock been taken/released */
u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */ u_int64_t max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */
...@@ -76,6 +77,15 @@ typedef struct __toku_engine_status { ...@@ -76,6 +77,15 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin[26]; /* time of last checkpoint begin */ char checkpoint_time_begin[26]; /* time of last checkpoint begin */
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */
u_int64_t txn_close; /* txn completions (should equal commit+abort) */
u_int64_t txn_oldest_live; /* oldest extant txn */
u_int64_t next_lsn; /* lsn that will be assigned to next log entry */
u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */ u_int64_t cachetable_lock_taken; /* how many times has cachetable lock been taken */
u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */ u_int64_t cachetable_lock_released;/* how many times has cachetable lock been released */
u_int64_t cachetable_hit; /* how many cache hits */ u_int64_t cachetable_hit; /* how many cache hits */
...@@ -93,27 +103,46 @@ typedef struct __toku_engine_status { ...@@ -93,27 +103,46 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */ int64_t cachetable_size_limit; /* the limit to the sum of the node sizes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
int64_t local_checkpoint_files; /* number of files subjec to local checkpoint is taken for commit */
int64_t local_checkpoint_during_checkpoint; /* number of times a local checkpoint happens during normal checkpoint */
u_int32_t range_locks_max; /* max total number of range locks */ u_int32_t range_locks_max; /* max total number of range locks */
u_int32_t range_locks_max_per_index; /* max range locks per dictionary */ u_int32_t range_locks_max_per_index; /* max range locks per dictionary */
u_int32_t range_locks_curr; /* total range locks currently in use */ u_int32_t range_locks_curr; /* total range locks currently in use */
u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */ u_int32_t range_lock_escalation_successes; /* number of times range locks escalation succeeded */
u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */ u_int32_t range_lock_escalation_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */ u_int64_t range_read_locks; /* total range read locks taken */
u_int64_t deletes; /* ydb row delete operations */ u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */
u_int64_t commits; /* ydb txn commit operations */ u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */
u_int64_t aborts; /* ydb txn abort operations */ u_int64_t range_write_locks; /* total range write locks taken */
u_int64_t point_queries; /* ydb point queries */ u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */
u_int64_t sequential_queries; /* ydb sequential queries */ u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */
u_int64_t fsync_count; /* number of times fsync performed */ u_int64_t inserts; /* ydb row insert operations */
u_int64_t fsync_time; /* total time required to fsync */ u_int64_t inserts_fail; /* ydb row insert operations that failed */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t deletes_fail; /* ydb row delete operations that failed */
u_int64_t point_queries; /* ydb point queries */
u_int64_t sequential_queries; /* ydb sequential queries */
u_int64_t fsync_count; /* number of times fsync performed */
u_int64_t fsync_time; /* total time required to fsync */
u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */ u_int64_t logger_ilock_ctr; /* how many times has logger input lock been taken or released */
u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */ u_int64_t logger_olock_ctr; /* how many times has logger output condition lock been taken or released */
u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */ u_int64_t logger_swap_ctr; /* how many times have logger buffers been swapped */
char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */ char enospc_most_recent[26]; /* time of most recent ENOSPC error return from disk write */
u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */ u_int64_t enospc_threads_blocked; /* how many threads are currently blocked by ENOSPC */
u_int64_t enospc_total; /* how many times has ENOSPC been returned by disk write */ u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */
u_int64_t enospc_seal_ctr; /* how many times has ENOSPC been returned to user (red zone) */ u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */
u_int64_t enospc_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */ u_int64_t enospc_state; /* state of ydb-level ENOSPC prevention (0 = green, 1 = yellow, 2 = red) */
u_int64_t loader_create; /* number of loaders created */
u_int64_t loader_create_fail; /* number of failed loader creations */
u_int64_t loader_put; /* number of loader puts */
u_int64_t loader_close; /* number of loaders closed (succeed or fail) */
u_int64_t loader_close_fail; /* number of loaders closed with error return */
u_int64_t loader_abort; /* number of loaders aborted */
u_int32_t loader_current; /* number of loaders currently existing */
u_int32_t loader_max; /* max number of loaders extant simultaneously */
u_int64_t logsuppress; /* number of times logging is suppressed */
u_int64_t logsuppressfail; /* number of times logging cannot be suppressed */
} ENGINE_STATUS; } ENGINE_STATUS;
typedef enum { typedef enum {
DB_BTREE=1, DB_BTREE=1,
......
...@@ -59,9 +59,13 @@ static u_int64_t cachetable_maybe_get_and_pin_hits; // how many times has get_a ...@@ -59,9 +59,13 @@ static u_int64_t cachetable_maybe_get_and_pin_hits; // how many times has get_a
static u_int64_t cachetable_wait_checkpoint; // number of times get_and_pin waits for a node to be written for a checkpoint static u_int64_t cachetable_wait_checkpoint; // number of times get_and_pin waits for a node to be written for a checkpoint
static u_int64_t cachetable_misstime; // time spent waiting for disk read static u_int64_t cachetable_misstime; // time spent waiting for disk read
static u_int64_t cachetable_waittime; // time spent waiting for another thread to release lock (e.g. prefetch, writing) static u_int64_t cachetable_waittime; // time spent waiting for another thread to release lock (e.g. prefetch, writing)
static u_int64_t cachetable_lock_taken = 0; static u_int64_t cachetable_lock_taken = 0;
static u_int64_t cachetable_lock_released = 0; static u_int64_t cachetable_lock_released = 0;
static u_int64_t local_checkpoint; // number of times a local checkpoint was taken for a commit (2440)
static u_int64_t local_checkpoint_files; // number of files subject to local checkpoint taken for a commit (2440)
static u_int64_t local_checkpoint_during_checkpoint; // number of times a local checkpoint happened during normal checkpoint (2440)
enum ctpair_state { enum ctpair_state {
CTPAIR_INVALID = 0, // invalid CTPAIR_INVALID = 0, // invalid
...@@ -2500,6 +2504,9 @@ void toku_cachetable_get_status(CACHETABLE ct, CACHETABLE_STATUS s) { ...@@ -2500,6 +2504,9 @@ void toku_cachetable_get_status(CACHETABLE ct, CACHETABLE_STATUS s) {
s->size_limit = ct->size_limit; s->size_limit = ct->size_limit;
s->size_writing = ct->size_writing; s->size_writing = ct->size_writing;
s->get_and_pin_footprint = get_and_pin_footprint; s->get_and_pin_footprint = get_and_pin_footprint;
s->local_checkpoint = local_checkpoint;
s->local_checkpoint_files = local_checkpoint_files;
s->local_checkpoint_during_checkpoint = local_checkpoint_during_checkpoint;
} }
char * char *
...@@ -2541,6 +2548,8 @@ uint64_t toku_cachetable_get_size_limit(CACHETABLE ct) { ...@@ -2541,6 +2548,8 @@ uint64_t toku_cachetable_get_size_limit(CACHETABLE ct) {
int int
toku_cachetable_local_checkpoint_for_commit (CACHETABLE ct, TOKUTXN txn, uint32_t n, CACHEFILE cachefiles[n]) { toku_cachetable_local_checkpoint_for_commit (CACHETABLE ct, TOKUTXN txn, uint32_t n, CACHEFILE cachefiles[n]) {
cachetable_lock(ct); cachetable_lock(ct);
local_checkpoint++;
local_checkpoint_files += n;
LSN begin_checkpoint_lsn = ZERO_LSN; LSN begin_checkpoint_lsn = ZERO_LSN;
uint32_t i; uint32_t i;
...@@ -2629,6 +2638,7 @@ toku_cachetable_local_checkpoint_for_commit (CACHETABLE ct, TOKUTXN txn, uint32_ ...@@ -2629,6 +2638,7 @@ toku_cachetable_local_checkpoint_for_commit (CACHETABLE ct, TOKUTXN txn, uint32_
cachetable_lock(ct); cachetable_lock(ct);
assert(cf->most_recent_global_checkpoint_that_finished_early.lsn < ct->lsn_of_checkpoint_in_progress.lsn); assert(cf->most_recent_global_checkpoint_that_finished_early.lsn < ct->lsn_of_checkpoint_in_progress.lsn);
cf->most_recent_global_checkpoint_that_finished_early = ct->lsn_of_checkpoint_in_progress; cf->most_recent_global_checkpoint_that_finished_early = ct->lsn_of_checkpoint_in_progress;
local_checkpoint_during_checkpoint++;
break; break;
default: default:
assert(FALSE); assert(FALSE);
......
...@@ -316,6 +316,9 @@ typedef struct cachetable_status { ...@@ -316,6 +316,9 @@ typedef struct cachetable_status {
int64_t size_limit; // the limit to the sum of the node sizes int64_t size_limit; // the limit to the sum of the node sizes
int64_t size_writing; // the sum of the sizes of the nodes being written int64_t size_writing; // the sum of the sizes of the nodes being written
u_int64_t get_and_pin_footprint; u_int64_t get_and_pin_footprint;
uint64_t local_checkpoint; // number of times a local checkpoint was taken for a commit (2440)
uint64_t local_checkpoint_files; // number of files subject to local checkpoint taken for a commit (2440)
uint64_t local_checkpoint_during_checkpoint; // number of times a local checkpoint happened during normal checkpoint (2440)
} CACHETABLE_STATUS_S, *CACHETABLE_STATUS; } CACHETABLE_STATUS_S, *CACHETABLE_STATUS;
void toku_cachetable_get_status(CACHETABLE ct, CACHETABLE_STATUS s); void toku_cachetable_get_status(CACHETABLE ct, CACHETABLE_STATUS s);
......
...@@ -57,11 +57,8 @@ ...@@ -57,11 +57,8 @@
#include "logger.h" #include "logger.h"
#include "checkpoint.h" #include "checkpoint.h"
// for debugging/accountability and status reporting only static CHECKPOINT_STATUS_S status;
static u_int32_t checkpoint_footprint = 0; static LSN last_completed_checkpoint_lsn;
static time_t time_last_checkpoint_begin_complete;
static time_t time_last_checkpoint_begin;
static time_t time_last_checkpoint_end;
static toku_pthread_rwlock_t checkpoint_safe_lock; static toku_pthread_rwlock_t checkpoint_safe_lock;
static toku_pthread_rwlock_t multi_operation_lock; static toku_pthread_rwlock_t multi_operation_lock;
...@@ -164,15 +161,11 @@ toku_checkpoint_safe_client_unlock(void) { ...@@ -164,15 +161,11 @@ toku_checkpoint_safe_client_unlock(void) {
void void
toku_checkpoint_get_status(CHECKPOINT_STATUS s) { toku_checkpoint_get_status(CHECKPOINT_STATUS s) {
s->footprint = checkpoint_footprint; *s = status;
s->time_last_checkpoint_begin_complete = time_last_checkpoint_begin_complete;
s->time_last_checkpoint_begin = time_last_checkpoint_begin;
s->time_last_checkpoint_end = time_last_checkpoint_end;
} }
// Initialize the checkpoint mechanism, must be called before any client operations. // Initialize the checkpoint mechanism, must be called before any client operations.
int int
toku_checkpoint_init(void (*ydb_lock_callback)(void), void (*ydb_unlock_callback)(void)) { toku_checkpoint_init(void (*ydb_lock_callback)(void), void (*ydb_unlock_callback)(void)) {
...@@ -207,37 +200,42 @@ toku_checkpoint(CACHETABLE ct, TOKULOGGER logger, ...@@ -207,37 +200,42 @@ toku_checkpoint(CACHETABLE ct, TOKULOGGER logger,
void (*callback2_f)(void*), void * extra2) { void (*callback2_f)(void*), void * extra2) {
int r; int r;
checkpoint_footprint = 10; status.footprint = 10;
assert(initialized); assert(initialized);
multi_operation_checkpoint_lock(); multi_operation_checkpoint_lock();
checkpoint_footprint = 20; status.footprint = 20;
checkpoint_safe_checkpoint_lock(); checkpoint_safe_checkpoint_lock();
checkpoint_footprint = 30; status.footprint = 30;
ydb_lock(); ydb_lock();
checkpoint_footprint = 40; status.footprint = 40;
time_last_checkpoint_begin = time(NULL); status.time_last_checkpoint_begin = time(NULL);
r = toku_cachetable_begin_checkpoint(ct, logger); r = toku_cachetable_begin_checkpoint(ct, logger);
multi_operation_checkpoint_unlock(); multi_operation_checkpoint_unlock();
ydb_unlock(); ydb_unlock();
checkpoint_footprint = 50; status.footprint = 50;
if (r==0) { if (r==0) {
if (callback_f) if (callback_f)
callback_f(extra); // callback is called with checkpoint_safe_lock still held callback_f(extra); // callback is called with checkpoint_safe_lock still held
r = toku_cachetable_end_checkpoint(ct, logger, ydb_lock, ydb_unlock, callback2_f, extra2); r = toku_cachetable_end_checkpoint(ct, logger, ydb_lock, ydb_unlock, callback2_f, extra2);
} }
if (r==0 && logger) { if (r==0 && logger) {
LSN trim_lsn = logger->last_completed_checkpoint_lsn; last_completed_checkpoint_lsn = logger->last_completed_checkpoint_lsn;
r = toku_logger_maybe_trim_log(logger, trim_lsn); r = toku_logger_maybe_trim_log(logger, last_completed_checkpoint_lsn);
status.last_lsn = last_completed_checkpoint_lsn.lsn;
} }
checkpoint_footprint = 60; status.footprint = 60;
time_last_checkpoint_end = time(NULL); status.time_last_checkpoint_end = time(NULL);
time_last_checkpoint_begin_complete = time_last_checkpoint_begin; status.time_last_checkpoint_begin_complete = status.time_last_checkpoint_begin;
checkpoint_safe_checkpoint_unlock(); checkpoint_safe_checkpoint_unlock();
checkpoint_footprint = 0; status.footprint = 0;
if (r == 0)
status.checkpoint_count++;
else
status.checkpoint_count_fail++;
return r; return r;
} }
...@@ -78,6 +78,9 @@ typedef struct { ...@@ -78,6 +78,9 @@ typedef struct {
time_t time_last_checkpoint_begin_complete; time_t time_last_checkpoint_begin_complete;
time_t time_last_checkpoint_begin; time_t time_last_checkpoint_begin;
time_t time_last_checkpoint_end; time_t time_last_checkpoint_end;
uint64_t last_lsn;
uint32_t checkpoint_count;
uint32_t checkpoint_count_fail;
} CHECKPOINT_STATUS_S, *CHECKPOINT_STATUS; } CHECKPOINT_STATUS_S, *CHECKPOINT_STATUS;
void toku_checkpoint_get_status(CHECKPOINT_STATUS stat); void toku_checkpoint_get_status(CHECKPOINT_STATUS stat);
......
...@@ -3,10 +3,24 @@ ...@@ -3,10 +3,24 @@
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include "includes.h" #include "includes.h"
#include "txn.h" #include "txn.h"
#include "checkpoint.h" #include "checkpoint.h"
// accountability
static TXN_STATUS_S status = {.begin = 0,
.commit = 0,
.abort = 0,
.close = 0};
void
toku_txn_get_status(TXN_STATUS s) {
*s = status;
}
int toku_txn_begin_txn (TOKUTXN parent_tokutxn, TOKUTXN *tokutxn, TOKULOGGER logger) { int toku_txn_begin_txn (TOKUTXN parent_tokutxn, TOKUTXN *tokutxn, TOKULOGGER logger) {
return toku_txn_begin_with_xid(parent_tokutxn, tokutxn, logger, 0); return toku_txn_begin_with_xid(parent_tokutxn, tokutxn, logger, 0);
} }
...@@ -73,6 +87,7 @@ int toku_txn_begin_with_xid (TOKUTXN parent_tokutxn, TOKUTXN *tokutxn, TOKULOGGE ...@@ -73,6 +87,7 @@ int toku_txn_begin_with_xid (TOKUTXN parent_tokutxn, TOKUTXN *tokutxn, TOKULOGGE
result->recovered_from_checkpoint = FALSE; result->recovered_from_checkpoint = FALSE;
toku_list_init(&result->checkpoint_before_commit); toku_list_init(&result->checkpoint_before_commit);
*tokutxn = result; *tokutxn = result;
status.begin++;
return 0; return 0;
died: died:
...@@ -184,6 +199,7 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv ...@@ -184,6 +199,7 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv
if (r!=0) if (r!=0)
return r; return r;
r = toku_rollback_commit(txn, yield, yieldv, oplsn); r = toku_rollback_commit(txn, yield, yieldv, oplsn);
status.commit++;
return r; return r;
} }
...@@ -207,11 +223,13 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn, ...@@ -207,11 +223,13 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn,
if (r!=0) if (r!=0)
return r; return r;
r = toku_rollback_abort(txn, yield, yieldv, oplsn); r = toku_rollback_abort(txn, yield, yieldv, oplsn);
status.abort++;
return r; return r;
} }
void toku_txn_close_txn(TOKUTXN txn) { void toku_txn_close_txn(TOKUTXN txn) {
toku_rollback_txn_close(txn); toku_rollback_txn_close(txn);
status.close++;
return; return;
} }
......
...@@ -38,6 +38,16 @@ BOOL toku_txnid_newer(TXNID a, TXNID b); ...@@ -38,6 +38,16 @@ BOOL toku_txnid_newer(TXNID a, TXNID b);
// Force fsync on commit // Force fsync on commit
void toku_txn_force_fsync_on_commit(TOKUTXN txn); void toku_txn_force_fsync_on_commit(TOKUTXN txn);
typedef struct txn_status {
u_int64_t begin; // total number of transactions begun (does not include recovered txns)
u_int64_t commit; // successful commits
u_int64_t abort;
u_int64_t close; // should be sum of aborts and commits
} TXN_STATUS_S, *TXN_STATUS;
void toku_txn_get_status(TXN_STATUS s);
#if defined(__cplusplus) || defined(__cilkplusplus) #if defined(__cplusplus) || defined(__cilkplusplus)
}; };
#endif #endif
......
...@@ -20,9 +20,12 @@ ...@@ -20,9 +20,12 @@
#include "ydb_load.h" #include "ydb_load.h"
#include "checkpoint.h" #include "checkpoint.h"
#include "brt-internal.h" #include "brt-internal.h"
#include "toku_atomic.h"
enum {MAX_FILE_SIZE=256}; enum {MAX_FILE_SIZE=256};
static LOADER_STATUS_S status; // accountability
struct __toku_loader_internal { struct __toku_loader_internal {
DB_ENV *env; DB_ENV *env;
DB_TXN *txn; DB_TXN *txn;
...@@ -132,6 +135,8 @@ int toku_loader_create_loader(DB_ENV *env, ...@@ -132,6 +135,8 @@ int toku_loader_create_loader(DB_ENV *env,
uint32_t dbt_flags[N], uint32_t dbt_flags[N],
uint32_t loader_flags) uint32_t loader_flags)
{ {
int rval;
*blp = NULL; // set later when created *blp = NULL; // set later when created
DB_LOADER *loader; DB_LOADER *loader;
...@@ -151,7 +156,8 @@ int toku_loader_create_loader(DB_ENV *env, ...@@ -151,7 +156,8 @@ int toku_loader_create_loader(DB_ENV *env,
int n = snprintf(loader->i->temp_file_template, MAX_FILE_SIZE, "%s/%s%s", env->i->dir, loader_temp_prefix, loader_temp_suffix); int n = snprintf(loader->i->temp_file_template, MAX_FILE_SIZE, "%s/%s%s", env->i->dir, loader_temp_prefix, loader_temp_suffix);
if ( !(n>0 && n<MAX_FILE_SIZE) ) { if ( !(n>0 && n<MAX_FILE_SIZE) ) {
free_loader(loader); free_loader(loader);
return -1; rval = -1;
goto create_exit;
} }
memset(&loader->i->err_key, 0, sizeof(loader->i->err_key)); memset(&loader->i->err_key, 0, sizeof(loader->i->err_key));
...@@ -180,57 +186,70 @@ int toku_loader_create_loader(DB_ENV *env, ...@@ -180,57 +186,70 @@ int toku_loader_create_loader(DB_ENV *env,
} }
if ( r!=0 ) { if ( r!=0 ) {
free_loader(loader); free_loader(loader);
return -1; rval = -1;
} goto create_exit;
brt_compare_func compare_functions[N];
for (int i=0; i<N; i++) {
compare_functions[i] = dbs[i]->i->key_compare_was_set ? toku_brt_get_bt_compare(dbs[i]->i->brt) : env->i->bt_compare;
} }
// time to open the big kahuna {
if ( loader->i->loader_flags & LOADER_USE_PUTS ) { brt_compare_func compare_functions[N];
XCALLOC_N(loader->i->N, loader->i->ekeys);
XCALLOC_N(loader->i->N, loader->i->evals);
for (int i=0; i<N; i++) {
loader->i->ekeys[i].flags = DB_DBT_REALLOC;
loader->i->evals[i].flags = DB_DBT_REALLOC;
}
loader->i->brt_loader = NULL;
}
else {
char **XMALLOC_N(N, new_inames_in_env);
const struct descriptor **XMALLOC_N(N, descriptors);
for (int i=0; i<N; i++) { for (int i=0; i<N; i++) {
descriptors[i] = &dbs[i]->i->brt->h->descriptor; compare_functions[i] = dbs[i]->i->key_compare_was_set ? toku_brt_get_bt_compare(dbs[i]->i->brt) : env->i->bt_compare;
}
// time to open the big kahuna
if ( loader->i->loader_flags & LOADER_USE_PUTS ) {
XCALLOC_N(loader->i->N, loader->i->ekeys);
XCALLOC_N(loader->i->N, loader->i->evals);
for (int i=0; i<N; i++) {
loader->i->ekeys[i].flags = DB_DBT_REALLOC;
loader->i->evals[i].flags = DB_DBT_REALLOC;
}
loader->i->brt_loader = NULL;
}
else {
char **XMALLOC_N(N, new_inames_in_env);
const struct descriptor **XMALLOC_N(N, descriptors);
for (int i=0; i<N; i++) {
descriptors[i] = &dbs[i]->i->brt->h->descriptor;
}
loader->i->ekeys = NULL;
loader->i->evals = NULL;
LSN load_lsn;
r = locked_ydb_load_inames (env, txn, N, dbs, new_inames_in_env, &load_lsn);
if ( r!=0 ) {
toku_free(new_inames_in_env);
toku_free(descriptors);
free_loader(loader);
rval = r;
goto create_exit;
}
toku_brt_loader_open(&loader->i->brt_loader,
loader->i->env->i->cachetable,
loader->i->env->i->generate_row_for_put,
src_db,
N,
dbs,
descriptors,
(const char **)new_inames_in_env,
compare_functions,
loader->i->temp_file_template,
load_lsn);
loader->i->inames_in_env = new_inames_in_env;
toku_free(descriptors);
rval = 0;
} }
loader->i->ekeys = NULL;
loader->i->evals = NULL;
LSN load_lsn;
r = locked_ydb_load_inames (env, txn, N, dbs, new_inames_in_env, &load_lsn);
if ( r!=0 ) {
toku_free(new_inames_in_env);
toku_free(descriptors);
free_loader(loader);
return r;
}
toku_brt_loader_open(&loader->i->brt_loader,
loader->i->env->i->cachetable,
loader->i->env->i->generate_row_for_put,
src_db,
N,
dbs,
descriptors,
(const char **)new_inames_in_env,
compare_functions,
loader->i->temp_file_template,
load_lsn);
loader->i->inames_in_env = new_inames_in_env;
toku_free(descriptors);
} }
*blp = loader; *blp = loader;
create_exit:
return 0; if (rval == 0) {
(void) toku_sync_fetch_and_increment_uint64(&status.create);
(void) toku_sync_fetch_and_increment_uint32(&status.current);
if (status.current > status.max)
status.max = status.current; // not worth a lock to make threadsafe, may be inaccurate
}
else
(void) toku_sync_fetch_and_increment_uint64(&status.create_fail);
return rval;
} }
int toku_loader_set_poll_function(DB_LOADER *loader, int toku_loader_set_poll_function(DB_LOADER *loader,
...@@ -253,6 +272,8 @@ int toku_loader_set_error_callback(DB_LOADER *loader, ...@@ -253,6 +272,8 @@ int toku_loader_set_error_callback(DB_LOADER *loader,
int toku_loader_put(DB_LOADER *loader, DBT *key, DBT *val) int toku_loader_put(DB_LOADER *loader, DBT *key, DBT *val)
{ {
status.put++; // not worth the extra cycles to keep threadsafe
int r = 0; int r = 0;
int i = 0; int i = 0;
// err_i is unused now( always 0). How would we know which dictionary // err_i is unused now( always 0). How would we know which dictionary
...@@ -302,6 +323,7 @@ int toku_loader_put(DB_LOADER *loader, DBT *key, DBT *val) ...@@ -302,6 +323,7 @@ int toku_loader_put(DB_LOADER *loader, DBT *key, DBT *val)
int toku_loader_close(DB_LOADER *loader) int toku_loader_close(DB_LOADER *loader)
{ {
(void) toku_sync_fetch_and_decrement_uint32(&status.current);
int r=0; int r=0;
if ( loader->i->err_errno != 0 ) { if ( loader->i->err_errno != 0 ) {
if ( loader->i->error_callback != NULL ) { if ( loader->i->error_callback != NULL ) {
...@@ -334,11 +356,17 @@ int toku_loader_close(DB_LOADER *loader) ...@@ -334,11 +356,17 @@ int toku_loader_close(DB_LOADER *loader)
} }
} }
free_loader(loader); free_loader(loader);
if (r==0)
(void) toku_sync_fetch_and_increment_uint64(&status.close);
else
(void) toku_sync_fetch_and_increment_uint64(&status.close_fail);
return r; return r;
} }
int toku_loader_abort(DB_LOADER *loader) int toku_loader_abort(DB_LOADER *loader)
{ {
(void) toku_sync_fetch_and_decrement_uint32(&status.current);
(void) toku_sync_fetch_and_increment_uint64(&status.abort);
int r=0; int r=0;
if ( loader->i->err_errno != 0 ) { if ( loader->i->err_errno != 0 ) {
if ( loader->i->error_callback != NULL ) { if ( loader->i->error_callback != NULL ) {
...@@ -353,6 +381,7 @@ int toku_loader_abort(DB_LOADER *loader) ...@@ -353,6 +381,7 @@ int toku_loader_abort(DB_LOADER *loader)
return r; return r;
} }
// find all of the files in the environments home directory that match the loader temp name and remove them // find all of the files in the environments home directory that match the loader temp name and remove them
int toku_loader_cleanup_temp_files(DB_ENV *env) { int toku_loader_cleanup_temp_files(DB_ENV *env) {
int result; int result;
...@@ -386,3 +415,8 @@ int toku_loader_cleanup_temp_files(DB_ENV *env) { ...@@ -386,3 +415,8 @@ int toku_loader_cleanup_temp_files(DB_ENV *env) {
exit: exit:
return result; return result;
} }
void
toku_loader_get_status(LOADER_STATUS s) {
*s = status;
}
...@@ -28,8 +28,23 @@ int toku_loader_abort(DB_LOADER *loader); ...@@ -28,8 +28,23 @@ int toku_loader_abort(DB_LOADER *loader);
// Remove any loader temp files that may have been left from a crashed system // Remove any loader temp files that may have been left from a crashed system
int toku_loader_cleanup_temp_files(DB_ENV *env); int toku_loader_cleanup_temp_files(DB_ENV *env);
typedef struct loader_status {
uint64_t create; // number of loaders succefully created
uint64_t create_fail; // number of calls to toku_loader_create_loader() that failed
uint64_t put; // number of calls to toku_loader_put()
uint64_t close; // number of calls to toku_loader_close()
uint64_t close_fail; // number of calls to toku_loader_close() that failed
uint64_t abort; // number of calls to toku_loader_abort()
uint32_t current; // number of loaders currently in existence
uint32_t max; // max number of loaders that ever existed simultaneously
} LOADER_STATUS_S, *LOADER_STATUS;
void toku_loader_get_status(LOADER_STATUS s);
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
#endif #endif
...@@ -211,12 +211,11 @@ int toku_ltm_close(toku_ltm* mgr) { ...@@ -211,12 +211,11 @@ int toku_ltm_close(toku_ltm* mgr) {
void void
toku_ltm_get_status(toku_ltm* mgr, LTM_STATUS s) { toku_ltm_get_status(toku_ltm* mgr, uint32_t * max_locks, uint32_t * curr_locks, uint32_t * max_locks_per_db, LTM_STATUS s) {
s->max_locks = mgr->max_locks; *max_locks = mgr->max_locks;
s->max_locks_per_db = mgr->max_locks_per_db; *curr_locks = mgr->curr_locks;
s->curr_locks = mgr->curr_locks; *max_locks_per_db = mgr->max_locks_per_db;
s->lock_escalation_successes = mgr->lock_escalation_successes; *s = mgr->status;
s->lock_escalation_failures = mgr->lock_escalation_failures;
} }
...@@ -1381,6 +1380,7 @@ int toku_lt_close(toku_lock_tree* tree) { ...@@ -1381,6 +1380,7 @@ int toku_lt_close(toku_lock_tree* tree) {
return r; return r;
} }
// toku_lt_acquire_read_lock() used only by test programs
int toku_lt_acquire_read_lock(toku_lock_tree* tree, int toku_lt_acquire_read_lock(toku_lock_tree* tree,
DB* db, TXNID txn, DB* db, TXNID txn,
const DBT* key, const DBT* data) { const DBT* key, const DBT* data) {
...@@ -1745,9 +1745,9 @@ static int toku__lt_do_escalation_per_db(toku_lock_tree* lt, DB* db, BOOL* locks ...@@ -1745,9 +1745,9 @@ static int toku__lt_do_escalation_per_db(toku_lock_tree* lt, DB* db, BOOL* locks
*locks_available = toku__lt_lock_test_incr_per_db(lt, 0); *locks_available = toku__lt_lock_test_incr_per_db(lt, 0);
if (*locks_available) if (*locks_available)
lt->mgr->lock_escalation_successes++; lt->mgr->status.lock_escalation_successes++;
else else
lt->mgr->lock_escalation_failures++; lt->mgr->status.lock_escalation_failures++;
r = 0; r = 0;
cleanup: cleanup:
toku__lt_clear_comparison_functions(lt); toku__lt_clear_comparison_functions(lt);
...@@ -1789,6 +1789,17 @@ int toku_lt_acquire_range_read_lock(toku_lock_tree* tree, DB* db, TXNID txn, ...@@ -1789,6 +1789,17 @@ int toku_lt_acquire_range_read_lock(toku_lock_tree* tree, DB* db, TXNID txn,
r = 0; r = 0;
cleanup: cleanup:
{
LTM_STATUS s = &(tree->mgr->status);
if (r == 0) {
s->read_lock++;
}
else {
s->read_lock_fail++;
if (r == TOKUDB_OUT_OF_LOCKS)
s->out_of_read_locks++;
}
}
return r; return r;
} }
...@@ -1885,6 +1896,7 @@ static int toku__lt_try_acquire_write_lock(toku_lock_tree* tree, ...@@ -1885,6 +1896,7 @@ static int toku__lt_try_acquire_write_lock(toku_lock_tree* tree,
return r; return r;
} }
// toku_lt_acquire_write_lock() used only by test programs
int toku_lt_acquire_write_lock(toku_lock_tree* tree, DB* db, TXNID txn, int toku_lt_acquire_write_lock(toku_lock_tree* tree, DB* db, TXNID txn,
const DBT* key, const DBT* data) { const DBT* key, const DBT* data) {
BOOL out_of_locks = FALSE; BOOL out_of_locks = FALSE;
...@@ -2003,6 +2015,17 @@ int toku_lt_acquire_range_write_lock(toku_lock_tree* tree, DB* db, TXNID txn, ...@@ -2003,6 +2015,17 @@ int toku_lt_acquire_range_write_lock(toku_lock_tree* tree, DB* db, TXNID txn,
r = 0; r = 0;
cleanup: cleanup:
{
LTM_STATUS s = &(tree->mgr->status);
if (r == 0) {
s->write_lock++;
}
else {
s->write_lock_fail++;
if (r == TOKUDB_OUT_OF_LOCKS)
s->out_of_write_locks++;
}
}
return r; return r;
} }
......
...@@ -130,6 +130,21 @@ struct __toku_lock_tree { ...@@ -130,6 +130,21 @@ struct __toku_lock_tree {
BOOL table_is_locked; BOOL table_is_locked;
}; };
// accountability
typedef struct ltm_status {
uint32_t lock_escalation_successes; // number of times lock escalation succeeded
uint32_t lock_escalation_failures; // number of times lock escalation failed
uint64_t read_lock; // number of times read lock taken successfully
uint64_t read_lock_fail; // number of times read lock denied
uint64_t out_of_read_locks; // number of times read lock denied for out_of_locks
uint64_t write_lock; // number of times write lock taken successfully
uint64_t write_lock_fail; // number of times write lock denied
uint64_t out_of_write_locks; // number of times write lock denied for out_of_locks
} LTM_STATUS_S, *LTM_STATUS;
struct __toku_ltm { struct __toku_ltm {
/** The maximum number of locks allowed for the environment. */ /** The maximum number of locks allowed for the environment. */
u_int32_t max_locks; u_int32_t max_locks;
...@@ -137,10 +152,8 @@ struct __toku_ltm { ...@@ -137,10 +152,8 @@ struct __toku_ltm {
u_int32_t curr_locks; u_int32_t curr_locks;
/** The maximum number of locks allowed for the db. */ /** The maximum number of locks allowed for the db. */
u_int32_t max_locks_per_db; u_int32_t max_locks_per_db;
/** The number of times lock escalation succeeded */ /** Status / accountability information */
u_int32_t lock_escalation_successes; LTM_STATUS_S status;
/** The number of times lock escalation failed */
u_int32_t lock_escalation_failures;
/** The list of lock trees it manages. */ /** The list of lock trees it manages. */
toku_lth* lth; toku_lth* lth;
/** List of lock-tree DB mappings. Upon a request for a lock tree given /** List of lock-tree DB mappings. Upon a request for a lock tree given
...@@ -514,15 +527,7 @@ int toku_ltm_set_max_locks_per_db(toku_ltm* mgr, u_int32_t max_locks); ...@@ -514,15 +527,7 @@ int toku_ltm_set_max_locks_per_db(toku_ltm* mgr, u_int32_t max_locks);
- EINVAL if any parameter is NULL. - EINVAL if any parameter is NULL.
*/ */
typedef struct ltm_status { void toku_ltm_get_status(toku_ltm* mgr, uint32_t * max_locks, uint32_t * curr_locks, uint32_t * max_locks_per_db, LTM_STATUS s);
uint32_t max_locks;
uint32_t max_locks_per_db;
uint32_t curr_locks;
uint32_t lock_escalation_successes;
uint32_t lock_escalation_failures;
} LTM_STATUS_S, *LTM_STATUS;
void toku_ltm_get_status(toku_ltm* mgr, LTM_STATUS s);
int toku_ltm_get_max_locks(toku_ltm* mgr, u_int32_t* max_locks); int toku_ltm_get_max_locks(toku_ltm* mgr, u_int32_t* max_locks);
......
...@@ -461,7 +461,8 @@ libs: ...@@ -461,7 +461,8 @@ libs:
loader-cleanup-test.tdb$(BINSUF) recover-loader-test.tdb$(BINSUF) diskfull.tdb$(BINSUF): CPPFLAGS+=-DDONT_DEPRECATE_WRITES
loader-cleanup-test.tdb$(BINSUF) diskfull.tdb$(BINSUF): CPPFLAGS+=-DDONT_DEPRECATE_WRITES
test_db_curs4.tdb$(BINSUF): trace.h test_db_curs4.tdb$(BINSUF): trace.h
test_db_curs4.bdb$(BINSUF): trace.h test_db_curs4.bdb$(BINSUF): trace.h
# a bunch of little tests designed to run in parallel # a bunch of little tests designed to run in parallel
......
...@@ -263,7 +263,6 @@ static void test_loader(DB **dbs) ...@@ -263,7 +263,6 @@ static void test_loader(DB **dbs)
CKERR2s(r,0,TOKUDB_CANCELED); CKERR2s(r,0,TOKUDB_CANCELED);
if (r==0) { if (r==0) {
if ( USE_PUTS == 0 ) { if ( USE_PUTS == 0 ) {
if (poll_count == 0) printf("%s:%d\n", __FILE__, __LINE__); if (poll_count == 0) printf("%s:%d\n", __FILE__, __LINE__);
assert(poll_count>0); assert(poll_count>0);
......
...@@ -82,7 +82,7 @@ struct __toku_db_env_internal { ...@@ -82,7 +82,7 @@ struct __toku_db_env_internal {
uint64_t last_seq_entered_red; uint64_t last_seq_entered_red;
uint64_t last_seq_entered_yellow; uint64_t last_seq_entered_yellow;
int redzone; // percent of total fs space that marks boundary between yellow and red zones int redzone; // percent of total fs space that marks boundary between yellow and red zones
int enospc_seal_ctr; // number of operations rejected by enospc seal (red zone) int enospc_redzone_ctr; // number of operations rejected by enospc prevention (red zone)
int fs_poll_time; // Time in seconds between statfs calls int fs_poll_time; // Time in seconds between statfs calls
struct minicron fs_poller; // Poll the file systems struct minicron fs_poller; // Poll the file systems
BOOL fs_poller_is_init; BOOL fs_poller_is_init;
......
This diff is collapsed.
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