summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/sharding/csrs_upgrade_during_migrate.js7
-rw-r--r--src/mongo/db/s/migration_impl.cpp1
2 files changed, 8 insertions, 0 deletions
diff --git a/jstests/sharding/csrs_upgrade_during_migrate.js b/jstests/sharding/csrs_upgrade_during_migrate.js
index d66a0e21d23..7310644d032 100644
--- a/jstests/sharding/csrs_upgrade_during_migrate.js
+++ b/jstests/sharding/csrs_upgrade_during_migrate.js
@@ -204,17 +204,24 @@ var st;
// Remove slave delay so that the migration can finish in a reasonable amount of time.
setSlaveDelay(st.rs0, false);
setSlaveDelay(st.rs1, false);
+ st.rs0.awaitReplication();
+ st.rs1.awaitReplication();
// Due to SERVER-20290 the recipient shard may not immediately realize that the migration that
// was going on during the upgrade has been aborted, so we need to wait until it notices this
// before starting a new migration.
// TODO(spencer): Remove this after SERVER-20290 is fixed.
+ jsTest.log("Waiting for previous migration to be fully cleaned up");
assert.soon(function() {
var res = st.rs1.getPrimary().adminCommand('_recvChunkStatus');
assert.commandWorked(res);
+ if (res.active) {
+ printjson(res);
+ }
return !res.active;
});
+ jsTest.log("Starting new migration after upgrade, which should succeed");
assert.commandWorked(st.s0.adminCommand({moveChunk: dataCollectionName,
find: { _id: 0 },
to: shardConfigs[1]._id
diff --git a/src/mongo/db/s/migration_impl.cpp b/src/mongo/db/s/migration_impl.cpp
index fbc8534f835..367bdc9e5c8 100644
--- a/src/mongo/db/s/migration_impl.cpp
+++ b/src/mongo/db/s/migration_impl.cpp
@@ -288,6 +288,7 @@ Status ChunkMoveOperationState::commitMigration() {
Status startStatus = ShardingStateRecovery::startMetadataOp(_txn);
if (!startStatus.isOK()) {
+ warning() << "Failed to write sharding state recovery document" << causedBy(startStatus);
return startStatus;
}