summaryrefslogtreecommitdiff
path: root/src/lsm
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2015-08-26 14:23:56 +1000
committerAlex Gorrod <alexg@wiredtiger.com>2015-08-26 14:23:56 +1000
commit69ed44018edd6c867b968a60a93b1d19ad5f5c3d (patch)
tree1f2471967375022e464707b2feefdfd6a539854e /src/lsm
parent8e4bdd38f1800d6e6c62f5060b7d25e9d509d735 (diff)
downloadmongo-69ed44018edd6c867b968a60a93b1d19ad5f5c3d.tar.gz
WT-147 Add undocumented bulk=unordered for LSM cursors.
The feature allows us to stop worrying about schema lock interactions when building LSM indexes on existing tables.
Diffstat (limited to 'src/lsm')
-rw-r--r--src/lsm/lsm_cursor_bulk.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lsm/lsm_cursor_bulk.c b/src/lsm/lsm_cursor_bulk.c
index ef1c124111f..4a78e3ce38c 100644
--- a/src/lsm/lsm_cursor_bulk.c
+++ b/src/lsm/lsm_cursor_bulk.c
@@ -90,17 +90,29 @@ __clsm_insert_bulk(WT_CURSOR *cursor)
int
__wt_clsm_open_bulk(WT_CURSOR_LSM *clsm, const char *cfg[])
{
+ WT_CONFIG_ITEM cval;
WT_CURSOR *cursor, *bulk_cursor;
WT_LSM_TREE *lsm_tree;
WT_SESSION_IMPL *session;
+ int ordered;
bulk_cursor = NULL;
cursor = &clsm->iface;
lsm_tree = clsm->lsm_tree;
+ ordered = 1; /* Default to ordered inserts */
session = (WT_SESSION_IMPL *)clsm->iface.session;
F_SET(clsm, WT_CLSM_BULK);
+ /*
+ * Check for the undocumented unordered bulk flag, which is used when
+ * doing index builds into LSM for existing trees.
+ */
+ WT_RET(__wt_config_gets_def(session, cfg, "bulk", 0, &cval));
+ WT_ASSERT(session, cval.val != 0);
+ if (strncmp(cval.str, "unordered", strlen("unordered")) == 0)
+ ordered = 0;
+
/* Bulk cursors are limited to insert and close. */
__wt_cursor_set_notsup(cursor);
cursor->insert = __clsm_insert_bulk;
@@ -138,7 +150,8 @@ __wt_clsm_open_bulk(WT_CURSOR_LSM *clsm, const char *cfg[])
* for bulk access.
*/
WT_RET(__wt_open_cursor(session,
- lsm_tree->chunk[0]->uri, &clsm->iface, cfg, &bulk_cursor));
+ lsm_tree->chunk[0]->uri, &clsm->iface,
+ ordered ? cfg : NULL, &bulk_cursor));
clsm->cursors[0] = bulk_cursor;
/* LSM cursors are always raw */
F_SET(bulk_cursor, WT_CURSTD_RAW);