diff options
author | Dan Pasette <dan@10gen.com> | 2013-03-18 13:54:36 -0400 |
---|---|---|
committer | Dan Pasette <dan@10gen.com> | 2013-03-28 19:35:01 -0400 |
commit | 9412afa6f3a61f173f8a43ed9af5d45164dda818 (patch) | |
tree | 86346d5e2a70a5d59ac464f16a3e0ab271cd97d0 | |
parent | 7f45f0fe14b9ffd64b6e75a9fe87d49c66a17b83 (diff) | |
download | mongo-9412afa6f3a61f173f8a43ed9af5d45164dda818.tar.gz |
SERVER-9003 - Display replica set chaining topology in rs.status()
Include syncingTo in heartbeat response and display this info for each
replica set member in the replSetGetStatus command.
-rw-r--r-- | src/mongo/db/repl/health.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/repl/heartbeat.cpp | 9 | ||||
-rw-r--r-- | src/mongo/db/repl/rs_member.h | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/db/repl/health.cpp b/src/mongo/db/repl/health.cpp index 7c2f85f6c87..a45809df732 100644 --- a/src/mongo/db/repl/health.cpp +++ b/src/mongo/db/repl/health.cpp @@ -446,6 +446,11 @@ namespace mongo { bb.append("authenticated", false); } + string syncingTo = m->hbinfo().syncingTo; + if (!syncingTo.empty()) { + bb.append("syncingTo", syncingTo); + } + v.push_back(bb.obj()); m = m->next(); } diff --git a/src/mongo/db/repl/heartbeat.cpp b/src/mongo/db/repl/heartbeat.cpp index fbac43b1d99..5ba3d5f3427 100644 --- a/src/mongo/db/repl/heartbeat.cpp +++ b/src/mongo/db/repl/heartbeat.cpp @@ -122,6 +122,11 @@ namespace mongo { result.append("hbmsg", theReplSet->hbmsg()); result.append("time", (long long) time(0)); result.appendDate("opTime", theReplSet->lastOpTimeWritten.asDate()); + const Member *syncTarget = replset::BackgroundSync::get()->getSyncTarget(); + if (syncTarget) { + result.append("syncingTo", syncTarget->fullName()); + } + int v = theReplSet->config().version; result.append("v", v); if( v > cmdObj["v"].Int() ) @@ -396,6 +401,10 @@ namespace mongo { } mem.health = 1.0; mem.lastHeartbeatMsg = info["hbmsg"].String(); + if (info.hasElement("syncingTo")) { + mem.syncingTo = info["syncingTo"].String(); + } + if( info.hasElement("opTime") ) mem.opTime = info["opTime"].Date(); diff --git a/src/mongo/db/repl/rs_member.h b/src/mongo/db/repl/rs_member.h index 967052c4da8..100a2013314 100644 --- a/src/mongo/db/repl/rs_member.h +++ b/src/mongo/db/repl/rs_member.h @@ -84,6 +84,7 @@ namespace mongo { // This is the last time we got a heartbeat request from a given member. time_t lastHeartbeatRecv; DiagStr lastHeartbeatMsg; + DiagStr syncingTo; OpTime opTime; int skew; bool authIssue; |