From f0d69affe8ce262be9a5a3dff06f01c6fc4e04cd Mon Sep 17 00:00:00 2001 From: Alberto Lerner Date: Fri, 29 Oct 2010 18:23:44 -0400 Subject: [PATCH] move asserts into active code path --- s/chunk.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/s/chunk.cpp b/s/chunk.cpp index 9cb38aed68f..b4113fd7a57 100644 --- a/s/chunk.cpp +++ b/s/chunk.cpp @@ -288,8 +288,13 @@ namespace mongo { } ChunkPtr Chunk::multiSplit( const vector& m ) { - // TODO use current multiSplit asserts here + const size_t maxSplitPoints = 256; + uassert( 10165 , "can't split as shard doesn't have a manager" , _manager ); + uassert( 13332 , "need a split key to split chunk" , !m.empty() ); + uassert( 13333 , "can't split a chunk in that many parts", m.size() < maxSplitPoints ); + uassert( 13003 , "can't split a chunk with only one distinct value" , _min.woCompare(_max) ); + ScopedDbConnection conn( getShard().getConnString() ); BSONObj result; BSONObjBuilder cmd; @@ -333,12 +338,12 @@ namespace mongo { dist_lock_try dlk( &_manager->_nsLock , string("split-") + toString() ); uassert( 10166 , "locking namespace failed" , dlk.got() ); - const size_t maxSplitPoints = 256; + // const size_t maxSplitPoints = 256; - uassert( 10165 , "can't split as shard doesn't have a manager" , _manager ); - uassert( 13332 , "need a split key to split chunk" , !m.empty() ); - uassert( 13333 , "can't split a chunk in that many parts", m.size() < maxSplitPoints ); - uassert( 13003 , "can't split a chunk with only one distinct value" , _min.woCompare(_max) ); + // uassert( 99910165 , "can't split as shard doesn't have a manager" , _manager ); + // uassert( 99913332 , "need a split key to split chunk" , !m.empty() ); + // uassert( 99913333 , "can't split a chunk in that many parts", m.size() < maxSplitPoints ); + // uassert( 99913003 , "can't split a chunk with only one distinct value" , _min.woCompare(_max) ); { ShardChunkVersion onServer = getVersionOnConfigServer();