summaryrefslogtreecommitdiff
path: root/src/schema/schema_truncate.c
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2013-12-05 17:12:44 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2013-12-05 17:12:44 +1100
commitb129989b69ffb555b8fe947c94b1d7d8098595f3 (patch)
tree35f2d1f529dabc447d20ecb4d26fec73b47d4f93 /src/schema/schema_truncate.c
parentc68c2fc21fa5d5ba6ce4f7590d8379ab8d5e22ba (diff)
downloadmongo-b129989b69ffb555b8fe947c94b1d7d8098595f3.tar.gz
In truncate, release the btree handle before calling __wt_conn_dhandle_close_all.
Diffstat (limited to 'src/schema/schema_truncate.c')
-rw-r--r--src/schema/schema_truncate.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/schema/schema_truncate.c b/src/schema/schema_truncate.c
index ff5920fdcee..16d03b51617 100644
--- a/src/schema/schema_truncate.c
+++ b/src/schema/schema_truncate.c
@@ -21,9 +21,15 @@ __truncate_file(WT_SESSION_IMPL *session, const char *name)
if (!WT_PREFIX_SKIP(filename, "file:"))
return (EINVAL);
+ /* Open and lock the file. */
+ WT_RET(__wt_session_get_btree(
+ session, name, NULL, NULL, WT_DHANDLE_EXCLUSIVE));
+
/* Get the allocation size. */
allocsize = S2BT(session)->allocsize;
+ WT_RET(__wt_session_release_btree(session));
+
/* Close any btree handles in the file. */
WT_RET(__wt_conn_dhandle_close_all(session, name));
@@ -101,8 +107,6 @@ __wt_schema_truncate(
tablename = uri;
if (WT_PREFIX_MATCH(uri, "file:")) {
- WT_RET(__wt_session_get_btree(
- session, uri, NULL, NULL, WT_DHANDLE_EXCLUSIVE));
ret = __truncate_file(session, uri);
} else if (WT_PREFIX_MATCH(uri, "lsm:"))
ret = __wt_lsm_tree_truncate(session, uri, cfg);