Skip to content

Commit

Permalink
SERVER-4603 handle last shard migration more correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Milkie <milkie@10gen.com>
  • Loading branch information
Greg Studer authored and milkie committed May 9, 2012
1 parent 77db8a5 commit dd21525
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions s/d_state.cpp
Expand Up @@ -614,6 +614,15 @@ namespace mongo {
} }


if ( globalVersion == 0 && ! authoritative ) { if ( globalVersion == 0 && ! authoritative ) {
// Needed b/c when the last chunk is moved off a shard, the version gets reset to zero, which
// should require a reload.
// TODO: Maybe a more elegant way of doing this
while ( shardingState.inCriticalMigrateSection() ) {
dbtemprelease r;
sleepmillis(2);
OCCASIONALLY log() << "waiting till out of critical section for version reset" << endl;
}

// need authoritative for first look // need authoritative for first look
result.append( "ns" , ns ); result.append( "ns" , ns );
result.appendBool( "need_authoritative" , true ); result.appendBool( "need_authoritative" , true );
Expand Down

0 comments on commit dd21525

Please sign in to comment.