From f0234a1fbb1d024a6e05615791aa0fa47c0f8ca7 Mon Sep 17 00:00:00 2001 From: dwight Date: Fri, 27 Aug 2010 16:38:56 -0400 Subject: [PATCH] rs checkpoint work --- db/client.cpp | 7 ++++--- db/client.h | 5 ++--- db/repl/heartbeat.cpp | 8 ++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/db/client.cpp b/db/client.cpp index c7198a3ad7b..bb3752be7d0 100644 --- a/db/client.cpp +++ b/db/client.cpp @@ -45,7 +45,8 @@ namespace mongo { _shutdown(false), _desc(desc), _god(0), - _lastOp(0), _mp(p) + _lastOp(0), + _mp(p) { _curOp = new CurOp( this ); scoped_lock bl(clientsMutex); @@ -56,7 +57,7 @@ namespace mongo { _god = 0; if ( _context ) - error() << "Client::~Client _context should be NULL: " << _desc << endl; + error() << "Client::~Client _context should be null but is not; client:" << _desc << endl; if ( ! _shutdown ) { error() << "Client::shutdown not called: " << _desc << endl; @@ -82,7 +83,7 @@ namespace mongo { dropCollection( ns , err , b ); } catch ( ... ){ - warning() << "couldn't dropping temp collection: " << ns << endl; + warning() << "error dropping temp collection: " << ns << endl; } } diff --git a/db/client.h b/db/client.h index 3f8d94beba7..d0600e3e5af 100644 --- a/db/client.h +++ b/db/client.h @@ -53,7 +53,6 @@ namespace mongo { static mongo::mutex clientsMutex; static set clients; // always be in clientsMutex when manipulating this - static int recommendedYieldMicros( int * writers = 0 , int * readers = 0 ); /* set _god=true temporarily, safely */ @@ -155,7 +154,7 @@ namespace mongo { } friend class CurOp; - }; + }; // class Client::Context private: void _dropns( const string& ns ); @@ -172,7 +171,7 @@ namespace mongo { BSONObj _remoteId; public: - MessagingPort const *_mp; + MessagingPort * const _mp; string clientAddress() const; AuthenticationInfo * getAuthenticationInfo(){ return &_ai; } diff --git a/db/repl/heartbeat.cpp b/db/repl/heartbeat.cpp index e18be000a0c..4f288972fd8 100644 --- a/db/repl/heartbeat.cpp +++ b/db/repl/heartbeat.cpp @@ -62,6 +62,14 @@ namespace mongo { errmsg = "not running with --replSet"; return false; } + + /* we want to keep heartbeat connections open when relinquishing primary. tag them here. */ + { + MessagingPort *mp = cc()._mp; + if( mp ) + mp->tag |= 1; + } + if( cmdObj["pv"].Int() != 1 ) { errmsg = "incompatible replset protocol version"; return false;