summaryrefslogtreecommitdiff
path: root/db/dbcommands_generic.cpp
diff options
context:
space:
mode:
authorDwight <dwight@10gen.com>2010-10-15 17:00:34 -0400
committerDwight <dwight@10gen.com>2010-10-15 17:00:34 -0400
commit01a6722a25216005fbe5f1977a1a6b00a7ff596f (patch)
tree19e1e4af53a8f72c3fc869cfe594a1df9fa52a4b /db/dbcommands_generic.cpp
parentad421070f584bb82f3aa1d13339649627b12643b (diff)
downloadmongo-01a6722a25216005fbe5f1977a1a6b00a7ff596f.tar.gz
allow changing notablescan at runtime via {set:} command
Diffstat (limited to 'db/dbcommands_generic.cpp')
-rw-r--r--db/dbcommands_generic.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/db/dbcommands_generic.cpp b/db/dbcommands_generic.cpp
index 1818cd87fa4..672f414e249 100644
--- a/db/dbcommands_generic.cpp
+++ b/db/dbcommands_generic.cpp
@@ -66,6 +66,54 @@ namespace mongo {
}
} cmdBuildInfo;
+ class CmdGet : public Command {
+ public:
+ CmdGet() : Command( "get" ) { }
+ virtual bool slaveOk() const { return true; }
+ virtual bool adminOnly() const { return true; }
+ virtual LockType locktype() const { return NONE; }
+ virtual void help( stringstream &help ) const {
+ help << "get administrative option(s)\nexample:\n";
+ help << "{ get:1, notablescan:1 }\n";
+ help << "supported so far:\n";
+ help << " notablescan\n";
+ }
+ bool run(const string& dbname, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl ){
+ if( cmdObj.hasElement("notablescan") ) {
+ result.append("notablescan", cmdLine.noTableScan);
+ }
+ else {
+ errmsg = "no option found to get";
+ return false;
+ }
+ return true;
+ }
+ } cmdGet;
+
+ class CmdSet : public Command {
+ public:
+ CmdSet() : Command( "set" ) { }
+ virtual bool slaveOk() const { return true; }
+ virtual bool adminOnly() const { return true; }
+ virtual LockType locktype() const { return NONE; }
+ virtual void help( stringstream &help ) const {
+ help << "set administrative option(s)\nexample:\n";
+ help << "{ set:1, notablescan:true }\n";
+ help << "supported so far:\n";
+ help << " notablescan\n";
+ }
+ bool run(const string& dbname, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl ){
+ if( cmdObj.hasElement("notablescan") ) {
+ result.append("was", cmdLine.noTableScan);
+ cmdLine.noTableScan = cmdObj["notablescan"].Bool();
+ }
+ else {
+ errmsg = "no option found to set";
+ return false;
+ }
+ return true;
+ }
+ } cmdSet;
/* just to check if the db has asserted */
class CmdAssertInfo : public Command {
@@ -223,6 +271,4 @@ namespace mongo {
}
} cmdForceError;
-
-
}