Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SERVER-2988 give error message when initial version can't be written …

…on mongos startup
  • Loading branch information...
commit e69445666bd8acfb1fac1e826e610fac845019a7 1 parent 83fa0f7
Greg Studer authored andy10gen committed
Showing with 12 additions and 1 deletion.
  1. +12 −1 s/config_migrate.cpp
View
13 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();
Please sign in to comment.
Something went wrong with that request. Please try again.