summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2012-10-10 15:28:53 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2012-10-10 15:28:53 +1100
commit87f9e084d923bd5c7962af638fe5fe17d4ac7548 (patch)
tree61b6c1e3d5d09f1d89bc632c32994f3dbe3bd172
parent8a5cf7f30e43fd12316329dc8f79dfd86108284a (diff)
downloadmongo-87f9e084d923bd5c7962af638fe5fe17d4ac7548.tar.gz
Cleanup the Bloom filter bulk-load change.
-rw-r--r--dist/api_data.py17
-rw-r--r--src/bloom/bloom.c28
-rw-r--r--src/btree/rec_write.c1
-rw-r--r--src/cursor/cur_file.c4
4 files changed, 23 insertions, 27 deletions
diff --git a/dist/api_data.py b/dist/api_data.py
index 954180f3a2f..3eb98368002 100644
--- a/dist/api_data.py
+++ b/dist/api_data.py
@@ -285,12 +285,17 @@ methods = {
number key; valid only for cursors with record number keys''',
type='boolean'),
Config('bulk', 'false', r'''
- configure the cursor for bulk loads, a fast load path
- that may only be used for newly created objects. Cursors
- configured for bulk load only support the WT_CURSOR::insert
- and WT_CURSOR::close methods''',
- # type='boolean'), -- API kludge to pass through "bitmap" special
- ),
+ configure the cursor for bulk loads, a fast load path that may
+ only be used for newly created objects. Cursors configured for
+ bulk load only support the WT_CURSOR::insert and
+ WT_CURSOR::close methods. The value is usually a true/false
+ flag, but the the special value \c "bitmap" is for use with
+ fixed-length column stores, and allows chunks of a memory
+ resident bitmap to be loaded directly into a file by passing a
+ \c WT_ITEM to WT_CURSOR::set_value where the \c size field
+ indicates the number of records in the bitmap (as specified by
+ the file's \c value_format)''',
+ type='string'),
Config('checkpoint', '', r'''
the name of a checkpoint to open (the reserved name
"WiredTigerCheckpoint" opens the most recent internal
diff --git a/src/bloom/bloom.c b/src/bloom/bloom.c
index 0305a63a132..4da8b207259 100644
--- a/src/bloom/bloom.c
+++ b/src/bloom/bloom.c
@@ -162,6 +162,7 @@ int
__wt_bloom_finalize(WT_BLOOM *bloom)
{
WT_CURSOR *c;
+ WT_DECL_RET;
WT_ITEM values;
WT_SESSION *wt_session;
uint64_t i;
@@ -173,31 +174,22 @@ __wt_bloom_finalize(WT_BLOOM *bloom)
* TODO: should this call __wt_schema_create directly?
*/
WT_RET(wt_session->create(wt_session, bloom->uri, bloom->config));
-
-#if 0
WT_RET(wt_session->open_cursor(
wt_session, bloom->uri, NULL, "bulk=bitmap", &c));
+
/* Add the entries from the array into the table. */
- for (i = 0; i < bloom->m; i++) {
- c->set_value(c, __bit_test(bloom->bitstring, i));
- WT_RET(c->insert(c));
+ for (i = 0; i < bloom->m; i += values.size) {
+ values.data = bloom->bitstring;
+ values.size = (uint32_t)WT_MIN(bloom->m - i, 1000000);
+ c->set_value(c, &values);
+ WT_ERR(c->insert(c));
}
- WT_UNUSED(values);
-#else
- WT_RET(wt_session->open_cursor(
- wt_session, bloom->uri, NULL, "bulk=bitmap", &c));
- values.data = bloom->bitstring;
- /* FIXME support more than 4 billion items in a chunk. */
- values.size = (uint32_t)bloom->m;
- c->set_value(c, &values);
- WT_RET(c->insert(c));
- WT_UNUSED(i);
-#endif
- WT_RET(c->close(c));
+
+err: WT_TRET(c->close(c));
__wt_free(bloom->session, bloom->bitstring);
bloom->bitstring = NULL;
- return (0);
+ return (ret);
}
/*
diff --git a/src/btree/rec_write.c b/src/btree/rec_write.c
index 41dca1cbb31..5dd05717011 100644
--- a/src/btree/rec_write.c
+++ b/src/btree/rec_write.c
@@ -1505,7 +1505,6 @@ __wt_rec_col_fix_bulk_insert(WT_CURSOR_BULK *cbulk)
cursor = &cbulk->cbt.iface;
if (cbulk->bitmap) {
- /* FIXME: for more than 4B entries in a bitmap. */
for (data = cursor->value.data, entries = cursor->value.size;
entries > 0;
entries -= page_entries, data += page_size) {
diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c
index 14f27b3b35e..1af6158d4bc 100644
--- a/src/cursor/cur_file.c
+++ b/src/cursor/cur_file.c
@@ -321,9 +321,9 @@ __wt_curfile_create(WT_SESSION_IMPL *session,
WT_RET(__wt_config_gets_defno(session, cfg, "bulk", &cval));
if ((cval.type == ITEM_ID || cval.type == ITEM_STRING) &&
- WT_STRING_MATCH("bitmap", cval.str, cval.len)) {
+ WT_STRING_MATCH("bitmap", cval.str, cval.len))
bitmap = bulk = 1;
- } else {
+ else {
bitmap = 0;
bulk = (cval.val != 0);
}