summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2015-01-07 13:07:01 -0500
committerSpencer T Brody <spencer@mongodb.com>2015-01-07 13:49:35 -0500
commit4f540d4ee48b426aab310d0d08260db6decf67a4 (patch)
tree6c716c4895f192b866ef9df2f7f28dceede24313
parent331911d3f31cf93c82bfaab3b6db0a77fdb80374 (diff)
downloadmongo-4f540d4ee48b426aab310d0d08260db6decf67a4.tar.gz
SERVER-16714 Make serverStatus oplog section work with master-slave and config servers
-rw-r--r--src/mongo/db/repl/repl_info.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/repl/repl_info.cpp b/src/mongo/db/repl/repl_info.cpp
index f3f2b102bf9..49f4e830d1c 100644
--- a/src/mongo/db/repl/repl_info.cpp
+++ b/src/mongo/db/repl/repl_info.cpp
@@ -172,10 +172,13 @@ namespace repl {
BSONObjBuilder result;
result.append("latestOptime", replCoord->getMyLastOptime());
+ const char* oplogNS =
+ replCoord->getReplicationMode() == ReplicationCoordinator::modeReplSet ?
+ rsoplog : "local.oplog.$main";
BSONObj o;
uassert(17347,
"Problem reading earliest entry from oplog",
- Helpers::getSingleton(txn, rsoplog, o));
+ Helpers::getSingleton(txn, oplogNS, o));
result.append("earliestOptime", o["ts"]._opTime());
return result.obj();
}