BSONForEach(elem, updates) {
     BSONObj entry = elem.Obj();
     OID id = entry["_id"].OID();
     OpTime ot = entry["optime"]._opTime();
     Status status = setLastOptime(txn, id, ot);
     if (!status.isOK()) {
         return status;
     }
 }
Exemple #2
0
    Status ReplicationCoordinatorImpl::processReplSetUpdatePosition(
            OperationContext* txn,
            const UpdatePositionArgs& updates) {

        for (UpdatePositionArgs::UpdateIterator update = updates.updatesBegin();
                update != updates.updatesEnd();
                ++update) {
            Status status = setLastOptime(txn, update->rid, update->ts);
            if (!status.isOK()) {
                return status;
            }
        }
        return Status::OK();
    }
    Status LegacyReplicationCoordinator::processReplSetUpdatePosition(const BSONArray& updates,
                                                                      BSONObjBuilder* resultObj) {
        Status status = _checkReplEnabledForCommand(resultObj);
        if (!status.isOK()) {
            return status;
        }

        BSONForEach(elem, updates) {
            BSONObj entry = elem.Obj();
            OID id = entry["_id"].OID();
            OpTime ot = entry["optime"]._opTime();
            BSONObj config = entry["config"].Obj();
            Status status = setLastOptime(id, ot, config);
            if (!status.isOK()) {
                return status;
            }
        }