summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_process.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2018-02-13 12:50:24 -0500
committerBenety Goh <benety@mongodb.com>2018-02-13 12:53:35 -0500
commit6353f3613ac73d67bc064f7bbc81f949e6542838 (patch)
tree051967c62ccb9e44e1fdc2e35c4ceaf6e07bf37d /src/mongo/db/repl/replication_process.cpp
parentda12466c2f109ada2d487db9c6fd92200f5b6b1d (diff)
downloadmongo-6353f3613ac73d67bc064f7bbc81f949e6542838.tar.gz
SERVER-32776 ReplicationProcess::getRollbackID() no longer reads from storage to refresh cached rollback id
Diffstat (limited to 'src/mongo/db/repl/replication_process.cpp')
-rw-r--r--src/mongo/db/repl/replication_process.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/mongo/db/repl/replication_process.cpp b/src/mongo/db/repl/replication_process.cpp
index 3e4b9cd7669..7f091a990a6 100644
--- a/src/mongo/db/repl/replication_process.cpp
+++ b/src/mongo/db/repl/replication_process.cpp
@@ -53,7 +53,6 @@ namespace {
const auto getReplicationProcess =
ServiceContext::declareDecoration<std::unique_ptr<ReplicationProcess>>();
-const auto kRollbackNamespacePrefix = "local.system.rollback."_sd;
} // namespace
ReplicationProcess* ReplicationProcess::get(ServiceContext* service) {
@@ -101,23 +100,13 @@ Status ReplicationProcess::refreshRollbackID(OperationContext* opCtx) {
return Status::OK();
}
-StatusWith<int> ReplicationProcess::getRollbackID(OperationContext* opCtx) {
+int ReplicationProcess::getRollbackID() const {
stdx::lock_guard<stdx::mutex> lock(_mutex);
-
- if (kUninitializedRollbackId != _rbid) {
- return _rbid;
- }
-
- // The _rbid, which caches the rollback ID persisted in the local.system.rollback.id collection,
- // may be uninitialized because this is the first time we are retrieving the rollback ID.
- auto rbidResult = _storageInterface->getRollbackID(opCtx);
- if (!rbidResult.isOK()) {
- return rbidResult;
+ if (kUninitializedRollbackId == _rbid) {
+ // This may happen when serverStatus is called by an internal client before we have a chance
+ // to read the rollback ID from storage.
+ warning() << "Rollback ID is not initialized yet.";
}
- log() << "Rollback ID is " << rbidResult.getValue();
- _rbid = rbidResult.getValue();
-
- invariant(kUninitializedRollbackId != _rbid);
return _rbid;
}