summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@10gen.com>2012-10-26 19:23:15 -0400
committerSpencer T Brody <spencer@10gen.com>2012-11-16 17:34:19 -0500
commit9032d392d0caecc23491048710b87c14dd49003f (patch)
tree43e3eb2ef2eba23868aded77c17b5c53a14a7ed4
parent448ef26e3d74706380b2350030aafc4b22338952 (diff)
downloadmongo-9032d392d0caecc23491048710b87c14dd49003f.tar.gz
Fix how we abort a commit if _recvChunkVersion throws an exception
-rw-r--r--src/mongo/s/d_migrate.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp
index 69070aab02c..0563915a4bb 100644
--- a/src/mongo/s/d_migrate.cpp
+++ b/src/mongo/s/d_migrate.cpp
@@ -913,6 +913,7 @@ namespace mongo {
configServer.logChange( "moveChunk.start" , ns , chunkInfo );
ShardChunkVersion maxVersion;
+ ShardChunkVersion startingVersion;
string myOldShard;
{
scoped_ptr<ScopedDbConnection> conn(
@@ -981,10 +982,10 @@ namespace mongo {
// it's possible this shard will be *at* zero version from a previous migrate and
// no refresh will be done
// TODO: Make this less fragile
- ShardChunkVersion shardVersion = maxVersion;
- shardingState.trySetVersion( ns , shardVersion /* will return updated */ );
+ startingVersion = maxVersion;
+ shardingState.trySetVersion( ns , startingVersion /* will return updated */ );
- log() << "moveChunk request accepted at version " << shardVersion << migrateLog;
+ log() << "moveChunk request accepted at version " << startingVersion << migrateLog;
}
timing.done(2);
@@ -1099,8 +1100,7 @@ namespace mongo {
// 5.a
// we're under the collection lock here, so no other migrate can change maxVersion or ShardChunkManager state
migrateFromStatus.setInCriticalSection( true );
- ShardChunkVersion currVersion = maxVersion;
- ShardChunkVersion myVersion = currVersion;
+ ShardChunkVersion myVersion = maxVersion;
myVersion.incMajor();
{
@@ -1132,7 +1132,7 @@ namespace mongo {
catch( DBException& e ){
errmsg = str::stream() << "moveChunk could not contact to: shard " << toShard.getConnString() << " to commit transfer" << causedBy( e );
warning() << errmsg << endl;
- return false;
+ ok = false;
}
connTo->done();
@@ -1142,11 +1142,11 @@ namespace mongo {
Lock::DBWrite lk( ns );
// revert the chunk manager back to the state before "forgetting" about the chunk
- shardingState.undoDonateChunk( ns , min , max , currVersion );
+ shardingState.undoDonateChunk( ns , min , max , startingVersion );
}
log() << "moveChunk migrate commit not accepted by TO-shard: " << res
- << " resetting shard version to: " << currVersion << migrateLog;
+ << " resetting shard version to: " << startingVersion << migrateLog;
errmsg = "_recvChunkCommit failed!";
result.append( "cause" , res );