The current Shard::runCommand() method only checks for the request status, command status, and write concern error.
Since Shard::runCommand simply takes a BSONObj cmdObj, it's dangerously easy to pass in a BatchedCommandRequest in BSONObj form and assume that retries and error checking will be correctly handled.
Status _getEffectiveCommandStatus(StatusWith<Shard::CommandResponse> cmdResponse) {
// Make sure the command even received a valid response
if (!cmdResponse.isOK()) {
return cmdResponse.getStatus();
}
// If the request reached the shard, check if the command itself failed.
if (!cmdResponse.getValue().commandStatus.isOK()) {
return cmdResponse.getValue().commandStatus;
}
// Finally check if the write concern failed
if (!cmdResponse.getValue().writeConcernStatus.isOK()) {
return cmdResponse.getValue().writeConcernStatus;
}
return Status::OK();
}
- is related to
-
SERVER-24828 ShardingCatalogClientImpl::_runBatchWriteCommand should notify the ReplicaSetMonitor for errors in the "writeErrors" response
-
- Closed
-
-
SERVER-24379 Implement addShardToZone and _configsvrAddShardToZone
-
- Closed
-