summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Studer <greg@10gen.com>2012-01-05 11:08:52 -0500
committerEric Milkie <milkie@10gen.com>2012-05-09 16:53:00 -0400
commitdd21525b0210951619935e0c8964158c12cfe70f (patch)
tree1596fa5f9aab0f184b0bf1782680f0d65e346ce4
parent77db8a50cfd1825a5848f908bf2860c5495ba528 (diff)
downloadmongo-dd21525b0210951619935e0c8964158c12cfe70f.tar.gz
SERVER-4603 handle last shard migration more correctly
Signed-off-by: Eric Milkie <milkie@10gen.com>
-rw-r--r--s/d_state.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/s/d_state.cpp b/s/d_state.cpp
index 638d8c19953..ef933a07580 100644
--- a/s/d_state.cpp
+++ b/s/d_state.cpp
@@ -614,6 +614,15 @@ namespace mongo {
}
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
result.append( "ns" , ns );
result.appendBool( "need_authoritative" , true );