0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

inline and remove _reload_in_lock

This commit is contained in:
Mathias Stearn 2011-05-06 13:57:24 -04:00
parent 7cf37b75c3
commit 6ccfff789a
2 changed files with 12 additions and 17 deletions

View File

@ -492,22 +492,8 @@ namespace mongo {
ChunkManager::ChunkManager( string ns , ShardKeyPattern pattern , bool unique ) :
_ns( ns ) , _key( pattern ) , _unique( unique ) , _lock("rw:ChunkManager"),
_nsLock( ConnectionString( configServer.modelServer() , ConnectionString::SYNC ) , ns ) {
_reload_inlock(); // will set _sequenceNumber
}
ChunkManager::~ChunkManager() {
_chunkMap.clear();
_chunkRanges.clear();
_shards.clear();
}
ChunkManagerPtr ChunkManager::reload(bool force) const {
return grid.getDBConfig(getns())->getChunkManager(getns(), force);
}
void ChunkManager::_reload_inlock() {
_nsLock( ConnectionString( configServer.modelServer() , ConnectionString::SYNC ) , ns )
{
int tries = 3;
while (tries--) {
_chunkMap.clear();
@ -533,8 +519,18 @@ namespace mongo {
sleepmillis(10 * (3-tries));
}
// this will abort construction so we should never have a reference to an invalid config
msgasserted(13282, "Couldn't load a valid config for " + _ns + " after 3 attempts. Please try again.");
}
ChunkManager::~ChunkManager() {
_chunkMap.clear();
_chunkRanges.clear();
_shards.clear();
}
ChunkManagerPtr ChunkManager::reload(bool force) const {
return grid.getDBConfig(getns())->getChunkManager(getns(), force);
}
void ChunkManager::_load() {

View File

@ -335,7 +335,6 @@ namespace mongo {
private:
ChunkManagerPtr reload(bool force=true) const; // doesn't modify self!
void _reload_inlock();
void _load();
void ensureIndex_inlock();