summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbcommands_generic.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2012-11-27 17:17:42 -0500
committerEliot Horowitz <eliot@10gen.com>2012-11-27 17:17:42 -0500
commit70c89035a57f2efffd240d93f938b46c001d610e (patch)
tree2ca72f0fc9b003667c559224ef4945256c486a39 /src/mongo/db/dbcommands_generic.cpp
parent8d75e030e0e3de931e08996a2157491ed77fef9d (diff)
downloadmongo-70c89035a57f2efffd240d93f938b46c001d610e.tar.gz
SERVER-7778 : new parameter management system for runtime (command line later)
Diffstat (limited to 'src/mongo/db/dbcommands_generic.cpp')
-rw-r--r--src/mongo/db/dbcommands_generic.cpp158
1 files changed, 0 insertions, 158 deletions
diff --git a/src/mongo/db/dbcommands_generic.cpp b/src/mongo/db/dbcommands_generic.cpp
index f0e762c053c..123fe1e314a 100644
--- a/src/mongo/db/dbcommands_generic.cpp
+++ b/src/mongo/db/dbcommands_generic.cpp
@@ -135,164 +135,6 @@ namespace mongo {
}
} cmdBuildInfo;
- /** experimental. either remove or add support in repl sets also. in a repl set, getting this setting from the
- repl set config could make sense.
- */
- unsigned replApplyBatchSize = 1;
-
- const char* fetchReplIndexPrefetchParam();
-
- class CmdGet : public Command {
- public:
- CmdGet() : Command( "getParameter" ) { }
- virtual bool slaveOk() const { return true; }
- virtual bool adminOnly() const { return true; }
- virtual LockType locktype() const { return NONE; }
- virtual void addRequiredPrivileges(const std::string& dbname,
- const BSONObj& cmdObj,
- std::vector<Privilege>* out) {
- ActionSet actions;
- actions.addAction(ActionType::getParameter);
- out->push_back(Privilege(AuthorizationManager::SERVER_RESOURCE_NAME, actions));
- }
- virtual void help( stringstream &help ) const {
- help << "get administrative option(s)\nexample:\n";
- help << "{ getParameter:1, notablescan:1 }\n";
- help << "supported so far:\n";
- help << " quiet\n";
- help << " notablescan\n";
- help << " logLevel\n";
- help << " syncdelay\n";
- help << "{ getParameter:'*' } to get everything\n";
- }
- bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
- bool all = *cmdObj.firstElement().valuestrsafe() == '*';
-
- int before = result.len();
-
- if( all || cmdObj.hasElement("quiet") ) {
- result.append("quiet", cmdLine.quiet );
- }
- if( all || cmdObj.hasElement("notablescan") ) {
- result.append("notablescan", cmdLine.noTableScan);
- }
- if( all || cmdObj.hasElement("logLevel") ) {
- result.append("logLevel", logLevel);
- }
- if( all || cmdObj.hasElement("syncdelay") ) {
- result.append("syncdelay", cmdLine.syncdelay);
- }
- if( all || cmdObj.hasElement("replApplyBatchSize") ) {
- result.append("replApplyBatchSize", replApplyBatchSize);
- }
- if (all || cmdObj.hasElement("replIndexPrefetch")) {
- result.append("replIndexPrefetch", fetchReplIndexPrefetchParam());
- }
- if ( before == result.len() ) {
- errmsg = "no option found to get";
- return false;
- }
- return true;
- }
- } cmdGet;
-
- // tempish
- bool setParmsMongodSpecific(const string& dbname, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl );
-
- class CmdSet : public Command {
- public:
- CmdSet() : Command( "setParameter" ) { }
- virtual bool slaveOk() const { return true; }
- virtual bool adminOnly() const { return true; }
- virtual LockType locktype() const { return NONE; }
- virtual void addRequiredPrivileges(const std::string& dbname,
- const BSONObj& cmdObj,
- std::vector<Privilege>* out) {
- ActionSet actions;
- actions.addAction(ActionType::setParameter);
- out->push_back(Privilege(AuthorizationManager::SERVER_RESOURCE_NAME, actions));
- }
- virtual void help( stringstream &help ) const {
- help << "set administrative option(s)\n";
- help << "{ setParameter:1, <param>:<value> }\n";
- help << "supported so far:\n";
- help << " journalCommitInterval\n";
- help << " logLevel\n";
- help << " notablescan\n";
- help << " quiet\n";
- help << " syncdelay\n";
- }
- bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
- int s = 0;
- bool found = setParmsMongodSpecific(dbname, cmdObj, errmsg, result, fromRepl);
- if( cmdObj.hasElement("journalCommitInterval") ) {
- if( !cmdLine.dur ) {
- errmsg = "journaling is off";
- return false;
- }
- int x = (int) cmdObj["journalCommitInterval"].Number();
- verify( x > 1 && x < 500 );
- cmdLine.journalCommitInterval = x;
- log() << "setParameter journalCommitInterval=" << x << endl;
- s++;
- }
- if( cmdObj.hasElement("notablescan") ) {
- verify( !cmdLine.isMongos() );
- if( s == 0 )
- result.append("was", cmdLine.noTableScan);
- cmdLine.noTableScan = cmdObj["notablescan"].Bool();
- s++;
- }
- if( cmdObj.hasElement("quiet") ) {
- if( s == 0 )
- result.append("was", cmdLine.quiet );
- cmdLine.quiet = cmdObj["quiet"].Bool();
- s++;
- }
- if( cmdObj.hasElement("syncdelay") ) {
- verify( !cmdLine.isMongos() );
- if( s == 0 )
- result.append("was", cmdLine.syncdelay );
- cmdLine.syncdelay = cmdObj["syncdelay"].Number();
- s++;
- }
- if( cmdObj.hasElement( "logLevel" ) ) {
- if( s == 0 )
- result.append("was", logLevel );
- logLevel = cmdObj["logLevel"].numberInt();
- s++;
- }
- if( cmdObj.hasElement( "replApplyBatchSize" ) ) {
- if( s == 0 )
- result.append("was", replApplyBatchSize );
- BSONElement e = cmdObj["replApplyBatchSize"];
- ParameterValidator * v = ParameterValidator::get( e.fieldName() );
- verify( v );
- if ( ! v->isValid( e , errmsg ) )
- return false;
- replApplyBatchSize = e.numberInt();
- s++;
- }
- if( cmdObj.hasElement( "traceExceptions" ) ) {
- if( s == 0 ) result.append( "was", DBException::traceExceptions );
- DBException::traceExceptions = cmdObj["traceExceptions"].Bool();
- s++;
- }
- if( cmdObj.hasElement( "replMonitorMaxFailedChecks" ) ) {
- if( s == 0 ) result.append( "was", ReplicaSetMonitor::getMaxFailedChecks() );
- ReplicaSetMonitor::setMaxFailedChecks(
- cmdObj["replMonitorMaxFailedChecks"].numberInt() );
- s++;
- }
-
- if( s == 0 && !found ) {
- errmsg = "no option found to set, use help:true to see options ";
- return false;
- }
-
- return true;
- }
- } cmdSet;
class PingCommand : public Command {
public: