summaryrefslogtreecommitdiff
path: root/s/config_migrate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 's/config_migrate.cpp')
-rw-r--r--s/config_migrate.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/s/config_migrate.cpp b/s/config_migrate.cpp
index fff023c..7b0c5a6 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();