|
I believe replacing the following fragment of code:
BSONObj o;
|
uassert(17347,
|
"Problem reading earliest entry from oplog",
|
Helpers::getSingleton(opCtx, oplogNS.c_str(), o));
|
|
result.append("earliestOptime", o["ts"].timestamp());
|
return result.obj();
|
with
BSONObj o;
|
if(Helpers::getSingleton(opCtx, oplogNS.c_str(), o))
|
result.append("earliestOptime", o["ts"].timestamp());
|
|
return result.obj();
|
inside OplogInfoServerStatus::generateSection() could be one way of resolving this issue.
The above change would omit the earliestOptime field from the resulting BSON object if the node was in state STARTUP2. If, however, the earliestOptime field needs to be present for whatever reason, the alternative approach would be adding the field with a value that is effectively 0.
Modified file(s): mongo/src/mongo/db/repl/replication_info.cpp
Please share your thoughts.
|