summaryrefslogtreecommitdiff
path: root/src/mongo/db/server_transactions_metrics.cpp
diff options
context:
space:
mode:
authorSamy Lanka <samy.lanka@mongodb.com>2019-01-24 21:57:25 -0500
committerSamy Lanka <samy.lanka@mongodb.com>2019-02-11 12:27:33 -0500
commit4f858c52b05ecc49d2ae19bbaf59fc0aad445b7e (patch)
tree2af6afbcb4d27b4b1ce22eb25750583666396a8a /src/mongo/db/server_transactions_metrics.cpp
parentd568e329a67eee8ba241d52067750a3d8c42dc0f (diff)
downloadmongo-4f858c52b05ecc49d2ae19bbaf59fc0aad445b7e.tar.gz
SERVER-36489 Start initial sync oplog fetching from the 'oldest active transaction timestamp'
SERVER-36490 Initial sync should not actually prepare transactions on applying prepareTransaction oplog entries SERVER-36491 During initial sync, make commitTransaction oplog entries apply the transaction from the prepare oplog entry
Diffstat (limited to 'src/mongo/db/server_transactions_metrics.cpp')
-rw-r--r--src/mongo/db/server_transactions_metrics.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mongo/db/server_transactions_metrics.cpp b/src/mongo/db/server_transactions_metrics.cpp
index 11f6480d887..a46a663e0b1 100644
--- a/src/mongo/db/server_transactions_metrics.cpp
+++ b/src/mongo/db/server_transactions_metrics.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/commands/server_status.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context.h"
+#include "mongo/db/repl/optime.h"
#include "mongo/db/retryable_writes_stats.h"
#include "mongo/db/service_context.h"
#include "mongo/db/transactions_stats_gen.h"
@@ -295,12 +296,12 @@ void ServerTransactionsMetrics::updateStats(TransactionsStats* stats, OperationC
ServerTransactionsMetrics::_getOldestOpenUnpreparedReadTimestamp(opCtx));
// Acquire _mutex before reading _oldestActiveOplogEntryOpTime.
stdx::lock_guard<stdx::mutex> lm(_mutex);
- // To avoid compression loss, we have Timestamp(0, 0) be the default value if no oldest active
- // transaction optime is stored.
- Timestamp oldestActiveOplogEntryTimestamp = (_oldestActiveOplogEntryOpTime != boost::none)
- ? _oldestActiveOplogEntryOpTime->getTimestamp()
- : Timestamp();
- stats->setOldestActiveOplogEntryTimestamp(oldestActiveOplogEntryTimestamp);
+ // To avoid compression loss, we use the null OpTime if no oldest active transaction optime is
+ // stored.
+ repl::OpTime oldestActiveOplogEntryOpTime = (_oldestActiveOplogEntryOpTime != boost::none)
+ ? _oldestActiveOplogEntryOpTime.get()
+ : repl::OpTime();
+ stats->setOldestActiveOplogEntryOpTime(oldestActiveOplogEntryOpTime);
}
void ServerTransactionsMetrics::clearOpTimes() {