From 33ac1afd4079e04d12554f9b79d1ab07426caf59 Mon Sep 17 00:00:00 2001 From: Pavi Vetriselvan Date: Tue, 30 Oct 2018 14:45:38 -0400 Subject: SERVER-35811 pin stable timestamp behind oldest uncommitted timestamp --- src/mongo/db/transaction_metrics_observer.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src/mongo/db/transaction_metrics_observer.h') diff --git a/src/mongo/db/transaction_metrics_observer.h b/src/mongo/db/transaction_metrics_observer.h index d1a3bba4244..715aa14244f 100644 --- a/src/mongo/db/transaction_metrics_observer.h +++ b/src/mongo/db/transaction_metrics_observer.h @@ -70,37 +70,46 @@ public: /** * 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. + * oplog entry OpTime from the oldestActiveOplogEntryOpTimes set if it is not boost::none. + * Finally, updates an entry in oldestNonMajorityCommittedOpTimes to include its commit OpTime. */ void onCommit(ServerTransactionsMetrics* serverTransactionsMetrics, TickSource* tickSource, - boost::optional oldestOplogEntryTS, + boost::optional oldestOplogEntryOpTime, + boost::optional commitOpTime, Top* top); /** * Updates relevant metrics when an active transaction aborts. Also removes this transaction's - * oldest oplog entry Timestamp from the oldestActiveOplogEntryTS set if it is not boost::none. + * oldest oplog entry OpTime from the oldestActiveOplogEntryOpTimes set if it is not + * boost::none. + * Finally, updates an entry in oldestNonMajorityCommittedOpTimes to include its abort OpTime. */ void onAbortActive(ServerTransactionsMetrics* serverTransactionsMetrics, TickSource* tickSource, - boost::optional oldestOplogEntryTS, + boost::optional oldestOplogEntryOpTime, + boost::optional abortOpTime, Top* top); /** * Updates relevant metrics when an inactive transaction aborts. Also removes this transaction's - * oldest oplog entry Timestamp from the oldestActiveOplogEntryTS set if it is not boost::none. + * oldest oplog entry OpTime from the oldestActiveOplogEntryOpTimes set if it is not + * boost::none. + * Does not accept an optional abortOpTime parameter because we cannot abort an inactive + * prepared transaction. Instead, uses boost::none as the abortOpTime, which subsequently will + * not modify oldestNonMajorityCommittedOpTimes. */ void onAbortInactive(ServerTransactionsMetrics* serverTransactionsMetrics, TickSource* tickSource, - boost::optional oldestOplogEntryTS, + boost::optional oldestOplogEntryOpTime, Top* top); /** - * Adds the prepareTimestamp, which is currently the Timestamp of the first oplog entry written - * by an active transaction, to the oldestActiveOplogEntryTS set. + * Adds the prepareOpTime, which is currently the Timestamp of the first oplog entry written by + * an active transaction, to the oldestActiveOplogEntryTS set. */ void onPrepare(ServerTransactionsMetrics* serverTransactionsMetrics, - Timestamp prepareTimestamp); + repl::OpTime prepareOpTime); /** * Updates relevant metrics when an operation running on the transaction completes. An operation -- cgit v1.2.1