summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2015-12-22 15:43:41 -0500
committerDavid Storch <david.storch@10gen.com>2015-12-22 17:38:10 -0500
commitcff8decf7ecebb69f82231c994a8b1a52234ba08 (patch)
tree986f37b735c0e5c7c1a93ce4c3d93e0e4a452513 /src
parentebfbeb9a05f13d72bd4e535b4388ed8b3a7a39b5 (diff)
downloadmongo-cff8decf7ecebb69f82231c994a8b1a52234ba08.tar.gz
SERVER-21997 periodically drop locks while keepCursorPinnedDuringGetMore fail point is enabled
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index 177f216231e..6aa0f8c5112 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -58,6 +58,7 @@
#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"
#include "mongo/util/scopeguard.h"
+#include "mongo/util/time_support.h"
namespace mongo {
@@ -220,8 +221,15 @@ public:
str::stream() << "Cursor not found, cursor id: " << request.cursorid));
}
- // If the fail point is enabled, busy wait until it is disabled.
+ // If the fail point is enabled, busy wait until it is disabled. We unlock and re-acquire
+ // the locks periodically in order to avoid deadlock (see SERVER-21997 for details).
while (MONGO_FAIL_POINT(keepCursorPinnedDuringGetMore)) {
+ invariant(ctx);
+ invariant(!unpinDBLock);
+ invariant(!unpinCollLock);
+ sleepFor(Milliseconds(10));
+ ctx.reset();
+ ctx = stdx::make_unique<AutoGetCollectionForRead>(txn, request.nss);
}
if (request.nss.ns() != cursor->ns()) {