diff options
author | Dwight <dmerriman@gmail.com> | 2008-09-11 16:25:16 -0400 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-09-11 16:25:16 -0400 |
commit | e9370576adf9d8e023988dacb37a6d291b0d14f4 (patch) | |
tree | e505f719e52659ab0436ec6d10d67b7741220493 | |
parent | f56113d7367535eaf7994d7954bdfb5e8fc93dcb (diff) | |
download | mongo-e9370576adf9d8e023988dacb37a6d291b0d14f4.tar.gz |
oplogging off unless a special build
-rw-r--r-- | db/db.cpp | 22 | ||||
-rw-r--r-- | db/repl.cpp | 4 | ||||
-rw-r--r-- | dbgrid/dbgrid.cpp | 29 |
3 files changed, 48 insertions, 7 deletions
diff --git a/db/db.cpp b/db/db.cpp index c2b6b62fd61..1ef144abf73 100644 --- a/db/db.cpp +++ b/db/db.cpp @@ -58,10 +58,17 @@ struct MyStartupTests { */ int opLogging = 0; +// turn on or off the oplog.* files which the db can generate. +// these files are for diagnostic purposes and are unrelated to +// local.oplog.$main used by replication. +// +#define OPLOG if( 0 ) + struct OpLog { ofstream *f; OpLog() : f(0) { } void init() { + OPLOG { stringstream ss; ss << "oplog." << hex << time(0); string name = ss.str(); @@ -70,17 +77,26 @@ struct OpLog { problem() << "couldn't open log stream" << endl; throw 1717; } + } } + void flush() { + OPLOG f->flush(); + } + void write(char *data,int len) { + OPLOG f->write(data,len); + } void readop(char *data, int len) { + OPLOG { bool log = (opLogging & 4) == 0; OCCASIONALLY log = true; if( log ) f->write(data,len); + } } } _oplog; -void flushOpLog() { _oplog.f->flush(); } -#define oplog (*(_oplog.f)) -#define OPWRITE if( opLogging & 1 ) oplog.write((char *) m.data, m.data->len); +void flushOpLog() { _oplog.flush(); } +//#define oplog (*(_oplog.f)) +#define OPWRITE if( opLogging & 1 ) _oplog.write((char *) m.data, m.data->len); #define OPREAD if( opLogging & 2 ) _oplog.readop((char *) m.data, m.data->len); /* example for diff --git a/db/repl.cpp b/db/repl.cpp index dd0b411e659..b5c456afbd6 100644 --- a/db/repl.cpp +++ b/db/repl.cpp @@ -51,7 +51,7 @@ ReplPair *replPair = 0; JSObj ismasterobj = fromjson("{ismaster:1}"); -/* peer unreachable, try our arbitrator */ +/* peer unreachable, try our arbiter */ void ReplPair::arbitrate() { if( arbHost == "-" ) { // no arbiter. we are up, let's assume he is down and network is not partitioned. @@ -72,7 +72,7 @@ void ReplPair::arbitrate() { return; } - setMaster(State_Master, "remote down, arbitrator reached"); + setMaster(State_Master, "remote down, arbiter reached"); } /* --------------------------------------------- */ diff --git a/dbgrid/dbgrid.cpp b/dbgrid/dbgrid.cpp index 03e6fbe80c2..5efaa19c803 100644 --- a/dbgrid/dbgrid.cpp +++ b/dbgrid/dbgrid.cpp @@ -43,15 +43,40 @@ void pipeSigHandler( int signal ) { void setupSignals() {} #endif +void usage() { + cout << "Mongo dbgrid usage:\n"; + cout << " --port <portno>\n"; + cout << endl; +} + +int port = 0; + +void start() { +} + int main(int argc, char* argv[], char *envp[] ) { #if !defined(_WIN32) signal(SIGPIPE, pipeSigHandler); #endif - log() << "dbgrid starting" << endl; + for (int i = 1; i < argc; i++) { + if( argv[i] == 0 ) continue; + string s = argv[i]; + if( s == "--port" ) { + port = atoi(argv[++i]); + } + } - UnitTest::runTests(); + bool ok = port != 0; + + if( !ok ) { + usage(); + return 1; + } + log() << "dbgrid starting" << endl; + UnitTest::runTests(); + start(); dbexit(0); return 0; } |