Commit ae050bf9 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 0827928d
......@@ -57,6 +57,7 @@ struct __toku_loader {
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
};
typedef struct __toku_engine_status {
char startuptime[26]; /* time of engine startup */
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 max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */
......@@ -76,6 +77,15 @@ typedef struct __toku_engine_status {
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_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_released;/* how many times has cachetable lock been released */
u_int64_t cachetable_hit; /* how many cache hits */
......@@ -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_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 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_per_index; /* max range locks per dictionary */
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_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
u_int64_t aborts; /* ydb txn abort operations */
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 range_read_locks; /* total range read locks taken */
u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */
u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */
u_int64_t range_write_locks; /* total range write locks taken */
u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */
u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */
u_int64_t inserts; /* ydb row insert operations */
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_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 */
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_total; /* 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_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */
u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */
u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */
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;
typedef enum {
DB_BTREE=1,
......
......@@ -57,6 +57,7 @@ struct __toku_loader {
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
};
typedef struct __toku_engine_status {
char startuptime[26]; /* time of engine startup */
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 max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */
......@@ -76,6 +77,15 @@ typedef struct __toku_engine_status {
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_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_released;/* how many times has cachetable lock been released */
u_int64_t cachetable_hit; /* how many cache hits */
......@@ -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_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 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_per_index; /* max range locks per dictionary */
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_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
u_int64_t aborts; /* ydb txn abort operations */
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 range_read_locks; /* total range read locks taken */
u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */
u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */
u_int64_t range_write_locks; /* total range write locks taken */
u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */
u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */
u_int64_t inserts; /* ydb row insert operations */
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_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 */
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_total; /* 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_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */
u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */
u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */
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;
typedef enum {
DB_BTREE=1,
......
This diff is collapsed.
This diff is collapsed.
......@@ -13,9 +13,9 @@ extern "C" {
#define TOKUDB_NATIVE_H 0
#define DB_VERSION_MAJOR 4
#define DB_VERSION_MINOR 6
#define DB_VERSION_PATCH 19
#define DB_VERSION_PATCH 21
#ifndef _TOKUDB_WRAP_H
#define DB_VERSION_STRING "Tokutek: TokuDB 4.6.19"
#define DB_VERSION_STRING "Tokutek: TokuDB 4.6.21"
#else
#define DB_VERSION_STRING_ydb "Tokutek: TokuDB (wrapped bdb)"
#endif
......@@ -57,6 +57,7 @@ struct __toku_loader {
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
};
typedef struct __toku_engine_status {
char startuptime[26]; /* time of engine startup */
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 max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */
......@@ -76,6 +77,15 @@ typedef struct __toku_engine_status {
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_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_released;/* how many times has cachetable lock been released */
u_int64_t cachetable_hit; /* how many cache hits */
......@@ -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_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 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_per_index; /* max range locks per dictionary */
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_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
u_int64_t aborts; /* ydb txn abort operations */
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 range_read_locks; /* total range read locks taken */
u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */
u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */
u_int64_t range_write_locks; /* total range write locks taken */
u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */
u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */
u_int64_t inserts; /* ydb row insert operations */
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_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 */
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_total; /* 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_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */
u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */
u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */
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;
typedef enum {
DB_BTREE=1,
......
......@@ -418,6 +418,7 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
//engine status info
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(" 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");
......@@ -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_complete[26]; /* time of last complete checkpoint begin */ \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_released;/* how many times has cachetable lock been released */ \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__
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 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_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_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_int64_t inserts; /* ydb row insert operations */ \n");
printf(" u_int64_t deletes; /* ydb row delete operations */ \n");
printf(" u_int64_t commits; /* ydb txn commit operations */ \n");
printf(" u_int64_t aborts; /* ydb txn abort operations */ \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 range_read_locks; /* total range read locks taken */ \n");
printf(" u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */ \n");
printf(" u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */ \n");
printf(" u_int64_t range_write_locks; /* total range write locks taken */ \n");
printf(" u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */ \n");
printf(" u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */ \n");
printf(" u_int64_t inserts; /* ydb row insert operations */ \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_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(" 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_total; /* 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_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */ \n");
printf(" u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */ \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_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");
print_dbtype();
......
......@@ -57,6 +57,7 @@ struct __toku_loader {
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
};
typedef struct __toku_engine_status {
char startuptime[26]; /* time of engine startup */
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 max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */
......@@ -76,6 +77,15 @@ typedef struct __toku_engine_status {
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_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_released;/* how many times has cachetable lock been released */
u_int64_t cachetable_hit; /* how many cache hits */
......@@ -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_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 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_per_index; /* max range locks per dictionary */
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_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
u_int64_t aborts; /* ydb txn abort operations */
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 range_read_locks; /* total range read locks taken */
u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */
u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */
u_int64_t range_write_locks; /* total range write locks taken */
u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */
u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */
u_int64_t inserts; /* ydb row insert operations */
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_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 */
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_total; /* 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_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */
u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */
u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */
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;
typedef enum {
DB_BTREE=1,
......
......@@ -57,6 +57,7 @@ struct __toku_loader {
int (*abort)(DB_LOADER *loader); /* abort loading, free memory */
};
typedef struct __toku_engine_status {
char startuptime[26]; /* time of engine startup */
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 max_possible_sleep; /* max possible sleep time for ydb lock scheduling (constant) */
......@@ -76,6 +77,15 @@ typedef struct __toku_engine_status {
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_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_released;/* how many times has cachetable lock been released */
u_int64_t cachetable_hit; /* how many cache hits */
......@@ -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_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 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_per_index; /* max range locks per dictionary */
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_failures; /* number of times range locks escalation failed */
u_int64_t inserts; /* ydb row insert operations */
u_int64_t deletes; /* ydb row delete operations */
u_int64_t commits; /* ydb txn commit operations */
u_int64_t aborts; /* ydb txn abort operations */
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 range_read_locks; /* total range read locks taken */
u_int64_t range_read_locks_fail; /* total range read locks unable to be taken */
u_int64_t range_out_of_read_locks; /* total times range read locks exhausted */
u_int64_t range_write_locks; /* total range write locks taken */
u_int64_t range_write_locks_fail; /* total range write locks unable to be taken */
u_int64_t range_out_of_write_locks; /* total times range write locks exhausted */
u_int64_t inserts; /* ydb row insert operations */
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_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 */
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_total; /* 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_seal_state; /* state of ydb-level seal (0 = green, 1 = yellow, 2 = red) */
u_int64_t enospc_ctr; /* how many times has ENOSPC been returned by disk write */
u_int64_t enospc_redzone_ctr; /* how many times has ENOSPC been returned to user (red zone) */
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;
typedef enum {
DB_BTREE=1,
......
......@@ -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_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_lock_taken = 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 {
CTPAIR_INVALID = 0, // invalid
......@@ -2500,6 +2504,9 @@ void toku_cachetable_get_status(CACHETABLE ct, CACHETABLE_STATUS s) {
s->size_limit = ct->size_limit;
s->size_writing = ct->size_writing;
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 *
......@@ -2541,6 +2548,8 @@ uint64_t toku_cachetable_get_size_limit(CACHETABLE ct) {
int
toku_cachetable_local_checkpoint_for_commit (CACHETABLE ct, TOKUTXN txn, uint32_t n, CACHEFILE cachefiles[n]) {
cachetable_lock(ct);
local_checkpoint++;
local_checkpoint_files += n;
LSN begin_checkpoint_lsn = ZERO_LSN;
uint32_t i;
......@@ -2629,6 +2638,7 @@ toku_cachetable_local_checkpoint_for_commit (CACHETABLE ct, TOKUTXN txn, uint32_
cachetable_lock(ct);
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;
local_checkpoint_during_checkpoint++;
break;
default:
assert(FALSE);
......
......@@ -316,6 +316,9 @@ typedef struct cachetable_status {
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
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;
void toku_cachetable_get_status(CACHETABLE ct, CACHETABLE_STATUS s);
......
......@@ -57,11 +57,8 @@
#include "logger.h"
#include "checkpoint.h"
// for debugging/accountability and status reporting only
static u_int32_t checkpoint_footprint = 0;
static time_t time_last_checkpoint_begin_complete;
static time_t time_last_checkpoint_begin;
static time_t time_last_checkpoint_end;
static CHECKPOINT_STATUS_S status;
static LSN last_completed_checkpoint_lsn;
static toku_pthread_rwlock_t checkpoint_safe_lock;
static toku_pthread_rwlock_t multi_operation_lock;
......@@ -164,15 +161,11 @@ toku_checkpoint_safe_client_unlock(void) {
void
toku_checkpoint_get_status(CHECKPOINT_STATUS s) {
s->footprint = checkpoint_footprint;
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;
*s = status;
}
// Initialize the checkpoint mechanism, must be called before any client operations.
int
toku_checkpoint_init(void (*ydb_lock_callback)(void), void (*ydb_unlock_callback)(void)) {
......@@ -207,37 +200,42 @@ toku_checkpoint(CACHETABLE ct, TOKULOGGER logger,
void (*callback2_f)(void*), void * extra2) {
int r;
checkpoint_footprint = 10;
status.footprint = 10;
assert(initialized);
multi_operation_checkpoint_lock();
checkpoint_footprint = 20;
status.footprint = 20;
checkpoint_safe_checkpoint_lock();
checkpoint_footprint = 30;
status.footprint = 30;
ydb_lock();
checkpoint_footprint = 40;
time_last_checkpoint_begin = time(NULL);
status.footprint = 40;
status.time_last_checkpoint_begin = time(NULL);
r = toku_cachetable_begin_checkpoint(ct, logger);
multi_operation_checkpoint_unlock();
ydb_unlock();
checkpoint_footprint = 50;
status.footprint = 50;
if (r==0) {
if (callback_f)
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);
}
if (r==0 && logger) {
LSN trim_lsn = logger->last_completed_checkpoint_lsn;
r = toku_logger_maybe_trim_log(logger, trim_lsn);
last_completed_checkpoint_lsn = logger->last_completed_checkpoint_lsn;
r = toku_logger_maybe_trim_log(logger, last_completed_checkpoint_lsn);
status.last_lsn = last_completed_checkpoint_lsn.lsn;
}
checkpoint_footprint = 60;
time_last_checkpoint_end = time(NULL);
time_last_checkpoint_begin_complete = time_last_checkpoint_begin;
status.footprint = 60;
status.time_last_checkpoint_end = time(NULL);
status.time_last_checkpoint_begin_complete = status.time_last_checkpoint_begin;
checkpoint_safe_checkpoint_unlock();
checkpoint_footprint = 0;
status.footprint = 0;
if (r == 0)
status.checkpoint_count++;
else
status.checkpoint_count_fail++;
return r;
}
......@@ -78,6 +78,9 @@ typedef struct {
time_t time_last_checkpoint_begin_complete;
time_t time_last_checkpoint_begin;
time_t time_last_checkpoint_end;
uint64_t last_lsn;
uint32_t checkpoint_count;
uint32_t checkpoint_count_fail;
} CHECKPOINT_STATUS_S, *CHECKPOINT_STATUS;
void toku_checkpoint_get_status(CHECKPOINT_STATUS stat);
......
......@@ -3,10 +3,24 @@
#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."
#include "includes.h"
#include "txn.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) {
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
result->recovered_from_checkpoint = FALSE;
toku_list_init(&result->checkpoint_before_commit);
*tokutxn = result;
status.begin++;
return 0;
died:
......@@ -184,6 +199,7 @@ int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv
if (r!=0)
return r;
r = toku_rollback_commit(txn, yield, yieldv, oplsn);
status.commit++;
return r;
}
......@@ -207,11 +223,13 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn,
if (r!=0)
return r;
r = toku_rollback_abort(txn, yield, yieldv, oplsn);
status.abort++;
return r;
}
void toku_txn_close_txn(TOKUTXN txn) {
toku_rollback_txn_close(txn);
status.close++;
return;
}
......
......@@ -38,6 +38,16 @@ BOOL toku_txnid_newer(TXNID a, TXNID b);
// Force fsync on commit
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)
};
#endif
......
......@@ -20,9 +20,12 @@
#include "ydb_load.h"
#include "checkpoint.h"
#include "brt-internal.h"
#include "toku_atomic.h"
enum {MAX_FILE_SIZE=256};
static LOADER_STATUS_S status; // accountability
struct __toku_loader_internal {
DB_ENV *env;
DB_TXN *txn;
......@@ -132,6 +135,8 @@ int toku_loader_create_loader(DB_ENV *env,
uint32_t dbt_flags[N],
uint32_t loader_flags)
{
int rval;
*blp = NULL; // set later when created
DB_LOADER *loader;
......@@ -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);
if ( !(n>0 && n<MAX_FILE_SIZE) ) {
free_loader(loader);
return -1;
rval = -1;
goto create_exit;
}
memset(&loader->i->err_key, 0, sizeof(loader->i->err_key));
......@@ -180,57 +186,70 @@ int toku_loader_create_loader(DB_ENV *env,
}
if ( r!=0 ) {
free_loader(loader);
return -1;
}
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;
rval = -1;
goto create_exit;
}
// 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);
{
brt_compare_func compare_functions[N];
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;
return 0;
create_exit:
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,
......@@ -253,6 +272,8 @@ int toku_loader_set_error_callback(DB_LOADER *loader,
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 i = 0;
// 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)
int toku_loader_close(DB_LOADER *loader)
{
(void) toku_sync_fetch_and_decrement_uint32(&status.current);
int r=0;
if ( loader->i->err_errno != 0 ) {
if ( loader->i->error_callback != NULL ) {
......@@ -334,11 +356,17 @@ int toku_loader_close(DB_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;
}
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;
if ( loader->i->err_errno != 0 ) {
if ( loader->i->error_callback != NULL ) {
......@@ -353,6 +381,7 @@ int toku_loader_abort(DB_LOADER *loader)
return r;
}
// 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 result;
......@@ -386,3 +415,8 @@ int toku_loader_cleanup_temp_files(DB_ENV *env) {
exit:
return result;
}
void
toku_loader_get_status(LOADER_STATUS s) {
*s = status;
}
......@@ -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
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)
}
#endif
#endif
......@@ -211,12 +211,11 @@ cleanup:
void
toku_ltm_get_status(toku_ltm* mgr, LTM_STATUS s) {
s->max_locks = mgr->max_locks;
s->max_locks_per_db = mgr->max_locks_per_db;
s->curr_locks = mgr->curr_locks;
s->lock_escalation_successes = mgr->lock_escalation_successes;
s->lock_escalation_failures = mgr->lock_escalation_failures;
toku_ltm_get_status(toku_ltm* mgr, uint32_t * max_locks, uint32_t * curr_locks, uint32_t * max_locks_per_db, LTM_STATUS s) {
*max_locks = mgr->max_locks;
*curr_locks = mgr->curr_locks;
*max_locks_per_db = mgr->max_locks_per_db;
*s = mgr->status;
}
......@@ -1381,6 +1380,7 @@ cleanup:
return r;
}
// toku_lt_acquire_read_lock() used only by test programs
int toku_lt_acquire_read_lock(toku_lock_tree* tree,
DB* db, TXNID txn,
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
*locks_available = toku__lt_lock_test_incr_per_db(lt, 0);
if (*locks_available)
lt->mgr->lock_escalation_successes++;
lt->mgr->status.lock_escalation_successes++;
else
lt->mgr->lock_escalation_failures++;
lt->mgr->status.lock_escalation_failures++;
r = 0;
cleanup:
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,
r = 0;
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;
}
......@@ -1885,6 +1896,7 @@ cleanup:
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,
const DBT* key, const DBT* data) {
BOOL out_of_locks = FALSE;
......@@ -2003,6 +2015,17 @@ int toku_lt_acquire_range_write_lock(toku_lock_tree* tree, DB* db, TXNID txn,
r = 0;
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;
}
......
......@@ -130,6 +130,21 @@ struct __toku_lock_tree {
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 {
/** The maximum number of locks allowed for the environment. */
u_int32_t max_locks;
......@@ -137,10 +152,8 @@ struct __toku_ltm {
u_int32_t curr_locks;
/** The maximum number of locks allowed for the db. */
u_int32_t max_locks_per_db;
/** The number of times lock escalation succeeded */
u_int32_t lock_escalation_successes;
/** The number of times lock escalation failed */
u_int32_t lock_escalation_failures;
/** Status / accountability information */
LTM_STATUS_S status;
/** The list of lock trees it manages. */
toku_lth* lth;
/** 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);
- EINVAL if any parameter is NULL.
*/
typedef struct ltm_status {
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);
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);
int toku_ltm_get_max_locks(toku_ltm* mgr, u_int32_t* max_locks);
......
......@@ -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.bdb$(BINSUF): trace.h
# a bunch of little tests designed to run in parallel
......
......@@ -263,7 +263,6 @@ static void test_loader(DB **dbs)
CKERR2s(r,0,TOKUDB_CANCELED);
if (r==0) {
if ( USE_PUTS == 0 ) {
if (poll_count == 0) printf("%s:%d\n", __FILE__, __LINE__);
assert(poll_count>0);
......
......@@ -82,7 +82,7 @@ struct __toku_db_env_internal {
uint64_t last_seq_entered_red;
uint64_t last_seq_entered_yellow;
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
struct minicron fs_poller; // Poll the file systems
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