diff options
author | Greg Studer <greg@10gen.com> | 2011-12-08 16:48:08 -0500 |
---|---|---|
committer | Greg Studer <greg@10gen.com> | 2011-12-12 11:12:57 -0500 |
commit | 9d9b2cf71ae14f0813c1c587dfb8c21046d45234 (patch) | |
tree | 1d5b1e1379c3eee2798e98aaf76554c71752b2ae /s | |
parent | 345331fb277ba65fa145124577dfdae3b3ed00ae (diff) | |
download | mongo-9d9b2cf71ae14f0813c1c587dfb8c21046d45234.tar.gz |
SERVER-4388 update version of newly sharded collection on mongod primary after first sharding
Diffstat (limited to 's')
-rw-r--r-- | s/config.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/s/config.cpp b/s/config.cpp index 22516eb46a4..c0860363a0e 100644 --- a/s/config.cpp +++ b/s/config.cpp @@ -150,7 +150,30 @@ namespace mongo { _save(); } - return getChunkManager(ns,true,true); + ChunkManagerPtr manager = getChunkManager(ns,true,true); + + // Tell the primary mongod to refresh it's data + // TODO: Think the real fix here is for mongos to just assume all collections sharded, when we get there + for( int i = 0; i < 4; i++ ){ + if( i == 3 ){ + warning() << "too many tries updating initial version of " << ns << " on shard primary " << getPrimary() << + ", other mongoses may not see the collection as sharded immediately" << endl; + break; + } + try { + ShardConnection conn( getPrimary(), ns ); + conn.setVersion(); + conn.done(); + break; + } + catch( DBException& e ){ + warning() << "could not update initial version of " << ns << " on shard primary " << getPrimary() << + causedBy( e ) << endl; + } + sleepsecs( i ); + } + + return manager; } bool DBConfig::removeSharding( const string& ns ) { |