summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2015-05-25 17:17:58 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-05-25 17:17:58 +1000
commit46b8a931f881f26a0505ed4ec0d904684217c944 (patch)
tree13e5c0059600bc41e2bc5d761e8af88c8802c716
parent174969ffd306bc00eff8e36f9a14683360caf84b (diff)
downloadmongo-46b8a931f881f26a0505ed4ec0d904684217c944.tar.gz
Fix for force drop racing with handle opens in test/fops. (In WiredTiger 2.6.0, this was fixed as part of a much larger change to handle locking that is not feasible to backport).
-rw-r--r--src/session/session_dhandle.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/session/session_dhandle.c b/src/session/session_dhandle.c
index ce5f95a40d0..57ab7246314 100644
--- a/src/session/session_dhandle.c
+++ b/src/session/session_dhandle.c
@@ -402,10 +402,24 @@ __wt_session_get_btree(WT_SESSION_IMPL *session,
* We need the schema lock for this call so that if we lock a handle in
* order to open it, that doesn't race with a schema-changing operation
* such as drop.
+ *
+ * Recheck whether the handle is dead after grabbing the locks. If so,
+ * discard the handle and retry.
*/
- WT_WITH_SCHEMA_LOCK(session,
+retry: WT_WITH_SCHEMA_LOCK(session,
WT_WITH_DHANDLE_LOCK(session, ret =
+ (dhandle != NULL && F_ISSET(dhandle, WT_DHANDLE_DEAD)) ?
+ WT_NOTFOUND :
__wt_conn_btree_get(session, uri, checkpoint, cfg, flags)));
+
+ if (ret == WT_NOTFOUND) {
+ if (dhandle_cache != NULL)
+ __session_discard_btree(session, dhandle_cache);
+ dhandle_cache = NULL;
+ session->dhandle = dhandle = NULL;
+ LF_CLR(WT_DHANDLE_HAVE_REF);
+ goto retry;
+ }
WT_RET(ret);
if (!LF_ISSET(WT_DHANDLE_HAVE_REF))