diff options
author | Dianna Hohensee <dianna.hohensee@10gen.com> | 2016-11-09 14:44:01 -0500 |
---|---|---|
committer | Dianna Hohensee <dianna.hohensee@10gen.com> | 2016-11-10 09:01:17 -0500 |
commit | e7dbc236d013d4e53a366efc8482b73efbc25992 (patch) | |
tree | fec1a8a8223d066e6e4d40c1d0ab090dc41f3c7e /src | |
parent | 7d68067e5a6272bb463acc4e7a6c6a144148039c (diff) | |
download | mongo-e7dbc236d013d4e53a366efc8482b73efbc25992.tar.gz |
SERVER-26946 check for errors sending moveChunk command that should not be propagated back to another server
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/s/balancer/migration_manager.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/db/s/balancer/migration_manager.cpp b/src/mongo/db/s/balancer/migration_manager.cpp index 7ac13446e5f..2be60547810 100644 --- a/src/mongo/db/s/balancer/migration_manager.cpp +++ b/src/mongo/db/s/balancer/migration_manager.cpp @@ -753,6 +753,8 @@ Status MigrationManager::_processRemoteCommandResponse( ScopedMigrationRequest* scopedMigrationRequest) { stdx::lock_guard<stdx::mutex> lock(_mutex); Status commandStatus(ErrorCodes::InternalError, "Uninitialized value."); + + // Check for local errors sending the remote command caused by stepdown. if (isErrorDueToConfigStepdown(remoteCommandResponse.status, _state != State::kEnabled && _state != State::kRecovering)) { scopedMigrationRequest->keepDocumentOnDestruct(); @@ -760,15 +762,18 @@ Status MigrationManager::_processRemoteCommandResponse( stream() << "Migration interrupted because the balancer is stopping." << " Command status: " << remoteCommandResponse.status.toString()}; - } else if (!remoteCommandResponse.isOK()) { + } + + if (!remoteCommandResponse.isOK()) { commandStatus = remoteCommandResponse.status; } else { commandStatus = extractMigrationStatusFromCommandResponse(remoteCommandResponse.data); - if (!Shard::shouldErrorBePropagated(commandStatus.code())) { - commandStatus = {ErrorCodes::OperationFailed, - stream() << "moveChunk command failed on source shard." - << causedBy(commandStatus)}; - } + } + + if (!Shard::shouldErrorBePropagated(commandStatus.code())) { + commandStatus = {ErrorCodes::OperationFailed, + stream() << "moveChunk command failed on source shard." + << causedBy(commandStatus)}; } // Any failure to remove the migration document should be because the config server is |