mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
rs blind
This commit is contained in:
parent
66caa37da3
commit
f611c9e68d
@ -72,7 +72,7 @@ namespace mongo {
|
||||
s << td( id() );
|
||||
double h = hbinfo().health;
|
||||
bool ok = h > 0;
|
||||
s << td(h);
|
||||
s << td(red(str::stream() << h,h == 0));
|
||||
s << td(ago(hbinfo().upSince));
|
||||
bool never = false;
|
||||
{
|
||||
|
@ -35,12 +35,17 @@ namespace mongo {
|
||||
|
||||
using namespace bson;
|
||||
|
||||
extern bool replSetBlind;
|
||||
|
||||
/* { replSetHeartbeat : <setname> } */
|
||||
class CmdReplSetHeartbeat : public ReplSetCommand {
|
||||
public:
|
||||
virtual bool adminOnly() const { return false; }
|
||||
CmdReplSetHeartbeat() : ReplSetCommand("replSetHeartbeat") { }
|
||||
virtual bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
|
||||
if( replSetBlind )
|
||||
return false;
|
||||
|
||||
/* we don't call ReplSetCommand::check() here because heartbeat
|
||||
checks many things that are pre-initialization. */
|
||||
if( !replSet ) {
|
||||
@ -89,6 +94,11 @@ namespace mongo {
|
||||
|
||||
/* throws dbexception */
|
||||
bool requestHeartbeat(string setName, string memberFullName, BSONObj& result, int myCfgVersion, int& theirCfgVersion, bool checkEmpty) {
|
||||
if( replSetBlind ) {
|
||||
//sleepmillis( rand() );
|
||||
return false;
|
||||
}
|
||||
|
||||
BSONObj cmd = BSON( "replSetHeartbeat" << setName << "v" << myCfgVersion << "pv" << 1 << "checkEmpty" << checkEmpty );
|
||||
|
||||
// we might be talking to ourself - generally not a great idea to do outbound waiting calls in a write lock
|
||||
|
@ -32,6 +32,26 @@ namespace mongo {
|
||||
|
||||
using namespace bson;
|
||||
|
||||
bool replSetBlind = false;
|
||||
|
||||
class CmdReplSetTest : public ReplSetCommand {
|
||||
public:
|
||||
virtual void help( stringstream &help ) const {
|
||||
help << "Just for testing : do not use.\n";
|
||||
}
|
||||
CmdReplSetTest() : ReplSetCommand("replSetTest", true) { }
|
||||
virtual bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) {
|
||||
if( !check(errmsg, result) )
|
||||
return false;
|
||||
if( cmdObj.hasElement("blind") ) {
|
||||
replSetBlind = cmdObj.getBoolField("blind");
|
||||
log() << "replSet WARNING via command setting replSetBlind=" << replSetBlind << rsLog;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} cmdReplSetTest;
|
||||
|
||||
class CmdReplSetGetStatus : public ReplSetCommand {
|
||||
public:
|
||||
virtual void help( stringstream &help ) const {
|
||||
|
Loading…
Reference in New Issue
Block a user