diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-02-14 16:21:12 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-02-14 16:21:36 -0500 |
commit | 5909aa6962bebe24f7cd65b924053a5cf70b83d3 (patch) | |
tree | 207916b5a6678253d1ee2ce418c2c878688fff27 | |
parent | 4c9f3922d364c3bcb37455fcbd7812f39d1d8204 (diff) | |
download | mongo-5909aa6962bebe24f7cd65b924053a5cf70b83d3.tar.gz |
more verbose lock pinging logicr1.7.6
-rw-r--r-- | client/distlock.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/client/distlock.cpp b/client/distlock.cpp index 0db55c96cb0..f76dbcfae3f 100644 --- a/client/distlock.cpp +++ b/client/distlock.cpp @@ -59,8 +59,10 @@ namespace mongo { return s; } - void distLockPingThread( ConnectionString addr ) { + void _distLockPingThread( ConnectionString addr ) { setThreadName( "LockPinger" ); + + log() << "creating dist lock ping thread for: " << addr << endl; static int loops = 0; while( ! inShutdown() ) { @@ -78,8 +80,8 @@ namespace mongo { true ); string err = conn->getLastError(); if ( ! err.empty() ) { - log( LL_WARNING ) << "dist_lock process: " << process << " pinging: " << addr << " failed: " - << err << endl; + warning() << "dist_lock process: " << process << " pinging: " << addr << " failed: " + << err << endl; conn.done(); sleepsecs(30); continue; @@ -102,8 +104,8 @@ namespace mongo { conn->remove( lockPingNS , BSON( "_id" << BSON( "$nin" << pids ) << "ping" << LT << fourDays ) ); err = conn->getLastError(); if ( ! err.empty() ) { - log ( LL_WARNING ) << "dist_lock cleanup request from process: " << process << " to: " << addr - << " failed: " << err << endl; + warning() << "dist_lock cleanup request from process: " << process << " to: " << addr + << " failed: " << err << endl; conn.done(); sleepsecs(30); continue; @@ -117,14 +119,27 @@ namespace mongo { conn.done(); } catch ( std::exception& e ) { - log( LL_WARNING ) << "dist_lock exception during ping: " << e.what() << endl; + warning() << "dist_lock exception during ping: " << e.what() << endl; } - log(4) << "dist_lock pinged successfully for: " << process << endl; + log( loops % 10 == 0 ? 0 : 1) << "dist_lock pinged successfully for: " << process << endl; sleepsecs(30); } } + void distLockPingThread( ConnectionString addr ) { + try { + _distLockPingThread( addr ); + } + catch ( std::exception& e ) { + error() << "unexpected error in distLockPingThread: " << e.what() << endl; + } + catch ( ... ) { + error() << "unexpected unknown error in distLockPingThread" << endl; + } + } + + class DistributedLockPinger { public: DistributedLockPinger() |