summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/clientcursor.cpp2
-rw-r--r--db/dbwebserver.cpp33
-rw-r--r--db/repl.cpp3
-rw-r--r--db/repl/health.cpp1
-rw-r--r--db/repl/replset.cpp6
-rw-r--r--db/repl/replset_commands.cpp7
-rw-r--r--db/repl/rs_config.cpp22
-rw-r--r--util/assert_util.cpp10
-rw-r--r--util/assert_util.h2
9 files changed, 62 insertions, 24 deletions
diff --git a/db/clientcursor.cpp b/db/clientcursor.cpp
index 8d12679001f..d57b04c36f9 100644
--- a/db/clientcursor.cpp
+++ b/db/clientcursor.cpp
@@ -299,7 +299,7 @@ namespace mongo {
} cmdCursorInfo;
void ClientCursorMonitor::run(){
- Client::initThread("snapshotthread");
+ Client::initThread("clientcursormon");
Client& client = cc();
unsigned old = curTimeMillis();
diff --git a/db/dbwebserver.cpp b/db/dbwebserver.cpp
index ac93c3afbcb..825eff65ee1 100644
--- a/db/dbwebserver.cpp
+++ b/db/dbwebserver.cpp
@@ -114,15 +114,17 @@ namespace mongo {
ss << "\n<b>dbtop</b> (occurences|percent of elapsed)\n";
ss << "<table border=1 cellpadding=2 cellspacing=0>";
ss << "<tr align='left'>";
- ss << "<th><a title=\"namespace\">NS</a></th>"
- "<th colspan=2>total</th>"
- "<th colspan=2>Reads</th>"
- "<th colspan=2>Writes</th>"
- "<th colspan=2>Queries</th>"
- "<th colspan=2>GetMores</th>"
- "<th colspan=2>Inserts</th>"
- "<th colspan=2>Updates</th>"
- "<th colspan=2>Removes</th>";
+ ss << "<th><a title=\"namespace\" href=\""
+ "http://www.mongodb.org/display/DOCS/Developer+FAQ#DeveloperFAQ-What%27sa%22namespace%22%3F"
+ "\">NS</a></th>"
+ "<th colspan=2>total</th>"
+ "<th colspan=2>Reads</th>"
+ "<th colspan=2>Writes</th>"
+ "<th colspan=2>Queries</th>"
+ "<th colspan=2>GetMores</th>"
+ "<th colspan=2>Inserts</th>"
+ "<th colspan=2>Updates</th>"
+ "<th colspan=2>Removes</th>";
ss << "</tr>";
display( ss , (double) delta->elapsed() , "GLOBAL" , delta->globalUsageDiff() );
@@ -184,7 +186,9 @@ namespace mongo {
ss << "git hash: " << gitVersion() << '\n';
ss << "sys info: " << sysInfo() << '\n';
ss << '\n';
- ss << "<a title=\"snapshot: was the db in the write lock when this page was generated?\">";
+ ss << "<a "
+ << "href=\"http://www.mongodb.org/pages/viewpage.action?pageId=7209296\""
+ << "title=\"snapshot: was the db in the write lock when this page was generated?\">";
ss << "write locked:</a> " << (dbMutex.info().isLocked() ? "true" : "false") << "\n";
ss << "uptime: " << time(0)-started << " seconds\n";
if ( replAllDead )
@@ -194,7 +198,10 @@ namespace mongo {
ss << "assertions:</a>\n";
for ( int i = 0; i < 4; i++ ) {
if ( lastAssert[i].isSet() ) {
- if ( i == 3 ) ss << "usererr";
+ if ( i == 3 ) ss << "uassert";
+ else if( i == 2 ) ss << "massert";
+ else if( i == 0 ) ss << "assert";
+ else if( i == 1 ) ss << "warnassert";
else ss << i;
ss << ' ' << lastAssert[i].toString();
}
@@ -415,7 +422,9 @@ namespace mongo {
}
}
ss << '\n';
- ss << "rest/admin port:" << _port << "\n";
+ ss << "<a "
+ "title=\"click for documentation on this http interface\""
+ "href=\"http://www.mongodb.org/display/DOCS/Http+Interface\">HTTP</a> admin port:" << _port << "\n";
doUnlockedStuff(ss);
{
diff --git a/db/repl.cpp b/db/repl.cpp
index 9db7e78707d..5b1727ec5c2 100644
--- a/db/repl.cpp
+++ b/db/repl.cpp
@@ -344,7 +344,7 @@ namespace mongo {
return true;
}
virtual LockType locktype(){ return NONE; }
- CmdIsMasterOld(const char * name="ismaster") : Command(name, true) { }
+ CmdIsMasterOld(const char * name="ismaster") : Command(name, name=="isMaster") { }
virtual bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) {
/* currently request to arbiter is (somewhat arbitrarily) an ismaster request that is not
authenticated.
@@ -357,6 +357,7 @@ namespace mongo {
result.append("ismaster", 0);
result.append("ok", false);
result.append("msg", "replSet still trying to initialize");
+ result.append("info", ReplSet::startupStatusMsg);
return true;
}
theReplSet->fillIsMaster(result);
diff --git a/db/repl/health.cpp b/db/repl/health.cpp
index d2fd949f777..d9b81111814 100644
--- a/db/repl/health.cpp
+++ b/db/repl/health.cpp
@@ -37,6 +37,7 @@ namespace mongo {
errmsg = "not a replset member";
return false;
}
+ result.append("rs", true);
if( theReplSet == 0 ) {
errmsg = "still initializing";
return false;
diff --git a/db/repl/replset.cpp b/db/repl/replset.cpp
index 05cfd51568b..358bec05e85 100644
--- a/db/repl/replset.cpp
+++ b/db/repl/replset.cpp
@@ -103,7 +103,7 @@ namespace mongo {
startupStatus = EMPTYCONFIG;
startupStatusMsg = "can't get admin.system.replset config from self or any seed (uninitialized?)";
log() << "replSet can't get admin.system.replset config from self or any seed.\n";
- log() << "replSet have you ran commant replSetInitiate yet?\n";
+ log() << "replSet have you ran replSetInitiate yet?\n";
log() << "replSet sleeping 1 minute and will try again." << endl;
}
else {
@@ -118,8 +118,8 @@ namespace mongo {
}
catch(AssertionException&) {
startupStatus = BADCONFIG;
- startupStatusMsg = "replSet bad config";
- log() << "replSet error loading configurations. admin.system.replset may be misconfigured\n";
+ startupStatusMsg = "replSet error loading set config";
+ log() << "replSet error loading configurations\n";
log() << "replSet replication will not start" << endl;
fatal = true;
throw;
diff --git a/db/repl/replset_commands.cpp b/db/repl/replset_commands.cpp
index 3c35b6852cc..9071d27aed8 100644
--- a/db/repl/replset_commands.cpp
+++ b/db/repl/replset_commands.cpp
@@ -31,7 +31,7 @@ namespace mongo {
CmdReplSetInitiate() : Command("replSetInitiate") { }
virtual bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
if( !replSet ) {
- errmsg = "not running with --replSet";
+ errmsg = "server is not running with --replSet";
return false;
}
if( theReplSet ) {
@@ -39,7 +39,8 @@ namespace mongo {
return false;
}
if( ReplSet::startupStatus == ReplSet::BADCONFIG ) {
- errmsg = "config already exists, but is bad";
+ errmsg = "server already in BADCONFIG state (check logs); not initiating";
+ result.append("info", ReplSet::startupStatusMsg);
return false;
}
if( ReplSet::startupStatus != ReplSet::EMPTYCONFIG ) {
@@ -54,7 +55,7 @@ namespace mongo {
/* commands in other files:
replSetHeartbeat - health.cpp
- */
+ */
class CmdReplSetGetStatus : public Command {
public:
diff --git a/db/repl/rs_config.cpp b/db/repl/rs_config.cpp
index 79e485cf45c..dbe0e619918 100644
--- a/db/repl/rs_config.cpp
+++ b/db/repl/rs_config.cpp
@@ -18,6 +18,7 @@
#include "stdafx.h"
#include "rs_config.h"
+#include "replset.h"
#include "../../client/dbclient.h"
#include "../../util/hostandport.h"
@@ -66,7 +67,8 @@ namespace mongo {
uassert(13122, "bad local.system.replset config", expr);
}
- ReplSetConfig::ReplSetConfig(const HostAndPort& h) : version(-4) {
+ ReplSetConfig::ReplSetConfig(const HostAndPort& h) {
+ version = -5;
int level = 2;
DEV level = 0;
_ok = false;
@@ -78,10 +80,26 @@ namespace mongo {
conn._logLevel = 2;
string err;
conn.connect(h.toString());
+ version = -4;
+
+ {
+ /* first, make sure other node is configured to be a replset. just to be safe. */
+ BSONObj cmd = BSON( "replSetHeartbeat" << "preloadconfig?" );
+ BSONObj info;
+ bool ok = conn.runCommand("admin", cmd, info);
+ cout << h.toString() << " " << ok << " " << info.toString() << endl;
+ if( !info["rs"].trueValue() ) {
+ stringstream ss;
+ ss << "replSet error: member " << h.toString() << " is not in --replSet mode";
+ msgassertedNoTrace(10000, ss.str().c_str()); // not caught as not a user exception - we want it not caught
+ }
+ }
+
version = -3;
+
c = conn.query("local.system.replset");
if( !c->more() ) {
- version = -2;
+ version = -2; /* -2 is a sentinel - see ReplSetConfig::empty() */
return;
}
version = -1;
diff --git a/util/assert_util.cpp b/util/assert_util.cpp
index b4659ccd5e3..bc5e26c1eee 100644
--- a/util/assert_util.cpp
+++ b/util/assert_util.cpp
@@ -92,7 +92,15 @@ namespace mongo {
lastAssert[2].set(msg, getDbContext().c_str(), "", 0);
raiseError(msgid,msg && *msg ? msg : "massert failure");
breakpoint();
- printStackTrace(); // TEMP?? should we get rid of this? TODO
+ printStackTrace();
+ throw MsgAssertionException(msgid, msg);
+ }
+
+ void msgassertedNoTrace(int msgid, const char *msg) {
+ assertionCount.condrollover( ++assertionCount.warning );
+ log() << "Assertion: " << msgid << ":" << msg << endl;
+ lastAssert[2].set(msg, getDbContext().c_str(), "", 0);
+ raiseError(msgid,msg && *msg ? msg : "massert failure");
throw MsgAssertionException(msgid, msg);
}
diff --git a/util/assert_util.h b/util/assert_util.h
index bae3a55cbf1..0ca44a6b02e 100644
--- a/util/assert_util.h
+++ b/util/assert_util.h
@@ -150,6 +150,7 @@ namespace mongo {
void uasserted(int msgid, const char *msg);
inline void uasserted(int msgid , string msg) { uasserted(msgid, msg.c_str()); }
void uassert_nothrow(const char *msg); // reported via lasterror, but don't throw exception
+ void msgassertedNoTrace(int msgid, const char *msg);
void msgasserted(int msgid, const char *msg);
inline void msgasserted(int msgid, string msg) { msgasserted(msgid, msg.c_str()); }
@@ -160,7 +161,6 @@ namespace mongo {
#define assert(_Expression) (void)( (!!(_Expression)) || (mongo::asserted(#_Expression, __FILE__, __LINE__), 0) )
/* "user assert". if asserts, user did something wrong, not our code */
-//#define uassert( 10269 , _Expression) (void)( (!!(_Expression)) || (uasserted(#_Expression, __FILE__, __LINE__), 0) )
#define uassert(msgid, msg,_Expression) (void)( (!!(_Expression)) || (mongo::uasserted(msgid, msg), 0) )
#define xassert(_Expression) (void)( (!!(_Expression)) || (mongo::asserted(#_Expression, __FILE__, __LINE__), 0) )