diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-02-16 15:51:25 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-02-16 15:51:25 -0500 |
commit | a4153eb6edcf3975afed2f33f7595fee2dd6a71b (patch) | |
tree | 0703319bcd561bcb96112e9db9d1ce7a29e64903 /s/balance.cpp | |
parent | e690bfef3ca96c156db17e9be6580daa8118e9a9 (diff) | |
download | mongo-a4153eb6edcf3975afed2f33f7595fee2dd6a71b.tar.gz |
If migrate fails due to oversized chunk, try to split that chunk SERVER-2519
Diffstat (limited to 's/balance.cpp')
-rw-r--r-- | s/balance.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/s/balance.cpp b/s/balance.cpp index d0199b398b8..be6f0ce1b09 100644 --- a/s/balance.cpp +++ b/s/balance.cpp @@ -76,6 +76,21 @@ namespace mongo { // the move requires acquiring the collection metadata's lock, which can fail log() << "balacer move failed: " << res << " from: " << chunkInfo.from << " to: " << chunkInfo.to << " chunk: " << chunkToMove << endl; + + if ( res["chunkTooBig"].trueValue() ) { + // reload just to be safe + cm = cfg->getChunkManager( chunkInfo.ns ); + assert( cm ); + c = cm->findChunk( chunkToMove["min"].Obj() ); + + log() << "forcing a split because migrate failed for size reasons" << endl; + + res = BSONObj(); + c->singleSplit( true , res ); + log() << "forced split results: " << res << endl; + + // TODO: if the split fails, mark as jumbo SERVER-2571 + } } return movedCount; |