summaryrefslogtreecommitdiff
path: root/s
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-04-06 02:50:20 -0400
committerEliot Horowitz <eliot@10gen.com>2011-04-11 20:26:49 -0400
commit3cf20acae639214fb8a4363d6d3a4ad0fdf5dd68 (patch)
treeefebe30d8b1e1c6064255af655a5af1b3cb6e4cc /s
parent0c54e46abedd712353f43671506ca7ae427b6857 (diff)
downloadmongo-3cf20acae639214fb8a4363d6d3a4ad0fdf5dd68.tar.gz
flushRouterConfig to force a mongos config reload SERVER-2666
Diffstat (limited to 's')
-rw-r--r--s/commands_admin.cpp14
-rw-r--r--s/grid.cpp6
-rw-r--r--s/grid.h2
3 files changed, 22 insertions, 0 deletions
diff --git a/s/commands_admin.cpp b/s/commands_admin.cpp
index 532161a5d2f..1ca983fc13c 100644
--- a/s/commands_admin.cpp
+++ b/s/commands_admin.cpp
@@ -79,6 +79,20 @@ namespace mongo {
}
} netstat;
+ class FlushRouterConfigCmd : public GridAdminCmd {
+ public:
+ FlushRouterConfigCmd() : GridAdminCmd("flushRouterConfig") { }
+ virtual void help( stringstream& help ) const {
+ help << "flush all router config";
+ }
+ bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool) {
+ grid.flushConfig();
+ result.appendBool( "flushed" , true );
+ return true;
+ }
+ } flushRouterConfigCmd;
+
+
class ServerStatusCmd : public Command {
public:
ServerStatusCmd() : Command( "serverStatus" , true ) {
diff --git a/s/grid.cpp b/s/grid.cpp
index 0045754d270..06465075417 100644
--- a/s/grid.cpp
+++ b/s/grid.cpp
@@ -440,8 +440,14 @@ namespace mongo {
return ( dbName == "local" ) || ( dbName == "admin" ) || ( dbName == "config" );
}
+ void Grid::flushConfig() {
+ scoped_lock lk( _lock );
+ _databases.clear();
+ }
+
Grid grid;
+
// unit tests
class BalancingWindowUnitTest : public UnitTest {
diff --git a/s/grid.h b/s/grid.h
index 5692a82dab1..e5af33fcec7 100644
--- a/s/grid.h
+++ b/s/grid.h
@@ -83,6 +83,8 @@ namespace mongo {
bool shouldBalance() const;
unsigned long long getNextOpTime() const;
+
+ void flushConfig();
// exposed methods below are for testing only