0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

always require double-check before forcing locks - sync6 fix

This commit is contained in:
gregs 2011-05-08 12:47:52 -04:00
parent 0e1730a53b
commit 2c49df4752

View File

@ -651,6 +651,9 @@ namespace mongo {
<< lockName << causedBy( e ), 13660);
}
// Lock forced, reset our timer
if(_lockTimeout > 0)
_lastPingCheck = make_tuple(string(""), 0, 0, OID());
}
else {
@ -688,16 +691,18 @@ namespace mongo {
<< lockName << causedBy( e ), 13660);
}
// Lock re-entered, reset our timer
// Not strictly necessary, but helpful for small timeouts where thread scheduling is significant.
// This ensures that a force can only happen after one unsuccessful force or reacquire attempt.
if(_lockTimeout > 0)
_lastPingCheck = make_tuple(string(""), 0, 0, OID());
log( logLvl - 1 ) << "re-entered distributed lock '" << lockName << "'" << endl;
*other = o; other->getOwned(); conn.done();
return true;
}
// Lock forced, reset our timer
if(_lockTimeout > 0)
_lastPingCheck = make_tuple(string(""), 0, 0, OID());
log( logLvl - 1 ) << "lock '" << lockName << "' successfully forced" << endl;
// We don't need the ts value in the query, since we will only ever replace locks with state=0.