summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2012-09-24 14:46:50 +1000
committerAlex Gorrod <alexg@wiredtiger.com>2012-09-24 14:46:50 +1000
commit1fd6e4181844a3d128e8f409555dfca0221d6d6c (patch)
tree971801d22d414bc46b7ae21613cbd426b6c2f729
parent7406dea5062fc685a0fc9391237d00828553428b (diff)
downloadmongo-1fd6e4181844a3d128e8f409555dfca0221d6d6c.tar.gz
Two fixes for LSM, one to ensure that cursors read from a checkpoint
if one is available. The other to reduce the number of empty chunks that can be created initially.
-rw-r--r--src/lsm/lsm_cursor.c3
-rw-r--r--src/lsm/lsm_tree.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c
index f619af0ef86..dfabacf3e7f 100644
--- a/src/lsm/lsm_cursor.c
+++ b/src/lsm/lsm_cursor.c
@@ -113,7 +113,8 @@ __clsm_open_cursors(WT_CURSOR_LSM *clsm)
WT_LSM_CHUNK *chunk;
WT_LSM_TREE *lsm_tree;
WT_SESSION_IMPL *session;
- const char *ckpt_cfg[] = { "checkpoint=WiredTigerCheckpoint", NULL };
+ const char *ckpt_cfg[] = API_CONF_DEFAULTS(session, open_cursor,
+ "checkpoint=WiredTigerCheckpoint");
int i, nchunks;
session = (WT_SESSION_IMPL *)clsm->iface.session;
diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c
index 45e60621dd4..49ccdd07c4f 100644
--- a/src/lsm/lsm_tree.c
+++ b/src/lsm/lsm_tree.c
@@ -232,7 +232,7 @@ __wt_lsm_tree_create(WT_SESSION_IMPL *session,
lsm_tree->file_config = __wt_buf_steal(session, buf, NULL);
/* Create the first chunk and flush the metadata. */
- WT_ERR(__wt_lsm_tree_switch(session, lsm_tree));
+ WT_ERR(__wt_lsm_meta_write(session, lsm_tree));
/* Discard our partially populated handle. */
__lsm_tree_discard(session, lsm_tree);
@@ -273,6 +273,9 @@ __lsm_tree_open(
lsm_tree->filename = lsm_tree->name + strlen("lsm:");
WT_ERR(__wt_lsm_meta_read(session, lsm_tree));
+ if (lsm_tree->nchunks == 0)
+ WT_ERR(__wt_lsm_tree_switch(session, lsm_tree));
+
/* Set the generation number so cursors are opened on first usage. */
lsm_tree->dsk_gen = 1;