diff options
author | dwight <dwight@10gen.com> | 2010-07-16 12:51:01 -0400 |
---|---|---|
committer | dwight <dwight@10gen.com> | 2010-07-16 12:51:01 -0400 |
commit | 2212743ad5f23ab5d692476dfde989bd88d3ce3a (patch) | |
tree | c2fd8327a92b2dea27acb7827eb8186e0f8685e6 | |
parent | 08aedb04ca4ca8e50788c14dcd95359e158d3889 (diff) | |
download | mongo-2212743ad5f23ab5d692476dfde989bd88d3ce3a.tar.gz |
rs
-rw-r--r-- | db/pdfile.cpp | 12 | ||||
-rw-r--r-- | db/repl.cpp | 2 | ||||
-rw-r--r-- | db/repl/rs.h | 4 | ||||
-rw-r--r-- | db/repl/rs_sync.cpp | 14 |
4 files changed, 28 insertions, 4 deletions
diff --git a/db/pdfile.cpp b/db/pdfile.cpp index 1b45f4fa16b..d13147c95c3 100644 --- a/db/pdfile.cpp +++ b/db/pdfile.cpp @@ -1611,6 +1611,18 @@ namespace mongo { namespace mongo { + void dropAllDatabasesExceptLocal() { + vector<string> n; + getDatabaseNames(n); + if( n.size() == 0 ) return; + log() << "dropAllDatabasesExceptLocal " << n.size() << endl; + for( vector<string>::iterator i = n.begin(); i != n.end(); i++ ) { + if( *i != "local" ) { + dropDatabase(*i); + } + } + } + void dropDatabase(string db) { log(1) << "dropDatabase " << db << endl; assert( cc().database()->name == db ); diff --git a/db/repl.cpp b/db/repl.cpp index 189708ffddd..d1c5cbd021e 100644 --- a/db/repl.cpp +++ b/db/repl.cpp @@ -53,8 +53,6 @@ namespace mongo { // our config from command line etc. ReplSettings replSettings; - void ensureHaveIdIndex(const char *ns); - /* if 1 sync() is running */ volatile int syncing = 0; static volatile int relinquishSyncingSome = 0; diff --git a/db/repl/rs.h b/db/repl/rs.h index 494331c038b..0f023fbd988 100644 --- a/db/repl/rs.h +++ b/db/repl/rs.h @@ -237,6 +237,10 @@ namespace mongo { friend class Member; friend class Manager; friend class Consensus; + + private: + /* pulling data from primary related - see rs_sync.cpp */ + void syncDoInitialSync(); }; class ReplSet : public ReplSetImpl { diff --git a/db/repl/rs_sync.cpp b/db/repl/rs_sync.cpp index 2102c4a8253..83e2884212f 100644 --- a/db/repl/rs_sync.cpp +++ b/db/repl/rs_sync.cpp @@ -19,8 +19,18 @@ #include "../../client/dbclient.h" #include "rs.h" -namespace mongo { +namespace mongo { - using namespace bson; + void dropAllDatabasesExceptLocal(); + + void ReplSetImpl::syncDoInitialSync() { + log() << "replSet syncDoInitialSync" << rsLog; + dropAllDatabasesExceptLocal(); + + } + + void syncThread() { + Client::initThread("rs_sync"); + } } |