summaryrefslogtreecommitdiff
path: root/src/mongo/db/transaction_metrics_observer.cpp
diff options
context:
space:
mode:
authorPavi Vetriselvan <pvselvan@umich.edu>2019-04-01 13:42:11 -0400
committerPavi Vetriselvan <pvselvan@umich.edu>2019-04-01 14:05:19 -0400
commite433a5aee915568cf73b05e89597903855ed1952 (patch)
tree6c05ba3dab362405e8d07cc5bf65ea86003ddbbf /src/mongo/db/transaction_metrics_observer.cpp
parente96547906836a12d76b7a1591a0028b1fff8cb79 (diff)
downloadmongo-e433a5aee915568cf73b05e89597903855ed1952.tar.gz
Revert "SERVER-35811 disallow committing at the prepareTimestamp and pin stable TS before oldest uncommitted TS"
This reverts commit b58420e57a2149c350ebf82815fe708850402296 and 33ac1afd4079e04d12554f9b79d1ab07426caf59.
Diffstat (limited to 'src/mongo/db/transaction_metrics_observer.cpp')
-rw-r--r--src/mongo/db/transaction_metrics_observer.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/mongo/db/transaction_metrics_observer.cpp b/src/mongo/db/transaction_metrics_observer.cpp
index e1f092d60b5..fd19a6cba65 100644
--- a/src/mongo/db/transaction_metrics_observer.cpp
+++ b/src/mongo/db/transaction_metrics_observer.cpp
@@ -95,11 +95,8 @@ void TransactionMetricsObserver::onUnstash(ServerTransactionsMetrics* serverTran
void TransactionMetricsObserver::onCommit(ServerTransactionsMetrics* serverTransactionsMetrics,
TickSource* tickSource,
boost::optional<repl::OpTime> oldestOplogEntryOpTime,
- boost::optional<repl::OpTime> commitOpTime,
Top* top,
bool wasPrepared) {
- invariant((oldestOplogEntryOpTime != boost::none && commitOpTime != boost::none) ||
- (oldestOplogEntryOpTime == boost::none && commitOpTime == boost::none));
//
// Per transaction metrics.
//
@@ -129,7 +126,7 @@ void TransactionMetricsObserver::onCommit(ServerTransactionsMetrics* serverTrans
// Remove this transaction's oldest oplog entry OpTime if one was written.
if (oldestOplogEntryOpTime) {
- serverTransactionsMetrics->removeActiveOpTime(*oldestOplogEntryOpTime, commitOpTime);
+ serverTransactionsMetrics->removeActiveOpTime(*oldestOplogEntryOpTime);
}
}
@@ -137,11 +134,8 @@ void TransactionMetricsObserver::_onAbortActive(
ServerTransactionsMetrics* serverTransactionsMetrics,
TickSource* tickSource,
boost::optional<repl::OpTime> oldestOplogEntryOpTime,
- boost::optional<repl::OpTime> abortOpTime,
Top* top,
bool wasPrepared) {
- invariant((oldestOplogEntryOpTime != boost::none && abortOpTime != boost::none) ||
- (oldestOplogEntryOpTime == boost::none && abortOpTime == boost::none));
auto curTick = tickSource->getTicks();
invariant(_singleTransactionStats.isActive());
@@ -163,7 +157,7 @@ void TransactionMetricsObserver::_onAbortActive(
// Remove this transaction's oldest oplog entry OpTime if one was written.
if (oldestOplogEntryOpTime) {
- serverTransactionsMetrics->removeActiveOpTime(*oldestOplogEntryOpTime, abortOpTime);
+ serverTransactionsMetrics->removeActiveOpTime(*oldestOplogEntryOpTime);
}
}
@@ -183,25 +177,22 @@ void TransactionMetricsObserver::_onAbortInactive(
// Remove this transaction's oldest oplog entry OpTime if one was written.
if (oldestOplogEntryOpTime) {
- serverTransactionsMetrics->removeActiveOpTime(*oldestOplogEntryOpTime, boost::none);
+ serverTransactionsMetrics->removeActiveOpTime(*oldestOplogEntryOpTime);
}
}
void TransactionMetricsObserver::onAbort(ServerTransactionsMetrics* serverTransactionsMetrics,
TickSource* tickSource,
boost::optional<repl::OpTime> oldestOplogEntryOpTime,
- boost::optional<repl::OpTime> abortOpTime,
Top* top,
bool wasPrepared) {
if (_singleTransactionStats.isActive()) {
_onAbortActive(serverTransactionsMetrics,
tickSource,
oldestOplogEntryOpTime,
- abortOpTime,
top,
wasPrepared);
} else {
- invariant(abortOpTime == boost::none);
invariant(!wasPrepared);
_onAbortInactive(serverTransactionsMetrics, tickSource, oldestOplogEntryOpTime, top);
}
@@ -260,14 +251,13 @@ void TransactionMetricsObserver::_onAbort(ServerTransactionsMetrics* serverTrans
void TransactionMetricsObserver::onPrepare(ServerTransactionsMetrics* serverTransactionsMetrics,
repl::OpTime prepareOpTime,
TickSource::Tick curTick) {
-
//
// Per transaction metrics.
//
_singleTransactionStats.setPreparedStartTime(curTick);
// Since we currently only write an oplog entry for an in progress transaction when it is in
- // the prepare state, the prepareOpTime is currently the oldest OpTime written to the
+ // the prepare state, the prepareOpTime is currently the oldest optime written to the
// oplog for this transaction.
serverTransactionsMetrics->addActiveOpTime(prepareOpTime);
serverTransactionsMetrics->incrementCurrentPrepared();