summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-12-22 13:12:07 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-12-22 13:12:07 +1100
commit4df72e8e20139ddf667e1f0d3b6b7dcf91deb006 (patch)
tree5363805e8b10dfb58cffbcf585e5a210cf75f02b
parent864f3495721b1311b49df19ee241bfca9adf0863 (diff)
downloadmongo-4df72e8e20139ddf667e1f0d3b6b7dcf91deb006.tar.gz
Avoid EBUSY returns to verify and salvage caused by checkpoints. The "fix" involves blocking checkpoints while salvage or verify are in progress.
refs #1404, SERVER-16457
-rw-r--r--src/conn/conn_dhandle.c10
-rw-r--r--src/session/session_api.c6
2 files changed, 13 insertions, 3 deletions
diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c
index 184fac26d7c..6b6b0bfd650 100644
--- a/src/conn/conn_dhandle.c
+++ b/src/conn/conn_dhandle.c
@@ -65,8 +65,10 @@ __conn_dhandle_open_lock(
* If the handle is already open for a special operation,
* give up.
*/
- if (F_ISSET(btree, WT_BTREE_SPECIAL_FLAGS))
+ if (F_ISSET(btree, WT_BTREE_SPECIAL_FLAGS)) {
+ printf("Collided with special flags\n");
return (EBUSY);
+ }
/*
* If the handle is open, get a read lock and recheck.
@@ -109,9 +111,11 @@ __conn_dhandle_open_lock(
/* We have an exclusive lock, we're done. */
F_SET(dhandle, WT_DHANDLE_EXCLUSIVE);
return (0);
- } else if (ret != EBUSY || (is_open && want_exclusive))
+ } else if (ret != EBUSY || (is_open && want_exclusive)) {
+ if (ret == EBUSY)
+ printf("busy, open and exclusive\n");
return (ret);
- else
+ } else
lock_busy = 1;
/* Give other threads a chance to make progress. */
diff --git a/src/session/session_api.c b/src/session/session_api.c
index 8f460dcc29f..2b1f8a5503f 100644
--- a/src/session/session_api.c
+++ b/src/session/session_api.c
@@ -547,9 +547,11 @@ __session_salvage(WT_SESSION *wt_session, const char *uri, const char *config)
session = (WT_SESSION_IMPL *)wt_session;
SESSION_API_CALL(session, salvage, config, cfg);
+ __wt_spin_lock(session, &S2C(session)->checkpoint_lock);
WT_WITH_SCHEMA_LOCK(session,
ret = __wt_schema_worker(session, uri, __wt_salvage,
NULL, cfg, WT_DHANDLE_EXCLUSIVE | WT_BTREE_SALVAGE));
+ __wt_spin_unlock(session, &S2C(session)->checkpoint_lock);
err: API_END_RET_NOTFOUND_MAP(session, ret);
}
@@ -682,9 +684,11 @@ __session_upgrade(WT_SESSION *wt_session, const char *uri, const char *config)
session = (WT_SESSION_IMPL *)wt_session;
SESSION_API_CALL(session, upgrade, config, cfg);
+ __wt_spin_lock(session, &S2C(session)->checkpoint_lock);
WT_WITH_SCHEMA_LOCK(session,
ret = __wt_schema_worker(session, uri, __wt_upgrade,
NULL, cfg, WT_DHANDLE_EXCLUSIVE | WT_BTREE_UPGRADE));
+ __wt_spin_unlock(session, &S2C(session)->checkpoint_lock);
err: API_END_RET_NOTFOUND_MAP(session, ret);
}
@@ -702,9 +706,11 @@ __session_verify(WT_SESSION *wt_session, const char *uri, const char *config)
session = (WT_SESSION_IMPL *)wt_session;
SESSION_API_CALL(session, verify, config, cfg);
+ __wt_spin_lock(session, &S2C(session)->checkpoint_lock);
WT_WITH_SCHEMA_LOCK(session,
ret = __wt_schema_worker(session, uri, __wt_verify,
NULL, cfg, WT_DHANDLE_EXCLUSIVE | WT_BTREE_VERIFY));
+ __wt_spin_unlock(session, &S2C(session)->checkpoint_lock);
err: API_END_RET_NOTFOUND_MAP(session, ret);
}