summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-08-14 16:20:22 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-08-14 17:05:00 +1000
commit95eba9dbd0dbdb549485c61c0c385ce0e911f892 (patch)
tree4f1c5c480272d731170a074092c865b8517f639b
parente8e1050c4f9cc6295f45949cfac8eeef2b9c1f43 (diff)
downloadmongo-95eba9dbd0dbdb549485c61c0c385ce0e911f892.tar.gz
WT-2038 Count and report the total number of data handles
(cherry picked from commit 95301eddd94c6383cfc08bd7aa8e09f91f55a856)
-rw-r--r--dist/stat_data.py2
-rw-r--r--src/conn/conn_stat.c4
-rw-r--r--src/include/connection.h3
-rw-r--r--src/include/stat.h1
-rw-r--r--src/include/wiredtiger.in160
-rw-r--r--src/os_posix/os_open.c4
-rw-r--r--src/support/stat.c2
-rw-r--r--tools/wtstats/stat_data.py2
8 files changed, 97 insertions, 81 deletions
diff --git a/dist/stat_data.py b/dist/stat_data.py
index e8d53187d1a..d27840d3fbc 100644
--- a/dist/stat_data.py
+++ b/dist/stat_data.py
@@ -205,6 +205,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 0d008939d8c..07ebfacface 100644
--- a/src/conn/conn_stat.c
+++ b/src/conn/conn_stat.c
@@ -45,6 +45,10 @@ __wt_conn_stat_init(WT_SESSION_IMPL *session)
__wt_async_stats_update(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 34eb704e5dd..ef813b18849 100644
--- a/src/include/connection.h
+++ b/src/include/connection.h
@@ -86,11 +86,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)
/*
@@ -198,6 +200,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 ab9a684b9ae..aab251f0e31 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 36a34b3edf3..ab03d2d27ad 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -3333,164 +3333,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 read operations */
-#define WT_STAT_CONN_LOG_READS 1085
+#define WT_STAT_CONN_LOG_READS 1086
/*! log: log release advances write LSN */
-#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1086
+#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1087
/*! log: records processed by log scan */
-#define WT_STAT_CONN_LOG_SCAN_RECORDS 1087
+#define WT_STAT_CONN_LOG_SCAN_RECORDS 1088
/*! log: log scan records requiring two reads */
-#define WT_STAT_CONN_LOG_SCAN_REREADS 1088
+#define WT_STAT_CONN_LOG_SCAN_REREADS 1089
/*! log: log scan operations */
-#define WT_STAT_CONN_LOG_SCANS 1089
+#define WT_STAT_CONN_LOG_SCANS 1090
/*! log: consolidated slot closures */
-#define WT_STAT_CONN_LOG_SLOT_CLOSES 1090
+#define WT_STAT_CONN_LOG_SLOT_CLOSES 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: slots selected for switching that were unavailable */
-#define WT_STAT_CONN_LOG_SLOT_SWITCH_FAILS 1094
+#define WT_STAT_CONN_LOG_SLOT_SWITCH_FAILS 1095
/*! log: record size exceeded maximum */
-#define WT_STAT_CONN_LOG_SLOT_TOOBIG 1095
+#define WT_STAT_CONN_LOG_SLOT_TOOBIG 1096
/*! log: failed to find a slot large enough for record */
-#define WT_STAT_CONN_LOG_SLOT_TOOSMALL 1096
+#define WT_STAT_CONN_LOG_SLOT_TOOSMALL 1097
/*! log: consolidated slot join transitions */
-#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS 1097
+#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS 1098
/*! log: log sync operations */
-#define WT_STAT_CONN_LOG_SYNC 1098
+#define WT_STAT_CONN_LOG_SYNC 1099
/*! log: log sync_dir operations */
-#define WT_STAT_CONN_LOG_SYNC_DIR 1099
+#define WT_STAT_CONN_LOG_SYNC_DIR 1100
/*! log: log server thread advances write LSN */
-#define WT_STAT_CONN_LOG_WRITE_LSN 1100
+#define WT_STAT_CONN_LOG_WRITE_LSN 1101
/*! log: log write operations */
-#define WT_STAT_CONN_LOG_WRITES 1101
+#define WT_STAT_CONN_LOG_WRITES 1102
/*! LSM: sleep for LSM checkpoint throttle */
-#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1102
+#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1103
/*! LSM: sleep for LSM merge throttle */
-#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1103
+#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1104
/*! LSM: rows merged in an LSM tree */
-#define WT_STAT_CONN_LSM_ROWS_MERGED 1104
+#define WT_STAT_CONN_LSM_ROWS_MERGED 1105
/*! LSM: application work units currently queued */
-#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1105
+#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1106
/*! LSM: merge work units currently queued */
-#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1106
+#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1107
/*! LSM: tree queue hit maximum */
-#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1107
+#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1108
/*! LSM: switch work units currently queued */
-#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1108
+#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1109
/*! LSM: tree maintenance operations scheduled */
-#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1109
+#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1110
/*! LSM: tree maintenance operations discarded */
-#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1110
+#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1111
/*! LSM: tree maintenance operations executed */
-#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1111
+#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1112
/*! connection: memory allocations */
-#define WT_STAT_CONN_MEMORY_ALLOCATION 1112
+#define WT_STAT_CONN_MEMORY_ALLOCATION 1113
/*! connection: memory frees */
-#define WT_STAT_CONN_MEMORY_FREE 1113
+#define WT_STAT_CONN_MEMORY_FREE 1114
/*! connection: memory re-allocations */
-#define WT_STAT_CONN_MEMORY_GROW 1114
+#define WT_STAT_CONN_MEMORY_GROW 1115
/*! thread-yield: page acquire busy blocked */
-#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1115
+#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1116
/*! thread-yield: page acquire eviction blocked */
-#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1116
+#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1117
/*! thread-yield: page acquire locked blocked */
-#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1117
+#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1118
/*! thread-yield: page acquire read blocked */
-#define WT_STAT_CONN_PAGE_READ_BLOCKED 1118
+#define WT_STAT_CONN_PAGE_READ_BLOCKED 1119
/*! thread-yield: page acquire time sleeping (usecs) */
-#define WT_STAT_CONN_PAGE_SLEEP 1119
+#define WT_STAT_CONN_PAGE_SLEEP 1120
/*! connection: total read I/Os */
-#define WT_STAT_CONN_READ_IO 1120
+#define WT_STAT_CONN_READ_IO 1121
/*! reconciliation: page reconciliation calls */
-#define WT_STAT_CONN_REC_PAGES 1121
+#define WT_STAT_CONN_REC_PAGES 1122
/*! reconciliation: page reconciliation calls for eviction */
-#define WT_STAT_CONN_REC_PAGES_EVICTION 1122
+#define WT_STAT_CONN_REC_PAGES_EVICTION 1123
/*! reconciliation: split bytes currently awaiting free */
-#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1123
+#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1124
/*! reconciliation: split objects currently awaiting free */
-#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1124
+#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1125
/*! connection: pthread mutex shared lock read-lock calls */
-#define WT_STAT_CONN_RWLOCK_READ 1125
+#define WT_STAT_CONN_RWLOCK_READ 1126
/*! connection: pthread mutex shared lock write-lock calls */
-#define WT_STAT_CONN_RWLOCK_WRITE 1126
+#define WT_STAT_CONN_RWLOCK_WRITE 1127
/*! session: open cursor count */
-#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1127
+#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1128
/*! session: open session count */
-#define WT_STAT_CONN_SESSION_OPEN 1128
+#define WT_STAT_CONN_SESSION_OPEN 1129
/*! transaction: transaction begins */
-#define WT_STAT_CONN_TXN_BEGIN 1129
+#define WT_STAT_CONN_TXN_BEGIN 1130
/*! transaction: transaction checkpoints */
-#define WT_STAT_CONN_TXN_CHECKPOINT 1130
+#define WT_STAT_CONN_TXN_CHECKPOINT 1131
/*! transaction: transaction checkpoint generation */
-#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1131
+#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1132
/*! transaction: transaction checkpoint currently running */
-#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1132
+#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1133
/*! transaction: transaction checkpoint max time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1133
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1134
/*! transaction: transaction checkpoint min time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1134
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1135
/*! transaction: transaction checkpoint most recent time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1135
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1136
/*! transaction: transaction checkpoint total time (msecs) */
-#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1136
+#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1137
/*! transaction: transactions committed */
-#define WT_STAT_CONN_TXN_COMMIT 1137
+#define WT_STAT_CONN_TXN_COMMIT 1138
/*! transaction: transaction failures due to cache overflow */
-#define WT_STAT_CONN_TXN_FAIL_CACHE 1138
+#define WT_STAT_CONN_TXN_FAIL_CACHE 1139
/*! transaction: transaction range of IDs currently pinned by a checkpoint */
-#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1139
+#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1140
/*! transaction: transaction range of IDs currently pinned */
-#define WT_STAT_CONN_TXN_PINNED_RANGE 1140
+#define WT_STAT_CONN_TXN_PINNED_RANGE 1141
/*! transaction: transactions rolled back */
-#define WT_STAT_CONN_TXN_ROLLBACK 1141
+#define WT_STAT_CONN_TXN_ROLLBACK 1142
/*! connection: total write I/Os */
-#define WT_STAT_CONN_WRITE_IO 1142
+#define WT_STAT_CONN_WRITE_IO 1143
/*!
* @}
diff --git a/src/os_posix/os_open.c b/src/os_posix/os_open.c
index d8afbf88f87..c636a9f9b32 100644
--- a/src/os_posix/os_open.c
+++ b/src/os_posix/os_open.c
@@ -177,7 +177,7 @@ setupfh:
}
if (!matched) {
WT_CONN_FILE_INSERT(conn, fh, bucket);
- WT_STAT_ATOMIC_INCR(&conn->stats, file_open);
+ (void)WT_ATOMIC_SUB4(conn->open_file_count, 1);
*fhp = fh;
}
@@ -223,7 +223,7 @@ __wt_close(WT_SESSION_IMPL *session, WT_FH **fhp)
/* Remove from the list. */
bucket = fh->name_hash % WT_HASH_ARRAY_SIZE;
WT_CONN_FILE_REMOVE(conn, fh, bucket);
- WT_STAT_ATOMIC_DECR(&conn->stats, file_open);
+ (void)WT_ATOMIC_SUB4(conn->open_file_count, 1);
__wt_spin_unlock(session, &conn->fh_lock);
diff --git a/src/support/stat.c b/src/support/stat.c
index 9897e337bf0..476566b227f 100644
--- a/src/support/stat.c
+++ b/src/support/stat.c
@@ -433,6 +433,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 a4fc2fcc831..d480ecb0547 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',
@@ -72,6 +73,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',