summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/lsm
diff options
context:
space:
mode:
authorMatt Kangas <matt.kangas@mongodb.com>2014-12-17 10:30:34 -0500
committerMatt Kangas <matt.kangas@mongodb.com>2014-12-17 10:30:34 -0500
commit09a1b0ca18b5340f5383d541abe96beb186a515a (patch)
tree0f3ee4393728b4e7d79b2aa23fe87f9a4e3593a1 /src/third_party/wiredtiger/src/lsm
parent3077abf30145174c4cab2779de7a621c2dd42062 (diff)
downloadmongo-09a1b0ca18b5340f5383d541abe96beb186a515a.tar.gz
Import wiredtiger-wiredtiger-2.8-rc2-253-g379ffab.tar.gz from wiredtiger branch mongodb-2.8
Diffstat (limited to 'src/third_party/wiredtiger/src/lsm')
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_cursor.c2
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_manager.c24
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_merge.c2
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_meta.c6
-rw-r--r--src/third_party/wiredtiger/src/lsm/lsm_tree.c10
5 files changed, 29 insertions, 15 deletions
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_cursor.c b/src/third_party/wiredtiger/src/lsm/lsm_cursor.c
index 0a8b54197a6..b7104eecb9d 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_cursor.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_cursor.c
@@ -1460,7 +1460,7 @@ __wt_clsm_open(WT_SESSION_IMPL *session,
ret = __wt_lsm_tree_get(session, uri, 0, &lsm_tree));
WT_RET(ret);
- WT_ERR(__wt_calloc_def(session, 1, &clsm));
+ WT_ERR(__wt_calloc_one(session, &clsm));
cursor = &clsm->iface;
*cursor = iface;
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_manager.c b/src/third_party/wiredtiger/src/lsm/lsm_manager.c
index 1356d336f6e..319bc734d6d 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_manager.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_manager.c
@@ -93,12 +93,17 @@ __lsm_general_worker_start(WT_SESSION_IMPL *session)
}
/*
- * If there are only two threads handling work units let them
- * both do flushes otherwise a single merge can lead to switched
- * chunks filling up the cache.
+ * Setup the first worker properly - if there are only a minimal
+ * number of workers allow the first worker to flush. Otherwise a
+ * single merge can lead to switched chunks filling up the cache.
+ * This is separate to the main loop so that it is applied on startup
+ * and reconfigure.
*/
- if (manager->lsm_workers_max == 3)
+ if (manager->lsm_workers_max == WT_LSM_MIN_WORKERS)
FLD_SET(manager->lsm_worker_cookies[1].type, WT_LSM_WORK_FLUSH);
+ else
+ FLD_CLR(manager->lsm_worker_cookies[1].type, WT_LSM_WORK_FLUSH);
+
return (0);
}
@@ -137,6 +142,15 @@ __lsm_stop_workers(WT_SESSION_IMPL *session)
* statically when the connection was opened.
*/
}
+
+ /*
+ * Setup the first worker properly - if there are only a minimal
+ * number of workers it should flush. Since the number of threads
+ * is being reduced the field can't already be set.
+ */
+ if (manager->lsm_workers_max == WT_LSM_MIN_WORKERS)
+ FLD_SET(manager->lsm_worker_cookies[1].type, WT_LSM_WORK_FLUSH);
+
return (0);
}
@@ -645,7 +659,7 @@ __wt_lsm_manager_push_entry(WT_SESSION_IMPL *session,
WT_RET(__wt_epoch(session, &lsm_tree->work_push_ts));
- WT_RET(__wt_calloc_def(session, 1, &entry));
+ WT_RET(__wt_calloc_one(session, &entry));
entry->type = type;
entry->flags = flags;
entry->lsm_tree = lsm_tree;
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_merge.c b/src/third_party/wiredtiger/src/lsm/lsm_merge.c
index 9ed605724ce..8989e979a44 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_merge.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_merge.c
@@ -311,7 +311,7 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, u_int id)
lsm_tree->name, verb, lsm_tree->chunk[verb]->id));
}
- WT_ERR(__wt_calloc_def(session, 1, &chunk));
+ WT_ERR(__wt_calloc_one(session, &chunk));
created_chunk = 1;
chunk->id = dest_id;
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_meta.c b/src/third_party/wiredtiger/src/lsm/lsm_meta.c
index bf03588c066..7fd77b64720 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_meta.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_meta.c
@@ -91,8 +91,8 @@ __wt_lsm_meta_read(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
WT_ERR(__wt_realloc_def(session,
&lsm_tree->chunk_alloc,
nchunks + 1, &lsm_tree->chunk));
- WT_ERR(__wt_calloc_def(
- session, 1, &chunk));
+ WT_ERR(
+ __wt_calloc_one(session, &chunk));
lsm_tree->chunk[nchunks++] = chunk;
chunk->id = (uint32_t)lv.val;
WT_ERR(__wt_lsm_tree_chunk_name(session,
@@ -136,7 +136,7 @@ __wt_lsm_meta_read(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
WT_ERR(__wt_realloc_def(session,
&lsm_tree->old_alloc, nchunks + 1,
&lsm_tree->old_chunks));
- WT_ERR(__wt_calloc_def(session, 1, &chunk));
+ WT_ERR(__wt_calloc_one(session, &chunk));
lsm_tree->old_chunks[nchunks++] = chunk;
WT_ERR(__wt_strndup(session,
lk.str, lk.len, &chunk->uri));
diff --git a/src/third_party/wiredtiger/src/lsm/lsm_tree.c b/src/third_party/wiredtiger/src/lsm/lsm_tree.c
index 888f12bdd94..2e61bcbacc8 100644
--- a/src/third_party/wiredtiger/src/lsm/lsm_tree.c
+++ b/src/third_party/wiredtiger/src/lsm/lsm_tree.c
@@ -332,7 +332,7 @@ __wt_lsm_tree_create(WT_SESSION_IMPL *session,
WT_RET_MSG(session, EINVAL,
"LSM trees cannot be configured as column stores");
- WT_RET(__wt_calloc_def(session, 1, &lsm_tree));
+ WT_RET(__wt_calloc_one(session, &lsm_tree));
WT_ERR(__lsm_tree_set_name(session, lsm_tree, uri));
@@ -343,7 +343,7 @@ __wt_lsm_tree_create(WT_SESSION_IMPL *session,
WT_ERR(__wt_strndup(
session, cval.str, cval.len, &lsm_tree->value_format));
- WT_ERR(__wt_config_gets(session, cfg, "collator", &cval));
+ WT_ERR(__wt_config_gets_none(session, cfg, "collator", &cval));
WT_ERR(__wt_strndup(
session, cval.str, cval.len, &lsm_tree->collator_name));
@@ -551,7 +551,7 @@ __lsm_tree_open(
return (ret);
/* Try to open the tree. */
- WT_RET(__wt_calloc_def(session, 1, &lsm_tree));
+ WT_RET(__wt_calloc_one(session, &lsm_tree));
WT_ERR(__wt_rwlock_alloc(session, &lsm_tree->rwlock, "lsm tree"));
WT_ERR(__lsm_tree_set_name(session, lsm_tree, uri));
@@ -820,7 +820,7 @@ __wt_lsm_tree_switch(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
"merge throttle %ld", lsm_tree->name,
new_id, lsm_tree->ckpt_throttle, lsm_tree->merge_throttle));
- WT_ERR(__wt_calloc_def(session, 1, &chunk));
+ WT_ERR(__wt_calloc_one(session, &chunk));
chunk->id = new_id;
chunk->switch_txn = WT_TXN_NONE;
lsm_tree->chunk[lsm_tree->nchunks++] = chunk;
@@ -1011,7 +1011,7 @@ __wt_lsm_tree_truncate(
locked = 1;
/* Create the new chunk. */
- WT_ERR(__wt_calloc_def(session, 1, &chunk));
+ WT_ERR(__wt_calloc_one(session, &chunk));
chunk->id = WT_ATOMIC_ADD4(lsm_tree->last, 1);
WT_ERR(__wt_lsm_tree_setup_chunk(session, lsm_tree, chunk));