diff options
Diffstat (limited to 'client/distlock_test.cpp')
-rw-r--r-- | client/distlock_test.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/client/distlock_test.cpp b/client/distlock_test.cpp index 42a1c48..5f37e6b 100644 --- a/client/distlock_test.cpp +++ b/client/distlock_test.cpp @@ -195,6 +195,7 @@ namespace mongo { boost::variate_generator<boost::mt19937&, boost::uniform_int<> > randomSkew(gen, boost::uniform_int<>(0, skewRange)); boost::variate_generator<boost::mt19937&, boost::uniform_int<> > randomWait(gen, boost::uniform_int<>(1, threadWait)); boost::variate_generator<boost::mt19937&, boost::uniform_int<> > randomSleep(gen, boost::uniform_int<>(1, threadSleep)); + boost::variate_generator<boost::mt19937&, boost::uniform_int<> > randomNewLock(gen, boost::uniform_int<>(0, 3)); int skew = 0; @@ -262,7 +263,7 @@ namespace mongo { } else { log() << "**** Not unlocking for thread " << threadId << endl; - DistributedLock::killPinger( *myLock ); + assert( DistributedLock::killPinger( *myLock ) ); // We're simulating a crashed process... break; } @@ -274,6 +275,12 @@ namespace mongo { break; } + // Create a new lock 1/3 of the time + if( randomNewLock() > 1 ){ + lock.reset(new DistributedLock( hostConn, lockName, takeoverMS, true )); + myLock = lock.get(); + } + sleepmillis(randomSleep()); } |