diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-08-14 16:20:22 +1000 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-08-14 16:20:22 +1000 |
commit | 95301eddd94c6383cfc08bd7aa8e09f91f55a856 (patch) | |
tree | bbdfae1a22ddca298fcfe790d61e5f3a9c8aff84 | |
parent | f12c69449d832488b8079aff9d1f4459dd34649d (diff) | |
download | mongo-95301eddd94c6383cfc08bd7aa8e09f91f55a856.tar.gz |
WT-2038 Count and report the total number of data handles
-rw-r--r-- | dist/stat_data.py | 2 | ||||
-rw-r--r-- | src/conn/conn_stat.c | 2 | ||||
-rw-r--r-- | src/include/connection.h | 3 | ||||
-rw-r--r-- | src/include/stat.h | 1 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 160 | ||||
-rw-r--r-- | src/support/stat.c | 2 | ||||
-rw-r--r-- | tools/wtstats/stat_data.py | 2 |
7 files changed, 93 insertions, 79 deletions
diff --git a/dist/stat_data.py b/dist/stat_data.py index 77061b36dcb..51152fcc6af 100644 --- a/dist/stat_data.py +++ b/dist/stat_data.py @@ -208,6 +208,8 @@ connection_stats = [ ########################################## # Dhandle statistics ########################################## + DhandleStat('dh_conn_handle_count', + 'connection data handles currently active', 'no_clear,no_scale'), DhandleStat('dh_sweep_close', 'connection sweep dhandles closed'), DhandleStat('dh_sweep_remove', 'connection sweep dhandles removed from hash list'), diff --git a/src/conn/conn_stat.c b/src/conn/conn_stat.c index 9c438c01cd2..be842378cec 100644 --- a/src/conn/conn_stat.c +++ b/src/conn/conn_stat.c @@ -46,6 +46,8 @@ __wt_conn_stat_init(WT_SESSION_IMPL *session) __wt_cache_stats_update(session); __wt_txn_stats_update(session); + WT_CONN_STAT(session, dh_conn_handle_count) = + S2C(session)->dhandle_count; WT_CONN_STAT(session, file_open) = S2C(session)->open_file_count; } diff --git a/src/include/connection.h b/src/include/connection.h index b3ffa8902a0..b3c69c68964 100644 --- a/src/include/connection.h +++ b/src/include/connection.h @@ -121,11 +121,13 @@ struct __wt_named_extractor { #define WT_CONN_DHANDLE_INSERT(conn, dhandle, bucket) do { \ TAILQ_INSERT_HEAD(&(conn)->dhqh, dhandle, q); \ TAILQ_INSERT_HEAD(&(conn)->dhhash[bucket], dhandle, hashq); \ + ++conn->dhandle_count; \ } while (0) #define WT_CONN_DHANDLE_REMOVE(conn, dhandle, bucket) do { \ TAILQ_REMOVE(&(conn)->dhqh, dhandle, q); \ TAILQ_REMOVE(&(conn)->dhhash[bucket], dhandle, hashq); \ + --conn->dhandle_count; \ } while (0) /* @@ -232,6 +234,7 @@ struct __wt_connection_impl { TAILQ_HEAD(__wt_blockhash, __wt_block) blockhash[WT_HASH_ARRAY_SIZE]; TAILQ_HEAD(__wt_block_qh, __wt_block) blockqh; + u_int dhandle_count; /* Locked: handles in the queue */ u_int open_btree_count; /* Locked: open writable btree count */ uint32_t next_file_id; /* Locked: file ID counter */ uint32_t open_file_count; /* Atomic: open file handle count */ diff --git a/src/include/stat.h b/src/include/stat.h index d99d70b6d23..82df9a1a784 100644 --- a/src/include/stat.h +++ b/src/include/stat.h @@ -196,6 +196,7 @@ struct __wt_connection_stats { WT_STATS cursor_search; WT_STATS cursor_search_near; WT_STATS cursor_update; + WT_STATS dh_conn_handle_count; WT_STATS dh_session_handles; WT_STATS dh_session_sweeps; WT_STATS dh_sweep_close; diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 80e7d0fcacc..a538bb211fc 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -3670,164 +3670,166 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection); #define WT_STAT_CONN_CURSOR_SEARCH_NEAR 1062 /*! cursor: cursor update calls */ #define WT_STAT_CONN_CURSOR_UPDATE 1063 +/*! data-handle: connection data handles currently active */ +#define WT_STAT_CONN_DH_CONN_HANDLE_COUNT 1064 /*! data-handle: session dhandles swept */ -#define WT_STAT_CONN_DH_SESSION_HANDLES 1064 +#define WT_STAT_CONN_DH_SESSION_HANDLES 1065 /*! data-handle: session sweep attempts */ -#define WT_STAT_CONN_DH_SESSION_SWEEPS 1065 +#define WT_STAT_CONN_DH_SESSION_SWEEPS 1066 /*! data-handle: connection sweep dhandles closed */ -#define WT_STAT_CONN_DH_SWEEP_CLOSE 1066 +#define WT_STAT_CONN_DH_SWEEP_CLOSE 1067 /*! data-handle: connection sweep candidate became referenced */ -#define WT_STAT_CONN_DH_SWEEP_REF 1067 +#define WT_STAT_CONN_DH_SWEEP_REF 1068 /*! data-handle: connection sweep dhandles removed from hash list */ -#define WT_STAT_CONN_DH_SWEEP_REMOVE 1068 +#define WT_STAT_CONN_DH_SWEEP_REMOVE 1069 /*! data-handle: connection sweep time-of-death sets */ -#define WT_STAT_CONN_DH_SWEEP_TOD 1069 +#define WT_STAT_CONN_DH_SWEEP_TOD 1070 /*! data-handle: connection sweeps */ -#define WT_STAT_CONN_DH_SWEEPS 1070 +#define WT_STAT_CONN_DH_SWEEPS 1071 /*! connection: files currently open */ -#define WT_STAT_CONN_FILE_OPEN 1071 +#define WT_STAT_CONN_FILE_OPEN 1072 /*! log: total log buffer size */ -#define WT_STAT_CONN_LOG_BUFFER_SIZE 1072 +#define WT_STAT_CONN_LOG_BUFFER_SIZE 1073 /*! log: log bytes of payload data */ -#define WT_STAT_CONN_LOG_BYTES_PAYLOAD 1073 +#define WT_STAT_CONN_LOG_BYTES_PAYLOAD 1074 /*! log: log bytes written */ -#define WT_STAT_CONN_LOG_BYTES_WRITTEN 1074 +#define WT_STAT_CONN_LOG_BYTES_WRITTEN 1075 /*! log: yields waiting for previous log file close */ -#define WT_STAT_CONN_LOG_CLOSE_YIELDS 1075 +#define WT_STAT_CONN_LOG_CLOSE_YIELDS 1076 /*! log: total size of compressed records */ -#define WT_STAT_CONN_LOG_COMPRESS_LEN 1076 +#define WT_STAT_CONN_LOG_COMPRESS_LEN 1077 /*! log: total in-memory size of compressed records */ -#define WT_STAT_CONN_LOG_COMPRESS_MEM 1077 +#define WT_STAT_CONN_LOG_COMPRESS_MEM 1078 /*! log: log records too small to compress */ -#define WT_STAT_CONN_LOG_COMPRESS_SMALL 1078 +#define WT_STAT_CONN_LOG_COMPRESS_SMALL 1079 /*! log: log records not compressed */ -#define WT_STAT_CONN_LOG_COMPRESS_WRITE_FAILS 1079 +#define WT_STAT_CONN_LOG_COMPRESS_WRITE_FAILS 1080 /*! log: log records compressed */ -#define WT_STAT_CONN_LOG_COMPRESS_WRITES 1080 +#define WT_STAT_CONN_LOG_COMPRESS_WRITES 1081 /*! log: maximum log file size */ -#define WT_STAT_CONN_LOG_MAX_FILESIZE 1081 +#define WT_STAT_CONN_LOG_MAX_FILESIZE 1082 /*! log: pre-allocated log files prepared */ -#define WT_STAT_CONN_LOG_PREALLOC_FILES 1082 +#define WT_STAT_CONN_LOG_PREALLOC_FILES 1083 /*! log: number of pre-allocated log files to create */ -#define WT_STAT_CONN_LOG_PREALLOC_MAX 1083 +#define WT_STAT_CONN_LOG_PREALLOC_MAX 1084 /*! log: pre-allocated log files used */ -#define WT_STAT_CONN_LOG_PREALLOC_USED 1084 +#define WT_STAT_CONN_LOG_PREALLOC_USED 1085 /*! log: log release advances write LSN */ -#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1085 +#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1086 /*! log: records processed by log scan */ -#define WT_STAT_CONN_LOG_SCAN_RECORDS 1086 +#define WT_STAT_CONN_LOG_SCAN_RECORDS 1087 /*! log: log scan records requiring two reads */ -#define WT_STAT_CONN_LOG_SCAN_REREADS 1087 +#define WT_STAT_CONN_LOG_SCAN_REREADS 1088 /*! log: log scan operations */ -#define WT_STAT_CONN_LOG_SCANS 1088 +#define WT_STAT_CONN_LOG_SCANS 1089 /*! log: consolidated slot closures */ -#define WT_STAT_CONN_LOG_SLOT_CLOSES 1089 +#define WT_STAT_CONN_LOG_SLOT_CLOSES 1090 /*! log: written slots coalesced */ -#define WT_STAT_CONN_LOG_SLOT_COALESCED 1090 +#define WT_STAT_CONN_LOG_SLOT_COALESCED 1091 /*! log: logging bytes consolidated */ -#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1091 +#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1092 /*! log: consolidated slot joins */ -#define WT_STAT_CONN_LOG_SLOT_JOINS 1092 +#define WT_STAT_CONN_LOG_SLOT_JOINS 1093 /*! log: consolidated slot join races */ -#define WT_STAT_CONN_LOG_SLOT_RACES 1093 +#define WT_STAT_CONN_LOG_SLOT_RACES 1094 /*! log: record size exceeded maximum */ -#define WT_STAT_CONN_LOG_SLOT_TOOBIG 1094 +#define WT_STAT_CONN_LOG_SLOT_TOOBIG 1095 /*! log: failed to find a slot large enough for record */ -#define WT_STAT_CONN_LOG_SLOT_TOOSMALL 1095 +#define WT_STAT_CONN_LOG_SLOT_TOOSMALL 1096 /*! log: consolidated slot join transitions */ -#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS 1096 +#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS 1097 /*! log: log sync operations */ -#define WT_STAT_CONN_LOG_SYNC 1097 +#define WT_STAT_CONN_LOG_SYNC 1098 /*! log: log sync_dir operations */ -#define WT_STAT_CONN_LOG_SYNC_DIR 1098 +#define WT_STAT_CONN_LOG_SYNC_DIR 1099 /*! log: log server thread advances write LSN */ -#define WT_STAT_CONN_LOG_WRITE_LSN 1099 +#define WT_STAT_CONN_LOG_WRITE_LSN 1100 /*! log: log write operations */ -#define WT_STAT_CONN_LOG_WRITES 1100 +#define WT_STAT_CONN_LOG_WRITES 1101 /*! LSM: sleep for LSM checkpoint throttle */ -#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1101 +#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1102 /*! LSM: sleep for LSM merge throttle */ -#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1102 +#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1103 /*! LSM: rows merged in an LSM tree */ -#define WT_STAT_CONN_LSM_ROWS_MERGED 1103 +#define WT_STAT_CONN_LSM_ROWS_MERGED 1104 /*! LSM: application work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1104 +#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1105 /*! LSM: merge work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1105 +#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1106 /*! LSM: tree queue hit maximum */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1106 +#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1107 /*! LSM: switch work units currently queued */ -#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1107 +#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1108 /*! LSM: tree maintenance operations scheduled */ -#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1108 +#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1109 /*! LSM: tree maintenance operations discarded */ -#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1109 +#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1110 /*! LSM: tree maintenance operations executed */ -#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1110 +#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1111 /*! connection: memory allocations */ -#define WT_STAT_CONN_MEMORY_ALLOCATION 1111 +#define WT_STAT_CONN_MEMORY_ALLOCATION 1112 /*! connection: memory frees */ -#define WT_STAT_CONN_MEMORY_FREE 1112 +#define WT_STAT_CONN_MEMORY_FREE 1113 /*! connection: memory re-allocations */ -#define WT_STAT_CONN_MEMORY_GROW 1113 +#define WT_STAT_CONN_MEMORY_GROW 1114 /*! thread-yield: page acquire busy blocked */ -#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1114 +#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1115 /*! thread-yield: page acquire eviction blocked */ -#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1115 +#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1116 /*! thread-yield: page acquire locked blocked */ -#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1116 +#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1117 /*! thread-yield: page acquire read blocked */ -#define WT_STAT_CONN_PAGE_READ_BLOCKED 1117 +#define WT_STAT_CONN_PAGE_READ_BLOCKED 1118 /*! thread-yield: page acquire time sleeping (usecs) */ -#define WT_STAT_CONN_PAGE_SLEEP 1118 +#define WT_STAT_CONN_PAGE_SLEEP 1119 /*! connection: total read I/Os */ -#define WT_STAT_CONN_READ_IO 1119 +#define WT_STAT_CONN_READ_IO 1120 /*! reconciliation: page reconciliation calls */ -#define WT_STAT_CONN_REC_PAGES 1120 +#define WT_STAT_CONN_REC_PAGES 1121 /*! reconciliation: page reconciliation calls for eviction */ -#define WT_STAT_CONN_REC_PAGES_EVICTION 1121 +#define WT_STAT_CONN_REC_PAGES_EVICTION 1122 /*! reconciliation: split bytes currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1122 +#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1123 /*! reconciliation: split objects currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1123 +#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1124 /*! connection: pthread mutex shared lock read-lock calls */ -#define WT_STAT_CONN_RWLOCK_READ 1124 +#define WT_STAT_CONN_RWLOCK_READ 1125 /*! connection: pthread mutex shared lock write-lock calls */ -#define WT_STAT_CONN_RWLOCK_WRITE 1125 +#define WT_STAT_CONN_RWLOCK_WRITE 1126 /*! session: open cursor count */ -#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1126 +#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1127 /*! session: open session count */ -#define WT_STAT_CONN_SESSION_OPEN 1127 +#define WT_STAT_CONN_SESSION_OPEN 1128 /*! transaction: transaction begins */ -#define WT_STAT_CONN_TXN_BEGIN 1128 +#define WT_STAT_CONN_TXN_BEGIN 1129 /*! transaction: transaction checkpoints */ -#define WT_STAT_CONN_TXN_CHECKPOINT 1129 +#define WT_STAT_CONN_TXN_CHECKPOINT 1130 /*! transaction: transaction checkpoint generation */ -#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1130 +#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1131 /*! transaction: transaction checkpoint currently running */ -#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1131 +#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1132 /*! transaction: transaction checkpoint max time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1132 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1133 /*! transaction: transaction checkpoint min time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1133 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1134 /*! transaction: transaction checkpoint most recent time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1134 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1135 /*! transaction: transaction checkpoint total time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1135 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1136 /*! transaction: transactions committed */ -#define WT_STAT_CONN_TXN_COMMIT 1136 +#define WT_STAT_CONN_TXN_COMMIT 1137 /*! transaction: transaction failures due to cache overflow */ -#define WT_STAT_CONN_TXN_FAIL_CACHE 1137 +#define WT_STAT_CONN_TXN_FAIL_CACHE 1138 /*! transaction: transaction range of IDs currently pinned by a checkpoint */ -#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1138 +#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1139 /*! transaction: transaction range of IDs currently pinned */ -#define WT_STAT_CONN_TXN_PINNED_RANGE 1139 +#define WT_STAT_CONN_TXN_PINNED_RANGE 1140 /*! transaction: transactions rolled back */ -#define WT_STAT_CONN_TXN_ROLLBACK 1140 +#define WT_STAT_CONN_TXN_ROLLBACK 1141 /*! transaction: transaction sync calls */ -#define WT_STAT_CONN_TXN_SYNC 1141 +#define WT_STAT_CONN_TXN_SYNC 1142 /*! connection: total write I/Os */ -#define WT_STAT_CONN_WRITE_IO 1142 +#define WT_STAT_CONN_WRITE_IO 1143 /*! * @} diff --git a/src/support/stat.c b/src/support/stat.c index b706263d1ce..2f638790060 100644 --- a/src/support/stat.c +++ b/src/support/stat.c @@ -444,6 +444,8 @@ __wt_stat_init_connection_stats(WT_CONNECTION_STATS *stats) stats->cursor_search.desc = "cursor: cursor search calls"; stats->cursor_search_near.desc = "cursor: cursor search near calls"; stats->cursor_update.desc = "cursor: cursor update calls"; + stats->dh_conn_handle_count.desc = + "data-handle: connection data handles currently active"; stats->dh_sweep_ref.desc = "data-handle: connection sweep candidate became referenced"; stats->dh_sweep_close.desc = diff --git a/tools/wtstats/stat_data.py b/tools/wtstats/stat_data.py index db5b14d6cd6..3fbc634385a 100644 --- a/tools/wtstats/stat_data.py +++ b/tools/wtstats/stat_data.py @@ -13,6 +13,7 @@ no_scale_per_second_list = [ 'cache: tracked dirty bytes in the cache', 'cache: tracked dirty pages in the cache', 'connection: files currently open', + 'data-handle: connection data handles currently active', 'log: maximum log file size', 'log: number of pre-allocated log files to create', 'log: total log buffer size', @@ -74,6 +75,7 @@ no_clear_list = [ 'cache: tracked dirty bytes in the cache', 'cache: tracked dirty pages in the cache', 'connection: files currently open', + 'data-handle: connection data handles currently active', 'log: maximum log file size', 'log: number of pre-allocated log files to create', 'log: total log buffer size', |