diff options
author | Mathias Stearn <mathias@10gen.com> | 2011-05-12 15:58:18 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2011-05-12 15:58:18 -0400 |
commit | d251ae6b3f68756baa8e7fc577c0db747979475d (patch) | |
tree | 385c7784413132bb2c3367083d1a26dba7bdae89 | |
parent | f7e1c875ca86f0b695433d7b39a59d19bb148b7e (diff) | |
download | mongo-d251ae6b3f68756baa8e7fc577c0db747979475d.tar.gz |
Don't reload ChunkManager in-place
-rw-r--r-- | s/chunk.cpp | 19 | ||||
-rw-r--r-- | s/chunk.h | 2 |
2 files changed, 7 insertions, 14 deletions
diff --git a/s/chunk.cpp b/s/chunk.cpp index 34a53821f95..1e473e2bfce 100644 --- a/s/chunk.cpp +++ b/s/chunk.cpp @@ -272,7 +272,7 @@ namespace mongo { // reloading won't stricly solve all problems, e.g. the collection's metdata lock can be taken // but we issue here so that mongos may refresh wihtout needing to be written/read against - _manager->_reload(); + grid.getDBConfig(_manager->getns())->getChunkManager(_manager->getns(), true); return false; } @@ -314,7 +314,7 @@ namespace mongo { // if succeeded, needs to reload to pick up the new location // if failed, mongos may be stale // reload is excessive here as the failure could be simply because collection metadata is taken - _manager->_reload(); + grid.getDBConfig(_manager->getns())->getChunkManager(_manager->getns(), true); return worked; } @@ -676,7 +676,7 @@ namespace mongo { log() << "successfully created first chunk for " << c->toString() << endl; } - ChunkPtr ChunkManager::findChunk( const BSONObj & obj , bool retry ) { + ChunkPtr ChunkManager::findChunk( const BSONObj & obj) { BSONObj key = _key.extractKey(obj); { @@ -700,20 +700,13 @@ namespace mongo { PRINT(*c); PRINT(key); - _reload_inlock(); + grid.getDBConfig(getns())->getChunkManager(getns(), true); massert(13141, "Chunk map pointed to incorrect chunk", false); } } - if ( retry ) { - stringstream ss; - ss << "couldn't find a chunk aftry retry which should be impossible extracted: " << key; - throw UserException( 8070 , ss.str() ); - } - - log() << "ChunkManager: couldn't find chunk for: " << key << " going to retry" << endl; - _reload(); - return findChunk( obj , true ); + massert(8070, str::stream() << "couldn't find a chunk aftry retry which should be impossible extracted: " << key, false); + return ChunkPtr(); // unreachable } ChunkPtr ChunkManager::findChunkOnServer( const Shard& shard ) const { diff --git a/s/chunk.h b/s/chunk.h index 03996823a2f..21e1fbfae2f 100644 --- a/s/chunk.h +++ b/s/chunk.h @@ -308,7 +308,7 @@ namespace mongo { bool hasShardKey( const BSONObj& obj ); void createFirstChunk( const Shard& shard ); - ChunkPtr findChunk( const BSONObj& obj , bool retry = false ); + ChunkPtr findChunk( const BSONObj& obj ); ChunkPtr findChunkOnServer( const Shard& shard ) const; const ShardKeyPattern& getShardKey() const { return _key; } |