diff options
author | Greg Studer <greg@10gen.com> | 2012-03-07 13:26:57 -0500 |
---|---|---|
committer | Andy Schwerin <schwerin@10gen.com> | 2012-04-18 17:21:08 -0400 |
commit | e69445666bd8acfb1fac1e826e610fac845019a7 (patch) | |
tree | a599dfb71bd0e87bf5902422bc9fe4303f5dc0c9 | |
parent | 83fa0f7bc1611e015024b6acac23b14cca44f35e (diff) | |
download | mongo-e69445666bd8acfb1fac1e826e610fac845019a7.tar.gz |
SERVER-2988 give error message when initial version can't be written on mongos startup
-rw-r--r-- | s/config_migrate.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/s/config_migrate.cpp b/s/config_migrate.cpp index fff023cfb5b..7b0c5a68062 100644 --- a/s/config_migrate.cpp +++ b/s/config_migrate.cpp @@ -37,7 +37,18 @@ namespace mongo { if ( cur == 0 ) { ScopedDbConnection conn( _primary ); - conn->insert( "config.version" , BSON( "_id" << 1 << "version" << VERSION ) ); + + // If the cluster has not previously been initialized, we need to set the version before using so + // subsequent mongoses use the config data the same way. This requires all three config servers online + // initially. + try { + conn->insert( "config.version" , BSON( "_id" << 1 << "version" << VERSION ) ); + } + catch( DBException& e ){ + error() << "All config servers must initially be reachable for the cluster to be initialized." << endl; + throw; + } + pool.flush(); assert( VERSION == dbConfigVersion( conn.conn() ) ); conn.done(); |