summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hows <howsdav@gmail.com>2017-06-07 16:39:14 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2017-06-07 16:39:14 +1000
commit683b5d097b955d24903a2b527ad085a1488e3d3f (patch)
treecac27c24774f422391e76413e78bcf3c127a1cf8
parentad515323be891ce52216f410fb1d2d8a45cc3cbe (diff)
downloadmongo-683b5d097b955d24903a2b527ad085a1488e3d3f.tar.gz
WT-3332 Add per-connection stats for update transaction conflicts (#3448)
-rw-r--r--dist/stat_data.py1
-rw-r--r--src/include/stat.h1
-rw-r--r--src/include/txn.i2
-rw-r--r--src/include/wiredtiger.in2
-rw-r--r--src/support/stat.c3
5 files changed, 9 insertions, 0 deletions
diff --git a/dist/stat_data.py b/dist/stat_data.py
index acc156b947e..0850853fa3b 100644
--- a/dist/stat_data.py
+++ b/dist/stat_data.py
@@ -436,6 +436,7 @@ connection_stats = [
TxnStat('txn_snapshots_created', 'number of named snapshots created'),
TxnStat('txn_snapshots_dropped', 'number of named snapshots dropped'),
TxnStat('txn_sync', 'transaction sync calls'),
+ TxnStat('txn_update_conflict', 'update conflicts'),
##########################################
# Yield statistics
diff --git a/src/include/stat.h b/src/include/stat.h
index 7c2529f1746..cbd2bb9af5e 100644
--- a/src/include/stat.h
+++ b/src/include/stat.h
@@ -513,6 +513,7 @@ struct __wt_connection_stats {
int64_t txn_sync;
int64_t txn_commit;
int64_t txn_rollback;
+ int64_t txn_update_conflict;
};
/*
diff --git a/src/include/txn.i b/src/include/txn.i
index f7321af5b12..f4f571cb67e 100644
--- a/src/include/txn.i
+++ b/src/include/txn.i
@@ -424,6 +424,8 @@ __wt_txn_update_check(WT_SESSION_IMPL *session, WT_UPDATE *upd)
if (txn->isolation == WT_ISO_SNAPSHOT)
while (upd != NULL && !__wt_txn_visible(session, upd->txnid)) {
if (upd->txnid != WT_TXN_ABORTED) {
+ WT_STAT_CONN_INCR(
+ session, txn_update_conflict);
WT_STAT_DATA_INCR(
session, txn_update_conflict);
return (WT_ROLLBACK);
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 2bbe812d7f7..03ce35313c5 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -4986,6 +4986,8 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection);
#define WT_STAT_CONN_TXN_COMMIT 1254
/*! transaction: transactions rolled back */
#define WT_STAT_CONN_TXN_ROLLBACK 1255
+/*! transaction: update conflicts */
+#define WT_STAT_CONN_TXN_UPDATE_CONFLICT 1256
/*!
* @}
diff --git a/src/support/stat.c b/src/support/stat.c
index 061615c0931..dcad5351fe8 100644
--- a/src/support/stat.c
+++ b/src/support/stat.c
@@ -888,6 +888,7 @@ static const char * const __stats_connection_desc[] = {
"transaction: transaction sync calls",
"transaction: transactions committed",
"transaction: transactions rolled back",
+ "transaction: update conflicts",
};
int
@@ -1186,6 +1187,7 @@ __wt_stat_connection_clear_single(WT_CONNECTION_STATS *stats)
stats->txn_sync = 0;
stats->txn_commit = 0;
stats->txn_rollback = 0;
+ stats->txn_update_conflict = 0;
}
void
@@ -1563,6 +1565,7 @@ __wt_stat_connection_aggregate(
to->txn_sync += WT_STAT_READ(from, txn_sync);
to->txn_commit += WT_STAT_READ(from, txn_commit);
to->txn_rollback += WT_STAT_READ(from, txn_rollback);
+ to->txn_update_conflict += WT_STAT_READ(from, txn_update_conflict);
}
static const char * const __stats_join_desc[] = {