allow changing notablescan at runtime via {set:} command

This commit is contained in:
Dwight
2010-10-15 17:00:34 -04:00
parent ad421070f5
commit 01a6722a25
5 changed files with 54 additions and 9 deletions

View File

@@ -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;
}