Tokutek/mongo — pull request #418 by leifwalsh (2013-08-07 23:54:19+00:00)
Title: added catch for errors thrown by findOne in lock_try #413

In DistributedLock, we need to catch retryable errors (lock not granted,
etc.) and actually retry, rather than letting the exception terminate
the process. findOne can throw an exception that doesn't look
retryable, because it wraps every query error in its own exception with
a fixed code, and adds the returned error BSON as a string in the
explanation (see DBClientCursor::nextSafe). Since we use findOne in
lock_try, we need to pick apart this particular exception and look at
the string we got to decode the actual error and see if we should just
retry.

closes #413