summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2012-10-25 14:22:13 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2012-10-25 14:22:13 +1100
commit1579fcf1b14b835e2607953363c61b9a5c31890f (patch)
tree692e49ddd3b05ce5bfa8f0410cc6c4fa5a4ac8a8
parentcaa48be8d8031938297ce53604b6c9c6a0f2eff0 (diff)
downloadmongo-1579fcf1b14b835e2607953363c61b9a5c31890f.tar.gz
Don't attempt to drop the first chunk of an LSM tree before creating it. It can't have come from an interrupted merge, and doing a drop in the middle of a create leaves the file handle locked.
-rw-r--r--src/lsm/lsm_tree.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c
index 86fb8bf8fc3..34d0df2ef23 100644
--- a/src/lsm/lsm_tree.c
+++ b/src/lsm/lsm_tree.c
@@ -173,10 +173,16 @@ __wt_lsm_tree_setup_chunk(WT_SESSION_IMPL *session,
WT_RET(__wt_scr_alloc(session, 0, &buf));
WT_ERR(__wt_lsm_tree_chunk_name(session, lsm_tree, i, buf));
/*
- * Drop the chunk first - there may be some content hanging over
- * from an aborted merge.
+ * Drop the chunk first - there may be some content hanging over from
+ * an aborted merge.
+ *
+ * Don't do this for the very first chunk: we are called during
+ * WT_SESSION::create, and doing a drop inside there does interesting
+ * things with handle locks and metadata tracking. It can never have
+ * been the result of an interrupted merge, anyway.
*/
- WT_ERR(__wt_schema_drop(session, buf->data, cfg));
+ if (i > 1)
+ WT_ERR(__wt_schema_drop(session, buf->data, cfg));
WT_ERR(__wt_schema_create(session, buf->data, lsm_tree->file_config));
chunk->uri = __wt_buf_steal(session, buf, NULL);
if (create_bloom) {