diff options
author | William Schultz <william.schultz@mongodb.com> | 2018-10-02 21:54:58 -0400 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2018-10-02 21:57:52 -0400 |
commit | 982ba21e0ffbdaaf766dc8fa060728ba9b5f4914 (patch) | |
tree | efc760c482e30bd70bfbaf5854779a89acf00ef3 /src/mongo/db/transaction_metrics_observer.h | |
parent | 23d7c89e501d221a41f350b0b10a52a4f05bb2e2 (diff) | |
download | mongo-982ba21e0ffbdaaf766dc8fa060728ba9b5f4914.tar.gz |
SERVER-36697 Utilize TickSource for transactions timing metrics
This patch converts the existing transactions diagnostics timing related
metrics to use a TickSource to record transaction durations. The
TickSource is a high precision, mock-able time source for measuring
the passage of time. This patch also converts the existing unit tests
to use a mock TickSource, which allows the tests to fully virtualize
time, making them much faster and less flaky.
Diffstat (limited to 'src/mongo/db/transaction_metrics_observer.h')
-rw-r--r-- | src/mongo/db/transaction_metrics_observer.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mongo/db/transaction_metrics_observer.h b/src/mongo/db/transaction_metrics_observer.h index 1ec30bedfff..72b5c89788e 100644 --- a/src/mongo/db/transaction_metrics_observer.h +++ b/src/mongo/db/transaction_metrics_observer.h @@ -47,7 +47,8 @@ public: */ void onStart(ServerTransactionsMetrics* serverTransactionMetrics, bool isAutoCommit, - unsigned long long curTime, + TickSource* tickSource, + Date_t curWallClockTime, Date_t expireDate); /** @@ -58,20 +59,19 @@ public: /** * Updates relevant metrics when a transaction stashes its resources. */ - void onStash(ServerTransactionsMetrics* serverTransactionMetrics, unsigned long long curTime); + void onStash(ServerTransactionsMetrics* serverTransactionMetrics, TickSource* tickSource); /** * Updates relevant metrics when a transaction unstashes its resources. */ - void onUnstash(ServerTransactionsMetrics* serverTransactionsMetrics, - unsigned long long curTime); + void onUnstash(ServerTransactionsMetrics* serverTransactionsMetrics, TickSource* tickSource); /** * Updates relevant metrics when a transaction commits. Also removes this transaction's oldest * oplog entry Timestamp from the oldestActiveOplogEntryTS set if it is not boost::none. */ void onCommit(ServerTransactionsMetrics* serverTransactionsMetrics, - unsigned long long curTime, + TickSource* tickSource, boost::optional<Timestamp> oldestOplogEntryTS, Top* top); @@ -80,7 +80,7 @@ public: * oldest oplog entry Timestamp from the oldestActiveOplogEntryTS set if it is not boost::none. */ void onAbortActive(ServerTransactionsMetrics* serverTransactionsMetrics, - unsigned long long curTime, + TickSource* tickSource, boost::optional<Timestamp> oldestOplogEntryTS, Top* top); @@ -89,7 +89,7 @@ public: * oldest oplog entry Timestamp from the oldestActiveOplogEntryTS set if it is not boost::none. */ void onAbortInactive(ServerTransactionsMetrics* serverTransactionsMetrics, - unsigned long long curTime, + TickSource* tickSource, boost::optional<Timestamp> oldestOplogEntryTS, Top* top); @@ -125,7 +125,8 @@ public: private: // Updates relevant metrics for any generic transaction abort. void _onAbort(ServerTransactionsMetrics* serverTransactionsMetrics, - unsigned long long curTime, + TickSource::Tick curTick, + TickSource* tickSource, Top* top); // Tracks metrics for a single multi-document transaction. |