diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2012-10-19 15:19:46 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2012-10-19 15:19:46 +1100 |
commit | c09e4e28dfc76ab10c1e1f5779b4a381de097ee5 (patch) | |
tree | 53befa48f7801581a6ec7835a8c81a27e2f237f7 | |
parent | f3bc3483825a31f1751523db5e3fe0677e8ee3e7 (diff) | |
download | mongo-c09e4e28dfc76ab10c1e1f5779b4a381de097ee5.tar.gz |
Add an API to pass a config string to __wt_bloom_create.
-rw-r--r-- | dist/api_data.py | 25 | ||||
-rw-r--r-- | src/config/config_def.c | 14 | ||||
-rw-r--r-- | src/include/lsm.h | 3 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 13 | ||||
-rw-r--r-- | src/lsm/lsm_merge.c | 3 | ||||
-rw-r--r-- | src/lsm/lsm_meta.c | 11 | ||||
-rw-r--r-- | src/lsm/lsm_tree.c | 5 | ||||
-rw-r--r-- | src/lsm/lsm_worker.c | 3 |
8 files changed, 49 insertions, 28 deletions
diff --git a/dist/api_data.py b/dist/api_data.py index c0e6b21ec5c..ed4898bda7e 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -86,23 +86,26 @@ format_meta = column_meta + [ ] lsm_config = [ + Config('lsm_bloom', 'true', r''' + create bloom filters on LSM tree chunks as they are merged''', + type='boolean'), + Config('lsm_bloom_config', '', r''' + config string used when creating Bloom filter files, passed to + WT_SESSION::create'''), + Config('lsm_bloom_bit_count', '8', r''' + the number of bits used per item for LSM bloom filters''', + min='2', max='1000'), Config('lsm_bloom_hash_count', '4', r''' the number of hash values per item used for LSM bloom - filters.''', + filters''', min='2', max='100'), - Config('lsm_bloom_bit_count', '8', r''' - the number of bits used per item for LSM bloom filters.''', - min='2', max='1000'), - Config('lsm_bloom', 'true', r''' - create bloom filters on LSM tree chunks as they are merged.''', + Config('lsm_bloom_newest', 'false', r''' + create a bloom filter on an LSM tree chunk before it's first merge. + Only supported if bloom filters are enabled''', type='boolean'), Config('lsm_bloom_oldest', 'false', r''' create a bloom filter on the oldest LSM tree chunk. Only supported if - bloom filters are enabled.''', - type='boolean'), - Config('lsm_bloom_newest', 'false', r''' - create a bloom filter on an LSM tree chunk before it's first merge. - Only supported if bloom filters are enabled.''', + bloom filters are enabled''', type='boolean'), Config('lsm_chunk_size', '2MB', r''' the maximum size of the in-memory chunk of an LSM tree''', diff --git a/src/config/config_def.c b/src/config/config_def.c index c35e7da4a82..50f3156b29e 100644 --- a/src/config/config_def.c +++ b/src/config/config_def.c @@ -113,8 +113,8 @@ __wt_confdfl_file_meta = "checksum=,collator=,columns=,dictionary=0,format=btree,huffman_key=," "huffman_value=,internal_item_max=0,internal_key_truncate=," "internal_page_max=2KB,key_format=u,key_gap=10,leaf_item_max=0," - "leaf_page_max=1MB,lsm_bloom=,lsm_bloom_bit_count=8," - "lsm_bloom_hash_count=4,lsm_bloom_newest=0,lsm_bloom_oldest=0," + "leaf_page_max=1MB,lsm_bloom=,lsm_bloom_bit_count=8,lsm_bloom_config=" + ",lsm_bloom_hash_count=4,lsm_bloom_newest=0,lsm_bloom_oldest=0," "lsm_chunk_size=2MB,lsm_merge_max=15,prefix_compression=,split_pct=75" ",value_format=u,version=(major=0,minor=0)"; @@ -140,6 +140,7 @@ __wt_confchk_file_meta[] = { { "leaf_page_max", "int", "min=512B,max=512MB" }, { "lsm_bloom", "boolean", NULL }, { "lsm_bloom_bit_count", "int", "min=2,max=1000" }, + { "lsm_bloom_config", "string", NULL }, { "lsm_bloom_hash_count", "int", "min=2,max=100" }, { "lsm_bloom_newest", "boolean", NULL }, { "lsm_bloom_oldest", "boolean", NULL }, @@ -229,10 +230,10 @@ __wt_confdfl_session_create = "format=btree,huffman_key=,huffman_value=,internal_item_max=0," "internal_key_truncate=,internal_page_max=2KB,key_format=u," "key_format=u,key_gap=10,leaf_item_max=0,leaf_page_max=1MB,lsm_bloom=" - ",lsm_bloom_bit_count=8,lsm_bloom_hash_count=4,lsm_bloom_newest=0," - "lsm_bloom_oldest=0,lsm_chunk_size=2MB,lsm_merge_max=15," - "prefix_compression=,source=,split_pct=75,type=file,value_format=u," - "value_format=u"; + ",lsm_bloom_bit_count=8,lsm_bloom_config=,lsm_bloom_hash_count=4," + "lsm_bloom_newest=0,lsm_bloom_oldest=0,lsm_chunk_size=2MB," + "lsm_merge_max=15,prefix_compression=,source=,split_pct=75,type=file," + "value_format=u,value_format=u"; WT_CONFIG_CHECK __wt_confchk_session_create[] = { @@ -259,6 +260,7 @@ __wt_confchk_session_create[] = { { "leaf_page_max", "int", "min=512B,max=512MB" }, { "lsm_bloom", "boolean", NULL }, { "lsm_bloom_bit_count", "int", "min=2,max=1000" }, + { "lsm_bloom_config", "string", NULL }, { "lsm_bloom_hash_count", "int", "min=2,max=100" }, { "lsm_bloom_newest", "boolean", NULL }, { "lsm_bloom_oldest", "boolean", NULL }, diff --git a/src/include/lsm.h b/src/include/lsm.h index aedd8e595b4..f67c515a3ac 100644 --- a/src/include/lsm.h +++ b/src/include/lsm.h @@ -54,7 +54,8 @@ struct __wt_lsm_chunk { */ struct __wt_lsm_tree { const char *name, *config, *filename; - const char *key_format, *value_format, *file_config; + const char *key_format, *value_format; + const char *bloom_config, *file_config; WT_COLLATOR *collator; diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index a6ad21326e7..deccb7ed980 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -666,16 +666,19 @@ struct __wt_session { * transfer from a storage device.,an integer between 512B and 512MB; * default \c 1MB.} * @config{lsm_bloom, create bloom filters on LSM tree chunks as they - * are merged..,a boolean flag; default \c true.} + * are merged.,a boolean flag; default \c true.} * @config{lsm_bloom_bit_count, the number of bits used per item for LSM - * bloom filters..,an integer between 2 and 1000; default \c 8.} + * bloom filters.,an integer between 2 and 1000; default \c 8.} + * @config{lsm_bloom_config, config string used when creating Bloom + * filter files\, passed to WT_SESSION::create.,a string; default + * empty.} * @config{lsm_bloom_hash_count, the number of hash values per item used - * for LSM bloom filters..,an integer between 2 and 100; default \c 4.} + * for LSM bloom filters.,an integer between 2 and 100; default \c 4.} * @config{lsm_bloom_newest, create a bloom filter on an LSM tree chunk * before it's first merge. Only supported if bloom filters are - * enabled..,a boolean flag; default \c false.} + * enabled.,a boolean flag; default \c false.} * @config{lsm_bloom_oldest, create a bloom filter on the oldest LSM - * tree chunk. Only supported if bloom filters are enabled..,a boolean + * tree chunk. Only supported if bloom filters are enabled.,a boolean * flag; default \c false.} * @config{lsm_chunk_size, the maximum size of the in-memory chunk of an * LSM tree.,an integer between 512K and 500MB; default \c 2MB.} diff --git a/src/lsm/lsm_merge.c b/src/lsm/lsm_merge.c index f19afbe1a13..b782b48c436 100644 --- a/src/lsm/lsm_merge.c +++ b/src/lsm/lsm_merge.c @@ -189,7 +189,8 @@ __wt_lsm_merge(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree, int stalls) WT_ERR(ret); if (create_bloom) WT_ERR(__wt_bloom_create(session, chunk->bloom_uri, - NULL, record_count, lsm_tree->bloom_bit_count, + lsm_tree->bloom_config, + record_count, lsm_tree->bloom_bit_count, lsm_tree->bloom_hash_count, &bloom)); WT_ERR(__wt_open_cursor(session, chunk->uri, NULL, cur_cfg, &dest)); diff --git a/src/lsm/lsm_meta.c b/src/lsm/lsm_meta.c index 682e19030f7..6721f753864 100644 --- a/src/lsm/lsm_meta.c +++ b/src/lsm/lsm_meta.c @@ -25,7 +25,12 @@ __wt_lsm_meta_read(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) WT_RET(__wt_metadata_read(session, lsm_tree->name, &config)); WT_ERR(__wt_config_init(session, &cparser, config)); while ((ret = __wt_config_next(&cparser, &ck, &cv)) == 0) { - if (WT_STRING_MATCH("file_config", ck.str, ck.len)) { + if (WT_STRING_MATCH("bloom_config", ck.str, ck.len)) { + __wt_free(session, lsm_tree->bloom_config); + /* Don't include the brackets. */ + WT_ERR(__wt_strndup(session, + cv.str + 1, cv.len - 2, &lsm_tree->bloom_config)); + } else if (WT_STRING_MATCH("file_config", ck.str, ck.len)) { __wt_free(session, lsm_tree->file_config); /* Don't include the brackets. */ WT_ERR(__wt_strndup(session, @@ -147,8 +152,8 @@ __wt_lsm_meta_write(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) WT_RET(__wt_scr_alloc(session, 0, &buf)); WT_ERR(__wt_buf_fmt(session, buf, - "file_config=(%s),key_format=%s,value_format=%s", - lsm_tree->file_config, + "bloom_config=(%s),file_config=(%s),key_format=%s,value_format=%s", + lsm_tree->bloom_config, lsm_tree->file_config, lsm_tree->key_format, lsm_tree->value_format)); WT_ERR(__wt_buf_catfmt(session, buf, ",last=%" PRIu32 ",lsm_chunk_size=%" PRIu64 diff --git a/src/lsm/lsm_tree.c b/src/lsm/lsm_tree.c index 84dac6b71d1..bd2bc5abcbc 100644 --- a/src/lsm/lsm_tree.c +++ b/src/lsm/lsm_tree.c @@ -28,6 +28,7 @@ __lsm_tree_discard(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) __wt_free(session, lsm_tree->config); __wt_free(session, lsm_tree->key_format); __wt_free(session, lsm_tree->value_format); + __wt_free(session, lsm_tree->bloom_config); __wt_free(session, lsm_tree->file_config); if (lsm_tree->rwlock != NULL) @@ -281,6 +282,10 @@ __wt_lsm_tree_create(WT_SESSION_IMPL *session, "Bloom filters can only be created on newest and oldest " "chunks if bloom filters are enabled"); + WT_ERR(__wt_config_gets(session, cfg, "lsm_bloom_config", &cval)); + WT_ERR(__wt_strndup(session, cval.str, cval.len, + &lsm_tree->bloom_config)); + WT_ERR(__wt_config_gets(session, cfg, "lsm_bloom_bit_count", &cval)); lsm_tree->bloom_bit_count = (uint32_t)cval.val; WT_ERR(__wt_config_gets(session, cfg, "lsm_bloom_hash_count", &cval)); diff --git a/src/lsm/lsm_worker.c b/src/lsm/lsm_worker.c index e19e014c96e..76d9e2f830d 100644 --- a/src/lsm/lsm_worker.c +++ b/src/lsm/lsm_worker.c @@ -185,7 +185,8 @@ __lsm_bloom_create(WT_SESSION_IMPL *session, bloom = NULL; - WT_ERR(__wt_bloom_create(session, chunk->bloom_uri, NULL, chunk->count, + WT_ERR(__wt_bloom_create(session, chunk->bloom_uri, + lsm_tree->bloom_config, chunk->count, lsm_tree->bloom_bit_count, lsm_tree->bloom_hash_count, &bloom)); WT_ERR(__wt_open_cursor(session, chunk->uri, NULL, cur_cfg, &src)); |