diff options
author | agorrod <alexg@wiredtiger.com> | 2012-11-07 13:25:15 -0800 |
---|---|---|
committer | agorrod <alexg@wiredtiger.com> | 2012-11-07 13:25:15 -0800 |
commit | 4de91326b098d20ad7d824e793d525b3c14fe40a (patch) | |
tree | f95d1da45972fb815d9ff72498ddd728738edc0a | |
parent | d02768b4174cbf988a1579b59c540e2c1e3e706c (diff) | |
parent | f6bf0fbe3b66d58c2787d1bd1edf4a6dd12c27fc (diff) | |
download | mongo-4de91326b098d20ad7d824e793d525b3c14fe40a.tar.gz |
Merge pull request #378 from wiredtiger/shared-cache-config
Shared cache config
-rw-r--r-- | dist/api_data.py | 29 | ||||
-rw-r--r-- | dist/config.py | 73 | ||||
-rw-r--r-- | examples/c/ex_config.c | 2 | ||||
-rw-r--r-- | examples/c/ex_test_perf.c | 8 | ||||
-rw-r--r-- | src/btree/bt_cache.c | 2 | ||||
-rw-r--r-- | src/config/config.c | 18 | ||||
-rw-r--r-- | src/config/config_check.c | 42 | ||||
-rw-r--r-- | src/config/config_def.c | 350 | ||||
-rw-r--r-- | src/conn/conn_api.c | 8 | ||||
-rw-r--r-- | src/conn/conn_cache_pool.c | 28 | ||||
-rw-r--r-- | src/include/api.h | 2 | ||||
-rw-r--r-- | src/include/cache.h | 2 | ||||
-rw-r--r-- | src/include/config.h | 1 | ||||
-rw-r--r-- | src/include/extern.h | 4 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 106 | ||||
-rw-r--r-- | test/bloom/test_bloom.c | 2 | ||||
-rw-r--r-- | test/fops/t.c | 2 | ||||
-rw-r--r-- | test/format/wts.c | 2 | ||||
-rw-r--r-- | test/suite/test_cache_pool.py | 6 | ||||
-rw-r--r-- | test/suite/test_config01.py | 2 | ||||
-rw-r--r-- | test/suite/test_config03.py | 1 | ||||
-rw-r--r-- | test/suite/test_config04.py | 10 | ||||
-rw-r--r-- | test/suite/test_cursor03.py | 2 | ||||
-rw-r--r-- | test/suite/test_schema03.py | 2 | ||||
-rw-r--r-- | test/thread/t.c | 2 |
25 files changed, 425 insertions, 281 deletions
diff --git a/dist/api_data.py b/dist/api_data.py index 3aa986007ba..a512117c13a 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -35,10 +35,11 @@ class Method: self.flags = flags class Config: - def __init__(self, name, default, desc, **flags): + def __init__(self, name, default, desc, subconfig=None, **flags): self.name = name self.default = default self.desc = desc + self.subconfig = subconfig self.flags = flags def __cmp__(self, other): @@ -228,24 +229,20 @@ table_meta = format_meta + table_only_meta # Connection runtime config, shared by conn.reconfigure and wiredtiger_open connection_runtime_config = [ - Config('cache_pool', '', r''' + Config('cache', '', r''' + cache configuration setup''', type='category', subconfig=[ + Config('size', '100MB', r''' + maximum heap memory to allocate for the cache''', + min='1MB', max='10TB'), + Config('pool', '', r''' name of a cache pool that is shared between databases'''), - Config('cache_pool_size', '', r''' - size of a cache pool that is shared between databases. Only valid if - the cache_pool option is also specified. Must be specified if this - connection may create the cache pool''', + Config('pool_min', '', r''' + minimum amount of cache a connection in a cache pool can have''', min='1MB', max='10TB'), - Config('cache_pool_chunk', '', r''' + Config('pool_chunk', '', r''' the granularity that a cache pool is shared out. Only valid if the - cache_pool option is also specified.''', - min='1MB', max='10TB'), - Config('cache_pool_quota', '', r''' - the maximum amount of the cache pool a single database can use. Only - valid if the cache_pool option is also specified.''', - min='1MB', max='10TB'), - Config('cache_size', '100MB', r''' - maximum heap memory to allocate for the cache''', - min='1MB', max='10TB'), + cache_pool option is also specified''', + min='1MB', max='10TB')]), Config('error_prefix', '', r''' prefix string for error messages'''), Config('eviction_target', '80', r''' diff --git a/dist/config.py b/dist/config.py index b3dd944eefa..962bd247cf2 100644 --- a/dist/config.py +++ b/dist/config.py @@ -35,6 +35,7 @@ def typedesc(c): 'format' : 'a format string', 'int' : 'an integer', 'list' : 'a list', + 'category': 'a set of related configuration options defined below', 'string' : 'a string'}[ctype] if cmin and cmax: desc += ' between ' + cmin + ' and ' + cmax @@ -52,6 +53,27 @@ def typedesc(c): desc += ' of strings' return desc +def parseconfig(c, parent_name=None): + ctype = gettype(c) + desc = textwrap.dedent(c.desc) + '.' + desc = desc.replace(',', '\\,') + default = '\\c ' + str(c.default) if c.default or ctype == 'int' \ + else 'empty' + name = c.name + if parent_name: + name = parent_name + '.' + name + + tdesc = typedesc(c) + if ctype != 'category': + tdesc += '; default ' + default + tdesc += '.' + tdesc = tdesc.replace(',', '\\,') + output = '@config{' + ','.join((name, desc, tdesc)) + '}' + if ctype == 'category': + for subc in c.subconfig: + output += parseconfig(subc, c.name) + return output + skip = False for line in open(f, 'r'): if skip: @@ -96,14 +118,7 @@ for line in open(f, 'r'): lastname = name if 'undoc' in c.flags: continue - - desc = textwrap.dedent(c.desc) + '.' - desc = desc.replace(',', '\\,') - default = '\\c ' + str(c.default) if c.default or gettype(c) == 'int' \ - else 'empty' - tdesc = typedesc(c) + '; default ' + default + '.' - tdesc = tdesc.replace(',', '\\,') - output = '@config{' + ','.join((name, desc, tdesc)) + '}' + output = parseconfig(c) for l in w.wrap(output): tfile.write(prefix + l + '\n') @@ -134,11 +149,15 @@ def checkstr(c): cmin = str(checks.get('min', '')) cmax = str(checks.get('max', '')) choices = checks.get('choices', []) + subconfig = checks.get('subconfig', []) result = [] if cmin: result.append('min=' + cmin) if cmax: result.append('max=' + cmax) + if subconfig: + result.append('subconfig=' + '[' + + ','.join('\\"' + parseconfig(c) + '\\"' for c in subconfig) + ']') if choices: result.append('choices=' + '[' + ','.join('\\"' + s + '\\"' for s in choices) + ']') @@ -151,11 +170,40 @@ def get_default(c): t = gettype(c) if c.default == 'false': return '0' + elif t == 'category': + return '(%s)' % (','.join('%s=%s' % (subc.name, get_default(subc)) + for subc in sorted(c.subconfig))) elif (c.default or t == 'int') and c.default != 'true': return str(c.default) else: return '' +created_subconfigs=set() +def add_subconfig(c): + if c.name in created_subconfigs: + return + created_subconfigs.add(c.name) + tfile.write(''' +WT_CONFIG_CHECK +__wt_confchk_%(name)s_subconfigs[] = { +\t%(check)s +\t{ NULL, NULL, NULL, NULL } +}; +''' % { + 'name' : c.name, + 'check' : '\n\t'.join('"\n\t "'.join(w.wrap('{ "%s", "%s", %s, NULL },' % + (subc.name, gettype(subc), checkstr(subc)))) for subc in sorted(c.subconfig)), +}) + +def getsubconfigstr(c): + '''Return a string indicating if an item has sub configuration''' + ctype = gettype(c) + if ctype == 'category': + add_subconfig(c) + return '__wt_confchk_' + c.name + '_subconfigs' + else: + return 'NULL' + for name in sorted(api_data.methods.keys()): ctype = api_data.methods[name].config name = name.replace('.', '_') @@ -169,13 +217,14 @@ __wt_confdfl_%(name)s = for line in w.wrap(','.join('%s=%s' % (c.name, get_default(c)) for c in sorted(ctype))) or [""]), }) + # Construct an array of allowable configuration options. Always append an empty # string as a terminator for iteration if not ctype: tfile.write(''' WT_CONFIG_CHECK __wt_confchk_%(name)s[] = { -\t{ NULL, NULL, NULL } +\t{ NULL, NULL, NULL, NULL } }; ''' % { 'name' : name }) else: @@ -183,12 +232,12 @@ __wt_confchk_%(name)s[] = { WT_CONFIG_CHECK __wt_confchk_%(name)s[] = { \t%(check)s -\t{ NULL, NULL, NULL } +\t{ NULL, NULL, NULL, NULL } }; ''' % { 'name' : name, - 'check' : '\n\t'.join('"\n\t "'.join(w.wrap('{ "%s", "%s", %s },' % - (c.name, gettype(c), checkstr(c)))) for c in sorted(ctype)), + 'check' : '\n\t'.join('"\n\t "'.join(w.wrap('{ "%s", "%s", %s, %s },' % + (c.name, gettype(c), checkstr(c), getsubconfigstr(c)))) for c in sorted(ctype)), }) tfile.close() diff --git a/examples/c/ex_config.c b/examples/c/ex_config.c index a38c16b0e86..88178380f8e 100644 --- a/examples/c/ex_config.c +++ b/examples/c/ex_config.c @@ -46,7 +46,7 @@ int main(void) /*! [configure cache size] */ if ((ret = wiredtiger_open(home, NULL, - "create,cache_size=500M", &conn)) != 0) + "create,cache.size=500M", &conn)) != 0) fprintf(stderr, "Error connecting to %s: %s\n", home, wiredtiger_strerror(ret)); /*! [configure cache size] */ diff --git a/examples/c/ex_test_perf.c b/examples/c/ex_test_perf.c index 6c8dc776b91..32cccaf8a35 100644 --- a/examples/c/ex_test_perf.c +++ b/examples/c/ex_test_perf.c @@ -77,7 +77,7 @@ void usage(void); CONFIG default_cfg = { "WT_TEST", /* home */ "lsm:test", /* uri */ - "create,cache_size=200MB", /* conn_config */ + "create,cache.size=200MB", /* conn_config */ "key_format=S,value_format=S", /* table_config */ 1, /* create */ 14023954, /* rand_seed */ @@ -99,7 +99,7 @@ CONFIG default_cfg = { CONFIG small_cfg = { "WT_TEST", /* home */ "lsm:test", /* uri */ - "create,cache_size=500MB", /* conn_config */ + "create,cache.size=500MB", /* conn_config */ "key_format=S,value_format=S,lsm_chunk_size=5MB," "leaf_page_max=16k,internal_page_max=16kb", /* table_config */ 1, /* create */ @@ -122,7 +122,7 @@ CONFIG small_cfg = { CONFIG med_cfg = { "WT_TEST", /* home */ "lsm:test", /* uri */ - "create,cache_size=1GB", /* conn_config */ + "create,cache.size=1GB", /* conn_config */ "key_format=S,value_format=S,lsm_chunk_size=20MB," "leaf_page_max=16k,internal_page_max=16kb", /* table_config */ 1, /* create */ @@ -145,7 +145,7 @@ CONFIG med_cfg = { CONFIG large_cfg = { "WT_TEST", /* home */ "lsm:test", /* uri */ - "create,cache_size=2GB", /* conn_config */ + "create,cache.size=2GB", /* conn_config */ "key_format=S,value_format=S,lsm_chunk_size=50MB," "leaf_page_max=16k,internal_page_max=16kb", /* table_config */ 1, /* create */ diff --git a/src/btree/bt_cache.c b/src/btree/bt_cache.c index 6134c3f64a5..fa50b9e52cc 100644 --- a/src/btree/bt_cache.c +++ b/src/btree/bt_cache.c @@ -24,7 +24,7 @@ __wt_cache_config(WT_CONNECTION_IMPL *conn, const char *cfg[]) /* Ignore the cache size if a shared cache is configured. */ if (!F_ISSET(conn, WT_CONN_CACHE_POOL) && - (ret = __wt_config_gets(session, cfg, "cache_size", &cval)) == 0) + (ret = __wt_config_gets(session, cfg, "cache.size", &cval)) == 0) conn->cache_size = (uint64_t)cval.val; WT_RET_NOTFOUND_OK(ret); diff --git a/src/config/config.c b/src/config/config.c index bde794eee17..e351a7bf946 100644 --- a/src/config/config.c +++ b/src/config/config.c @@ -568,17 +568,29 @@ int __wt_config_getraw( WT_CONFIG *cparser, WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value) { - WT_CONFIG_ITEM k, v; + WT_CONFIG sparser; + WT_CONFIG_ITEM k, v, subk; WT_DECL_RET; int found; found = 0; while ((ret = __config_next(cparser, &k, &v)) == 0) { - if ((k.type == ITEM_STRING || k.type == ITEM_ID) && - key->len == k.len && + if (k.type != ITEM_STRING && k.type != ITEM_ID) + continue; + if (k.len == key->len && strncasecmp(key->str, k.str, k.len) == 0) { *value = v; found = 1; + } else if (k.len < key->len && key->str[k.len] == '.' && + strncasecmp(key->str, k.str, k.len) == 0) { + subk.str = key->str + k.len + 1; + subk.len = key->len - k.len - 1; + WT_RET(__wt_config_initn( + cparser->session, &sparser, v.str, v.len)); + if ((ret = + __wt_config_getraw(&sparser, &subk, value)) == 0) + found = 1; + WT_RET_NOTFOUND_OK(ret); } } diff --git a/src/config/config_check.c b/src/config/config_check.c index 5d4a758fb3e..5585a5d02c6 100644 --- a/src/config/config_check.c +++ b/src/config/config_check.c @@ -11,24 +11,32 @@ * __wt_config_check-- * Check that all keys in an application-supplied config string match * what is specified in the check string. + * The final parameter is optional, and allows for passing in strings + * that are not NULL terminated. * * All check strings are generated by dist/config.py from the constraints given * in dist/api_data.py */ int __wt_config_check(WT_SESSION_IMPL *session, - WT_CONFIG_CHECK checks[], const char *config) + WT_CONFIG_CHECK checks[], const char *config, size_t config_len) { WT_CONFIG parser, cparser, sparser; WT_CONFIG_ITEM k, v, ck, cv, dummy; WT_DECL_RET; + const char *cn; int badtype, found, i; + size_t len; + uint64_t cl; /* It is always okay to pass NULL. */ if (config == NULL) return (0); - WT_RET(__wt_config_init(session, &parser, config)); + if (config_len == 0) + WT_RET(__wt_config_init(session, &parser, config)); + else + WT_RET(__wt_config_initn(session, &parser, config, config_len)); while ((ret = __wt_config_next(&parser, &k, &v)) == 0) { if (k.type != ITEM_STRING && k.type != ITEM_ID) WT_RET_MSG(session, EINVAL, @@ -36,12 +44,19 @@ __wt_config_check(WT_SESSION_IMPL *session, (int)k.len, k.str); /* The config check array is sorted, so exit on first found */ - for (i = 0, found = 0; checks[i].name != NULL; i++) - if (WT_STRING_CASE_MATCH( - checks[i].name, k.str, k.len)) { + for (i = 0, found = 0; checks[i].name != NULL; i++) { + cn = checks[i].name; + if (WT_STRING_CASE_MATCH(cn, k.str, k.len)) { found = 1; break; } + cl = strlen(cn); + if (k.len > cl && k.str[cl] == '.' && + WT_STRING_CASE_MATCH(cn, k.str, cl)) { + found = 2; + break; + } + } if (!found) WT_RET_MSG(session, EINVAL, @@ -55,7 +70,22 @@ __wt_config_check(WT_SESSION_IMPL *session, (v.val != 0 && v.val != 1)); else if (strcmp(checks[i].type, "list") == 0) badtype = (v.len > 0 && v.type != ITEM_STRUCT); - else + else if (strcmp(checks[i].type, "category") == 0) { + /* + * Deal with categories that could either be of the + * form: + * XXX.XXX=blah (found will be 2) OR + * XXX=(XXX=blah) (found will be 1) + */ + len = (found == 1) ? v.len : k.len + v.len - cl; + ret = __wt_config_check(session, + checks[i].subconfigs, + k.str + strlen(cn) + 1, len); + if (ret != EINVAL) + badtype = 0; + else + badtype = 1; + } else badtype = 0; if (badtype) diff --git a/src/config/config_def.c b/src/config/config_def.c index 7da2d8fd419..6ab7530b7fd 100644 --- a/src/config/config_def.c +++ b/src/config/config_def.c @@ -8,10 +8,10 @@ __wt_confdfl_colgroup_meta = WT_CONFIG_CHECK __wt_confchk_colgroup_meta[] = { - { "columns", "list", NULL }, - { "source", "string", NULL }, - { "type", "string", "choices=[\"file\",\"lsm\"]" }, - { NULL, NULL, NULL } + { "columns", "list", NULL, NULL }, + { "source", "string", NULL, NULL }, + { "type", "string", "choices=[\"file\",\"lsm\"]", NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -20,7 +20,7 @@ __wt_confdfl_connection_add_collator = WT_CONFIG_CHECK __wt_confchk_connection_add_collator[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -29,7 +29,7 @@ __wt_confdfl_connection_add_compressor = WT_CONFIG_CHECK __wt_confchk_connection_add_compressor[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -38,7 +38,7 @@ __wt_confdfl_connection_add_data_source = WT_CONFIG_CHECK __wt_confchk_connection_add_data_source[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -47,7 +47,7 @@ __wt_confdfl_connection_add_extractor = WT_CONFIG_CHECK __wt_confchk_connection_add_extractor[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -56,7 +56,7 @@ __wt_confdfl_connection_close = WT_CONFIG_CHECK __wt_confchk_connection_close[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -65,9 +65,9 @@ __wt_confdfl_connection_load_extension = WT_CONFIG_CHECK __wt_confchk_connection_load_extension[] = { - { "entry", "string", NULL }, - { "prefix", "string", NULL }, - { NULL, NULL, NULL } + { "entry", "string", NULL, NULL }, + { "prefix", "string", NULL, NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -77,31 +77,35 @@ __wt_confdfl_connection_open_session = WT_CONFIG_CHECK __wt_confchk_connection_open_session[] = { { "isolation", "string", "choices=[\"read-uncommitted\"," - "\"read-committed\",\"snapshot\"]" }, - { NULL, NULL, NULL } + "\"read-committed\",\"snapshot\"]", NULL }, + { NULL, NULL, NULL, NULL } }; const char * __wt_confdfl_connection_reconfigure = - "cache_pool=,cache_pool_chunk=,cache_pool_quota=,cache_pool_size=," - "cache_size=100MB,error_prefix=,eviction_target=80," - "eviction_trigger=95,verbose="; + "cache=(pool=,pool_chunk=,pool_min=,size=100MB),error_prefix=," + "eviction_target=80,eviction_trigger=95,verbose="; + +WT_CONFIG_CHECK +__wt_confchk_cache_subconfigs[] = { + { "pool", "string", NULL, NULL }, + { "pool_chunk", "int", "min=1MB,max=10TB", NULL }, + { "pool_min", "int", "min=1MB,max=10TB", NULL }, + { "size", "int", "min=1MB,max=10TB", NULL }, + { NULL, NULL, NULL, NULL } +}; WT_CONFIG_CHECK __wt_confchk_connection_reconfigure[] = { - { "cache_pool", "string", NULL }, - { "cache_pool_chunk", "int", "min=1MB,max=10TB" }, - { "cache_pool_quota", "int", "min=1MB,max=10TB" }, - { "cache_pool_size", "int", "min=1MB,max=10TB" }, - { "cache_size", "int", "min=1MB,max=10TB" }, - { "error_prefix", "string", NULL }, - { "eviction_target", "int", "min=10,max=99" }, - { "eviction_trigger", "int", "min=10,max=99" }, + { "cache", "category", NULL, __wt_confchk_cache_subconfigs }, + { "error_prefix", "string", NULL, NULL }, + { "eviction_target", "int", "min=10,max=99", NULL }, + { "eviction_trigger", "int", "min=10,max=99", NULL }, { "verbose", "list", "choices=[\"block\",\"cache_pool\",\"ckpt\"," "\"evict\",\"evictserver\",\"fileops\",\"hazard\",\"lsm\",\"mutex\"," "\"read\",\"readserver\",\"reconcile\",\"salvage\",\"verify\"," - "\"write\"]" }, - { NULL, NULL, NULL } + "\"write\"]", NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -110,7 +114,7 @@ __wt_confdfl_cursor_close = WT_CONFIG_CHECK __wt_confchk_cursor_close[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -126,37 +130,37 @@ __wt_confdfl_file_meta = WT_CONFIG_CHECK __wt_confchk_file_meta[] = { - { "allocation_size", "int", "min=512B,max=128MB" }, - { "block_compressor", "string", NULL }, - { "cache_resident", "boolean", NULL }, - { "checkpoint", "string", NULL }, - { "checksum", "boolean", NULL }, - { "collator", "string", NULL }, - { "columns", "list", NULL }, - { "dictionary", "int", "min=0" }, - { "format", "string", "choices=[\"btree\"]" }, - { "huffman_key", "string", NULL }, - { "huffman_value", "string", NULL }, - { "internal_item_max", "int", "min=0" }, - { "internal_key_truncate", "boolean", NULL }, - { "internal_page_max", "int", "min=512B,max=512MB" }, - { "key_format", "format", NULL }, - { "key_gap", "int", "min=0" }, - { "leaf_item_max", "int", "min=0" }, - { "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 }, - { "lsm_chunk_size", "int", "min=512K,max=500MB" }, - { "lsm_merge_max", "int", "min=2,max=100" }, - { "prefix_compression", "boolean", NULL }, - { "split_pct", "int", "min=25,max=100" }, - { "value_format", "format", NULL }, - { "version", "string", NULL }, - { NULL, NULL, NULL } + { "allocation_size", "int", "min=512B,max=128MB", NULL }, + { "block_compressor", "string", NULL, NULL }, + { "cache_resident", "boolean", NULL, NULL }, + { "checkpoint", "string", NULL, NULL }, + { "checksum", "boolean", NULL, NULL }, + { "collator", "string", NULL, NULL }, + { "columns", "list", NULL, NULL }, + { "dictionary", "int", "min=0", NULL }, + { "format", "string", "choices=[\"btree\"]", NULL }, + { "huffman_key", "string", NULL, NULL }, + { "huffman_value", "string", NULL, NULL }, + { "internal_item_max", "int", "min=0", NULL }, + { "internal_key_truncate", "boolean", NULL, NULL }, + { "internal_page_max", "int", "min=512B,max=512MB", NULL }, + { "key_format", "format", NULL, NULL }, + { "key_gap", "int", "min=0", NULL }, + { "leaf_item_max", "int", "min=0", NULL }, + { "leaf_page_max", "int", "min=512B,max=512MB", NULL }, + { "lsm_bloom", "boolean", NULL, NULL }, + { "lsm_bloom_bit_count", "int", "min=2,max=1000", NULL }, + { "lsm_bloom_config", "string", NULL, NULL }, + { "lsm_bloom_hash_count", "int", "min=2,max=100", NULL }, + { "lsm_bloom_newest", "boolean", NULL, NULL }, + { "lsm_bloom_oldest", "boolean", NULL, NULL }, + { "lsm_chunk_size", "int", "min=512K,max=500MB", NULL }, + { "lsm_merge_max", "int", "min=2,max=100", NULL }, + { "prefix_compression", "boolean", NULL, NULL }, + { "split_pct", "int", "min=25,max=100", NULL }, + { "value_format", "format", NULL, NULL }, + { "version", "string", NULL, NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -165,13 +169,13 @@ __wt_confdfl_index_meta = WT_CONFIG_CHECK __wt_confchk_index_meta[] = { - { "columns", "list", NULL }, - { "columns", "list", NULL }, - { "key_format", "format", NULL }, - { "source", "string", NULL }, - { "type", "string", "choices=[\"file\",\"lsm\"]" }, - { "value_format", "format", NULL }, - { NULL, NULL, NULL } + { "columns", "list", NULL, NULL }, + { "columns", "list", NULL, NULL }, + { "key_format", "format", NULL, NULL }, + { "source", "string", NULL, NULL }, + { "type", "string", "choices=[\"file\",\"lsm\"]", NULL }, + { "value_format", "format", NULL, NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -181,12 +185,12 @@ __wt_confdfl_session_begin_transaction = WT_CONFIG_CHECK __wt_confchk_session_begin_transaction[] = { { "isolation", "string", "choices=[\"read-uncommitted\"," - "\"read-committed\",\"snapshot\"]" }, - { "name", "string", NULL }, - { "priority", "int", "min=-100,max=100" }, + "\"read-committed\",\"snapshot\"]", NULL }, + { "name", "string", NULL, NULL }, + { "priority", "int", "min=-100,max=100", NULL }, { "sync", "string", "choices=[\"full\",\"flush\",\"write\"," - "\"none\"]" }, - { NULL, NULL, NULL } + "\"none\"]", NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -195,11 +199,11 @@ __wt_confdfl_session_checkpoint = WT_CONFIG_CHECK __wt_confchk_session_checkpoint[] = { - { "drop", "list", NULL }, - { "force", "boolean", NULL }, - { "name", "string", NULL }, - { "target", "list", NULL }, - { NULL, NULL, NULL } + { "drop", "list", NULL, NULL }, + { "force", "boolean", NULL, NULL }, + { "name", "string", NULL, NULL }, + { "target", "list", NULL, NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -208,7 +212,7 @@ __wt_confdfl_session_close = WT_CONFIG_CHECK __wt_confchk_session_close[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -217,7 +221,7 @@ __wt_confdfl_session_commit_transaction = WT_CONFIG_CHECK __wt_confchk_session_commit_transaction[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -226,7 +230,7 @@ __wt_confdfl_session_compact = WT_CONFIG_CHECK __wt_confchk_session_compact[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -243,42 +247,42 @@ __wt_confdfl_session_create = WT_CONFIG_CHECK __wt_confchk_session_create[] = { - { "allocation_size", "int", "min=512B,max=128MB" }, - { "block_compressor", "string", NULL }, - { "cache_resident", "boolean", NULL }, - { "checksum", "boolean", NULL }, - { "colgroups", "list", NULL }, - { "collator", "string", NULL }, - { "columns", "list", NULL }, - { "columns", "list", NULL }, - { "dictionary", "int", "min=0" }, - { "exclusive", "boolean", NULL }, - { "format", "string", "choices=[\"btree\"]" }, - { "huffman_key", "string", NULL }, - { "huffman_value", "string", NULL }, - { "internal_item_max", "int", "min=0" }, - { "internal_key_truncate", "boolean", NULL }, - { "internal_page_max", "int", "min=512B,max=512MB" }, - { "key_format", "format", NULL }, - { "key_format", "format", NULL }, - { "key_gap", "int", "min=0" }, - { "leaf_item_max", "int", "min=0" }, - { "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 }, - { "lsm_chunk_size", "int", "min=512K,max=500MB" }, - { "lsm_merge_max", "int", "min=2,max=100" }, - { "prefix_compression", "boolean", NULL }, - { "source", "string", NULL }, - { "split_pct", "int", "min=25,max=100" }, - { "type", "string", "choices=[\"file\",\"lsm\"]" }, - { "value_format", "format", NULL }, - { "value_format", "format", NULL }, - { NULL, NULL, NULL } + { "allocation_size", "int", "min=512B,max=128MB", NULL }, + { "block_compressor", "string", NULL, NULL }, + { "cache_resident", "boolean", NULL, NULL }, + { "checksum", "boolean", NULL, NULL }, + { "colgroups", "list", NULL, NULL }, + { "collator", "string", NULL, NULL }, + { "columns", "list", NULL, NULL }, + { "columns", "list", NULL, NULL }, + { "dictionary", "int", "min=0", NULL }, + { "exclusive", "boolean", NULL, NULL }, + { "format", "string", "choices=[\"btree\"]", NULL }, + { "huffman_key", "string", NULL, NULL }, + { "huffman_value", "string", NULL, NULL }, + { "internal_item_max", "int", "min=0", NULL }, + { "internal_key_truncate", "boolean", NULL, NULL }, + { "internal_page_max", "int", "min=512B,max=512MB", NULL }, + { "key_format", "format", NULL, NULL }, + { "key_format", "format", NULL, NULL }, + { "key_gap", "int", "min=0", NULL }, + { "leaf_item_max", "int", "min=0", NULL }, + { "leaf_page_max", "int", "min=512B,max=512MB", NULL }, + { "lsm_bloom", "boolean", NULL, NULL }, + { "lsm_bloom_bit_count", "int", "min=2,max=1000", NULL }, + { "lsm_bloom_config", "string", NULL, NULL }, + { "lsm_bloom_hash_count", "int", "min=2,max=100", NULL }, + { "lsm_bloom_newest", "boolean", NULL, NULL }, + { "lsm_bloom_oldest", "boolean", NULL, NULL }, + { "lsm_chunk_size", "int", "min=512K,max=500MB", NULL }, + { "lsm_merge_max", "int", "min=2,max=100", NULL }, + { "prefix_compression", "boolean", NULL, NULL }, + { "source", "string", NULL, NULL }, + { "split_pct", "int", "min=25,max=100", NULL }, + { "type", "string", "choices=[\"file\",\"lsm\"]", NULL }, + { "value_format", "format", NULL, NULL }, + { "value_format", "format", NULL, NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -287,8 +291,8 @@ __wt_confdfl_session_drop = WT_CONFIG_CHECK __wt_confchk_session_drop[] = { - { "force", "boolean", NULL }, - { NULL, NULL, NULL } + { "force", "boolean", NULL, NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -297,7 +301,7 @@ __wt_confdfl_session_log_printf = WT_CONFIG_CHECK __wt_confchk_session_log_printf[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -308,19 +312,19 @@ __wt_confdfl_session_open_cursor = WT_CONFIG_CHECK __wt_confchk_session_open_cursor[] = { - { "append", "boolean", NULL }, - { "bulk", "string", NULL }, - { "checkpoint", "string", NULL }, - { "dump", "string", "choices=[\"hex\",\"print\"]" }, - { "next_random", "boolean", NULL }, - { "no_cache", "boolean", NULL }, - { "overwrite", "boolean", NULL }, - { "raw", "boolean", NULL }, - { "statistics", "boolean", NULL }, - { "statistics_clear", "boolean", NULL }, - { "statistics_fast", "boolean", NULL }, - { "target", "list", NULL }, - { NULL, NULL, NULL } + { "append", "boolean", NULL, NULL }, + { "bulk", "string", NULL, NULL }, + { "checkpoint", "string", NULL, NULL }, + { "dump", "string", "choices=[\"hex\",\"print\"]", NULL }, + { "next_random", "boolean", NULL, NULL }, + { "no_cache", "boolean", NULL, NULL }, + { "overwrite", "boolean", NULL, NULL }, + { "raw", "boolean", NULL, NULL }, + { "statistics", "boolean", NULL, NULL }, + { "statistics_clear", "boolean", NULL, NULL }, + { "statistics_fast", "boolean", NULL, NULL }, + { "target", "list", NULL, NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -330,8 +334,8 @@ __wt_confdfl_session_reconfigure = WT_CONFIG_CHECK __wt_confchk_session_reconfigure[] = { { "isolation", "string", "choices=[\"read-uncommitted\"," - "\"read-committed\",\"snapshot\"]" }, - { NULL, NULL, NULL } + "\"read-committed\",\"snapshot\"]", NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -340,7 +344,7 @@ __wt_confdfl_session_rename = WT_CONFIG_CHECK __wt_confchk_session_rename[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -349,7 +353,7 @@ __wt_confdfl_session_rollback_transaction = WT_CONFIG_CHECK __wt_confchk_session_rollback_transaction[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -358,8 +362,8 @@ __wt_confdfl_session_salvage = WT_CONFIG_CHECK __wt_confchk_session_salvage[] = { - { "force", "boolean", NULL }, - { NULL, NULL, NULL } + { "force", "boolean", NULL, NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -368,7 +372,7 @@ __wt_confdfl_session_truncate = WT_CONFIG_CHECK __wt_confchk_session_truncate[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -377,7 +381,7 @@ __wt_confdfl_session_upgrade = WT_CONFIG_CHECK __wt_confchk_session_upgrade[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -386,10 +390,10 @@ __wt_confdfl_session_verify = WT_CONFIG_CHECK __wt_confchk_session_verify[] = { - { "dump_address", "boolean", NULL }, - { "dump_blocks", "boolean", NULL }, - { "dump_pages", "boolean", NULL }, - { NULL, NULL, NULL } + { "dump_address", "boolean", NULL, NULL }, + { "dump_blocks", "boolean", NULL, NULL }, + { "dump_pages", "boolean", NULL, NULL }, + { NULL, NULL, NULL, NULL } }; const char * @@ -398,46 +402,42 @@ __wt_confdfl_table_meta = WT_CONFIG_CHECK __wt_confchk_table_meta[] = { - { "colgroups", "list", NULL }, - { "columns", "list", NULL }, - { "key_format", "format", NULL }, - { "value_format", "format", NULL }, - { NULL, NULL, NULL } + { "colgroups", "list", NULL, NULL }, + { "columns", "list", NULL, NULL }, + { "key_format", "format", NULL, NULL }, + { "value_format", "format", NULL, NULL }, + { NULL, NULL, NULL, NULL } }; const char * __wt_confdfl_wiredtiger_open = - "buffer_alignment=-1,cache_pool=,cache_pool_chunk=,cache_pool_quota=," - "cache_pool_size=,cache_size=100MB,create=0,direct_io=,error_prefix=," - "eviction_target=80,eviction_trigger=95,extensions=,hazard_max=1000," - "logging=0,lsm_merge=,multiprocess=0,session_max=50,sync=," - "transactional=,use_environment_priv=0,verbose="; + "buffer_alignment=-1,cache=(pool=,pool_chunk=,pool_min=,size=100MB)," + "create=0,direct_io=,error_prefix=,eviction_target=80," + "eviction_trigger=95,extensions=,hazard_max=1000,logging=0,lsm_merge=" + ",multiprocess=0,session_max=50,sync=,transactional=," + "use_environment_priv=0,verbose="; WT_CONFIG_CHECK __wt_confchk_wiredtiger_open[] = { - { "buffer_alignment", "int", "min=-1,max=1MB" }, - { "cache_pool", "string", NULL }, - { "cache_pool_chunk", "int", "min=1MB,max=10TB" }, - { "cache_pool_quota", "int", "min=1MB,max=10TB" }, - { "cache_pool_size", "int", "min=1MB,max=10TB" }, - { "cache_size", "int", "min=1MB,max=10TB" }, - { "create", "boolean", NULL }, - { "direct_io", "list", "choices=[\"data\",\"log\"]" }, - { "error_prefix", "string", NULL }, - { "eviction_target", "int", "min=10,max=99" }, - { "eviction_trigger", "int", "min=10,max=99" }, - { "extensions", "list", NULL }, - { "hazard_max", "int", "min=15" }, - { "logging", "boolean", NULL }, - { "lsm_merge", "boolean", NULL }, - { "multiprocess", "boolean", NULL }, - { "session_max", "int", "min=1" }, - { "sync", "boolean", NULL }, - { "transactional", "boolean", NULL }, - { "use_environment_priv", "boolean", NULL }, + { "buffer_alignment", "int", "min=-1,max=1MB", NULL }, + { "cache", "category", NULL, __wt_confchk_cache_subconfigs }, + { "create", "boolean", NULL, NULL }, + { "direct_io", "list", "choices=[\"data\",\"log\"]", NULL }, + { "error_prefix", "string", NULL, NULL }, + { "eviction_target", "int", "min=10,max=99", NULL }, + { "eviction_trigger", "int", "min=10,max=99", NULL }, + { "extensions", "list", NULL, NULL }, + { "hazard_max", "int", "min=15", NULL }, + { "logging", "boolean", NULL, NULL }, + { "lsm_merge", "boolean", NULL, NULL }, + { "multiprocess", "boolean", NULL, NULL }, + { "session_max", "int", "min=1", NULL }, + { "sync", "boolean", NULL, NULL }, + { "transactional", "boolean", NULL, NULL }, + { "use_environment_priv", "boolean", NULL, NULL }, { "verbose", "list", "choices=[\"block\",\"cache_pool\",\"ckpt\"," "\"evict\",\"evictserver\",\"fileops\",\"hazard\",\"lsm\",\"mutex\"," "\"read\",\"readserver\",\"reconcile\",\"salvage\",\"verify\"," - "\"write\"]" }, - { NULL, NULL, NULL } + "\"write\"]", NULL }, + { NULL, NULL, NULL, NULL } }; diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index 0c1b8895e37..159ebba1c14 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -526,7 +526,7 @@ __conn_config_file(WT_SESSION_IMPL *session, const char **cfg, WT_ITEM **cbufp) /* Check the configuration string. */ WT_ERR(__wt_config_check( - session, __wt_confchk_wiredtiger_open, cbuf->data)); + session, __wt_confchk_wiredtiger_open, cbuf->data, 0)); /* * The configuration file falls between the default configuration and @@ -577,7 +577,7 @@ __conn_config_env(WT_SESSION_IMPL *session, const char **cfg) /* Check the configuration string. */ WT_RET(__wt_config_check( - session, __wt_confchk_wiredtiger_open, env_config)); + session, __wt_confchk_wiredtiger_open, env_config, 0)); /* * The environment setting comes second-to-last: it overrides the @@ -830,8 +830,8 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, WT_ERR(__wt_connection_init(conn)); /* Check the configuration strings. */ - WT_ERR( - __wt_config_check(session, __wt_confchk_wiredtiger_open, config)); + WT_ERR(__wt_config_check( + session, __wt_confchk_wiredtiger_open, config, 0)); /* Get the database home. */ WT_ERR(__conn_home(session, home, cfg)); diff --git a/src/conn/conn_cache_pool.c b/src/conn/conn_cache_pool.c index deab10f5425..f73e605f01e 100644 --- a/src/conn/conn_cache_pool.c +++ b/src/conn/conn_cache_pool.c @@ -40,7 +40,7 @@ __wt_conn_cache_pool_config(WT_SESSION_IMPL *session, const char **cfg) pool_name = NULL; cp = NULL; - WT_RET(__wt_config_gets(session, cfg, "cache_pool", &cval)); + WT_RET(__wt_config_gets(session, cfg, "cache.pool", &cval)); if (cval.len <= 0) return (0); @@ -50,7 +50,7 @@ __wt_conn_cache_pool_config(WT_SESSION_IMPL *session, const char **cfg) if (__wt_process.cache_pool == NULL) { /* Create a cache pool. */ WT_ERR(__wt_config_gets( - session, cfg, "cache_pool_size", &cval)); + session, cfg, "cache.size", &cval)); if (cval.len <= 0) { WT_ERR_MSG(session, WT_ERROR, "Attempting to join a cache pool that does not " @@ -68,24 +68,24 @@ __wt_conn_cache_pool_config(WT_SESSION_IMPL *session, const char **cfg) "cache pool server", 0, &cp->cache_pool_cond)); WT_ERR(__wt_config_gets( - session, cfg, "cache_pool_chunk", &cval)); + session, cfg, "cache.pool_chunk", &cval)); if (cval.len > 0) cp->chunk = cval.val; else cp->chunk = WT_MAX( 50 * WT_MEGABYTE, cp->size / 20); WT_ERR(__wt_config_gets( - session, cfg, "cache_pool_quota", &cval)); + session, cfg, "cache.pool_min", &cval)); if (cval.len > 0) - cp->quota = cval.val; + cp->min = cval.val; else - cp->quota = cp->size / 2; + cp->min = cp->size / 2; __wt_process.cache_pool = cp; WT_VERBOSE_VOID(session, cache_pool, "Created cache pool %s. Size: %" PRIu64 - ", chunk size: %" PRIu64 ", quota: %" PRIu64, - cp->name, cp->size, cp->chunk, cp->quota); + ", chunk size: %" PRIu64 ", min: %" PRIu64, + cp->name, cp->size, cp->chunk, cp->min); } else if (!WT_STRING_MATCH( __wt_process.cache_pool->name, pool_name, strlen(pool_name))) WT_ERR_MSG(session, WT_ERROR, @@ -279,12 +279,12 @@ __cache_pool_balance(void) * which doesn't do the right thing at the moment. */ if (entry->cache_size == 0) { - added = cp->chunk; - entry->cache_size = cp->chunk; - cp->currently_used += cp->chunk; + added = cp->min; + entry->cache_size = cp->min; + cp->currently_used += cp->min; cache->cp_skip_count = WT_CACHE_POOL_BUMP_SKIPS; } else if (highest > 1 && - entry->cache_size < cp->quota && + entry->cache_size < cp->size && cache->bytes_inmem >= (entry->cache_size * cache->eviction_target) / 100 && cp->currently_used < cp->size && @@ -296,14 +296,14 @@ __cache_pool_balance(void) cache->cp_skip_count = WT_CACHE_POOL_BUMP_SKIPS; } else if (read_pressure < WT_CACHE_POOL_REDUCE_THRESHOLD && highest > 1 && - entry->cache_size > cp->chunk && + entry->cache_size > cp->min && cp->currently_used >= cp->size) { /* * If a connection isn't actively using it's assigned * cache and is assigned a reasonable amount - reduce * it. */ - added = -cp->chunk; + added = -WT_MIN(cp->chunk, entry->cache_size - cp->min); entry->cache_size -= cp->chunk; cp->currently_used -= cp->chunk; cache->cp_skip_count = WT_CACHE_POOL_REDUCE_SKIPS; diff --git a/src/include/api.h b/src/include/api.h index 6bf52aabe2b..c976b444a7b 100644 --- a/src/include/api.h +++ b/src/include/api.h @@ -289,7 +289,7 @@ struct __wt_connection_impl { const char *cfgvar[] = API_CONF_DEFAULTS(h, n, cfg); \ API_SESSION_INIT(s, h, n, cur, bt); \ WT_ERR(((cfg) != NULL) ? \ - __wt_config_check((s), __wt_confchk_##h##_##n, (cfg)) : 0) + __wt_config_check((s), __wt_confchk_##h##_##n, (cfg), 0) : 0) #define API_END(s) \ if ((s) != NULL) { \ diff --git a/src/include/cache.h b/src/include/cache.h index dbdbf8021d3..33ff57e5956 100644 --- a/src/include/cache.h +++ b/src/include/cache.h @@ -78,7 +78,7 @@ struct __wt_cache_pool { WT_CONDVAR *cache_pool_cond; const char *name; uint64_t size; - uint64_t quota; + uint64_t min; /* The minimum size per connection. */ uint64_t chunk; uint64_t currently_used; uint32_t flags; diff --git a/src/include/config.h b/src/include/config.h index 2ce280fbba1..0bd6232c576 100644 --- a/src/include/config.h +++ b/src/include/config.h @@ -26,4 +26,5 @@ struct __wt_config_check { const char *name; const char *type; const char *checks; + WT_CONFIG_CHECK *subconfigs; }; diff --git a/src/include/extern.h b/src/include/extern.h index 56f27374c7b..dba53b6c5a9 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -536,7 +536,8 @@ extern int __wt_config_subgets(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *value); extern int __wt_config_check(WT_SESSION_IMPL *session, WT_CONFIG_CHECK checks[], - const char *config); + const char *config, + size_t config_len); extern int __wt_config_collapse( WT_SESSION_IMPL *session, const char **cfg, const char **config_ret); @@ -560,6 +561,7 @@ extern WT_CONFIG_CHECK __wt_confchk_connection_load_extension[]; extern const char *__wt_confdfl_connection_open_session; extern WT_CONFIG_CHECK __wt_confchk_connection_open_session[]; extern const char *__wt_confdfl_connection_reconfigure; +extern WT_CONFIG_CHECK __wt_confchk_cache_subconfigs[]; extern WT_CONFIG_CHECK __wt_confchk_connection_reconfigure[]; extern const char *__wt_confdfl_cursor_close; extern WT_CONFIG_CHECK __wt_confchk_cursor_close[]; diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 02636ff7c88..e2284755302 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -992,20 +992,34 @@ struct __wt_connection { * * @param connection the connection handle * @configstart{connection.reconfigure, see dist/api_data.py} - * @config{cache_pool, name of a cache pool that is shared between - * databases.,a string; default empty.} - * @config{cache_pool_chunk, the granularity that a cache pool is shared - * out. Only valid if the cache_pool option is also specified..,an + * @config{cache, cache configuration setup.,a set of related + * configuration options defined below.}@config{cache.size, maximum heap + * memory to allocate for the cache.,an integer between 1MB and 10TB; + * default \c 100MB.}@config{cache.pool, name of a cache pool that is + * shared between databases.,a string; default + * empty.}@config{cache.pool_min, minimum amount of cache a connection + * in a cache pool can have.,an integer between 1MB and 10TB; default \c + * .}@config{cache.pool_chunk, the granularity that a cache pool is + * shared out. Only valid if the cache_pool option is also specified.,an * integer between 1MB and 10TB; default \c .} - * @config{cache_pool_quota, the maximum amount of the cache pool a - * single database can use. Only valid if the cache_pool option is also - * specified..,an integer between 1MB and 10TB; default \c .} - * @config{cache_pool_size, size of a cache pool that is shared between - * databases. Only valid if the cache_pool option is also specified. - * Must be specified if this connection may create the cache pool.,an - * integer between 1MB and 10TB; default \c .} - * @config{cache_size, maximum heap memory to allocate for the cache.,an - * integer between 1MB and 10TB; default \c 100MB.} + * @config{error_prefix, prefix string for error messages.,a string; + * default empty.} + * @config{eviction_target, continue evicting until the cache becomes + * less full than this (as a percentage). Must be less than \c + * eviction_trigger.,an integer between 10 and 99; default \c 80.} + * @config{eviction_trigger, trigger eviction when the cache becomes + * this full (as a percentage).,an integer between 10 and 99; default \c + * 95.} + * @config{verbose, enable messages for various events. Options are + * given as a list\, such as + * <code>"verbose=[evictserver\,read]"</code>.,a list\, with values + * chosen from the following options: \c "block"\, \c "cache_pool"\, \c + * "ckpt"\, \c "evict"\, \c "evictserver"\, \c "fileops"\, \c "hazard"\, + * \c "lsm"\, \c "mutex"\, \c "read"\, \c "readserver"\, \c + * "reconcile"\, \c "salvage"\, \c "verify"\, \c "write"; default + * empty.} + * @configend + * empty.} * @config{error_prefix, prefix string for error messages.,a string; * default empty.} * @config{eviction_target, continue evicting until the cache becomes @@ -1176,20 +1190,58 @@ struct __wt_connection { * I/O. By default\, a platform-specific alignment value is used (512 bytes on * Linux systems\, zero elsewhere).,an integer between -1 and 1MB; default \c * -1.} - * @config{cache_pool, name of a cache pool that is shared between databases.,a - * string; default empty.} - * @config{cache_pool_chunk, the granularity that a cache pool is shared out. - * Only valid if the cache_pool option is also specified..,an integer between - * 1MB and 10TB; default \c .} - * @config{cache_pool_quota, the maximum amount of the cache pool a single - * database can use. Only valid if the cache_pool option is also specified..,an - * integer between 1MB and 10TB; default \c .} - * @config{cache_pool_size, size of a cache pool that is shared between - * databases. Only valid if the cache_pool option is also specified. Must be - * specified if this connection may create the cache pool.,an integer between - * 1MB and 10TB; default \c .} - * @config{cache_size, maximum heap memory to allocate for the cache.,an integer - * between 1MB and 10TB; default \c 100MB.} + * @config{cache, cache configuration setup.,a set of related configuration + * options defined below.}@config{cache.size, maximum heap memory to allocate + * for the cache.,an integer between 1MB and 10TB; default \c + * 100MB.}@config{cache.pool, name of a cache pool that is shared between + * databases.,a string; default empty.}@config{cache.pool_min, minimum amount of + * cache a connection in a cache pool can have.,an integer between 1MB and 10TB; + * default \c .}@config{cache.pool_chunk, the granularity that a cache pool is + * shared out. Only valid if the cache_pool option is also specified.,an integer + * between 1MB and 10TB; default \c .} + * @config{create, create the database if it does not exist.,a boolean flag; + * default \c false.} + * @config{direct_io, Use \c O_DIRECT to access files. Options are given as a + * list\, such as <code>"direct_io=[data]"</code>.,a list\, with values chosen + * from the following options: \c "data"\, \c "log"; default empty.} + * @config{error_prefix, prefix string for error messages.,a string; default + * empty.} + * @config{eviction_target, continue evicting until the cache becomes less full + * than this (as a percentage). Must be less than \c eviction_trigger.,an + * integer between 10 and 99; default \c 80.} + * @config{eviction_trigger, trigger eviction when the cache becomes this full + * (as a percentage).,an integer between 10 and 99; default \c 95.} + * @config{extensions, list of shared library extensions to load (using dlopen). + * Optional values are passed as the \c config parameter to + * WT_CONNECTION::load_extension. Complex paths may require quoting\, for + * example\, <code>extensions=("/path/ext.so"="entry=my_entry")</code>.,a list + * of strings; default empty.} + * @config{hazard_max, maximum number of simultaneous hazard references per + * session handle.,an integer greater than or equal to 15; default \c 1000.} + * @config{logging, enable logging.,a boolean flag; default \c false.} + * @config{lsm_merge, merge LSM chunks where possible.,a boolean flag; default + * \c true.} + * @config{multiprocess, permit sharing between processes (will automatically + * start an RPC server for primary processes and use RPC for secondary + * processes). <b>Not yet supported in WiredTiger</b>.,a boolean flag; default + * \c false.} + * @config{session_max, maximum expected number of sessions (including server + * threads).,an integer greater than or equal to 1; default \c 50.} + * @config{sync, flush files to stable storage when closing or writing + * checkpoints.,a boolean flag; default \c true.} + * @config{transactional, support transactional semantics.,a boolean flag; + * default \c true.} + * @config{use_environment_priv, use the \c WIREDTIGER_CONFIG and \c + * WIREDTIGER_HOME environment variables regardless of whether or not the + * process is running with special privileges. See @ref home for more + * information.,a boolean flag; default \c false.} + * @config{verbose, enable messages for various events. Options are given as a + * list\, such as <code>"verbose=[evictserver\,read]"</code>.,a list\, with + * values chosen from the following options: \c "block"\, \c "cache_pool"\, \c + * "ckpt"\, \c "evict"\, \c "evictserver"\, \c "fileops"\, \c "hazard"\, \c + * "lsm"\, \c "mutex"\, \c "read"\, \c "readserver"\, \c "reconcile"\, \c + * "salvage"\, \c "verify"\, \c "write"; default empty.} + * @configend * @config{create, create the database if it does not exist.,a boolean flag; * default \c false.} * @config{direct_io, Use \c O_DIRECT to access files. Options are given as a diff --git a/test/bloom/test_bloom.c b/test/bloom/test_bloom.c index aa6100e542c..cba3fb474d4 100644 --- a/test/bloom/test_bloom.c +++ b/test/bloom/test_bloom.c @@ -138,7 +138,7 @@ int setup(void) * end so they can override "standard" configuration. */ snprintf(config, sizeof(config), - "create,error_prefix=\"%s\",cache_size=%" PRIu32 "MB,%s", + "create,error_prefix=\"%s\",cache.size=%" PRIu32 "MB,%s", g.progname, g.c_cache, g.config_open == NULL ? "" : g.config_open); if ((ret = wiredtiger_open(NULL, &event_handler, config, &conn)) != 0) diff --git a/test/fops/t.c b/test/fops/t.c index 538436da652..3691a7d7c29 100644 --- a/test/fops/t.c +++ b/test/fops/t.c @@ -144,7 +144,7 @@ wt_startup(char *config_open) char config_buf[128]; snprintf(config_buf, sizeof(config_buf), - "create,error_prefix=\"%s\",cache_size=5MB%s%s", + "create,error_prefix=\"%s\",cache.size=5MB%s%s", progname, config_open == NULL ? "" : ",", config_open == NULL ? "" : config_open); diff --git a/test/format/wts.c b/test/format/wts.c index 24532db56ff..d68c0a93c7d 100644 --- a/test/format/wts.c +++ b/test/format/wts.c @@ -74,7 +74,7 @@ wts_open(void) * the standard configuration. */ snprintf(config, sizeof(config), - "create,error_prefix=\"%s\",cache_size=%" PRIu32 "MB,sync=false," + "create,error_prefix=\"%s\",cache.size=%" PRIu32 "MB,sync=false," "extensions=[\"%s\",\"%s\", \"%s\"],%s", g.progname, g.c_cache, access(BZIP_PATH, R_OK) == 0 ? BZIP_PATH : "", diff --git a/test/suite/test_cache_pool.py b/test/suite/test_cache_pool.py index f402afb2b6b..68a0aff5a94 100644 --- a/test/suite/test_cache_pool.py +++ b/test/suite/test_cache_pool.py @@ -66,7 +66,7 @@ class test_cache_pool(wttest.WiredTigerTestCase): def openConnections( self, connections, - pool_opts = ',cache_pool=pool,cache_pool_size=200M,cache_pool_chunk=20M,cache_pool_quota=100M,', + pool_opts = ',cache=(pool=pool,size=200M,pool_chunk=20M,pool_min=60M),', extra_opts = '', add=0): if add == 0: @@ -180,7 +180,7 @@ class test_cache_pool(wttest.WiredTigerTestCase): nops = 1000 self.openConnections(['WT_TEST1', 'WT_TEST2']) - self.openConnections(['WT_TEST3'], add=1, pool_opts=',cache_size=50M') + self.openConnections(['WT_TEST3'], add=1, pool_opts=',cache=(size=50M)') for sess in self.sessions: sess.create(self.uri, "key_format=S,value_format=S") self.add_records(sess, 0, nops) @@ -189,7 +189,7 @@ class test_cache_pool(wttest.WiredTigerTestCase): # Test default config values def test_cache_pool9(self): nops = 1000 - self.openConnections(['WT_TEST1', 'WT_TEST2'], pool_opts=',cache_pool=pool,cache_pool_size=200M') + self.openConnections(['WT_TEST1', 'WT_TEST2'], pool_opts=',cache=(pool=pool,size=200M)') for sess in self.sessions: sess.create(self.uri, "key_format=S,value_format=S") diff --git a/test/suite/test_config01.py b/test/suite/test_config01.py index 7a47ec962c0..7cd6212c0e1 100644 --- a/test/suite/test_config01.py +++ b/test/suite/test_config01.py @@ -39,7 +39,7 @@ class test_config01(test_base03.test_base03): def setUpConnectionOpen(self, dir): wtopen_args = 'create' if hasattr(self, 'cache_size'): - wtopen_args += ',cache_size=' + str(self.cache_size) + wtopen_args += ',cache.size=' + str(self.cache_size) conn = wiredtiger.wiredtiger_open(dir, wtopen_args) self.pr(`conn`) return conn diff --git a/test/suite/test_config03.py b/test/suite/test_config03.py index 8e1a2007a4b..57e636e4983 100644 --- a/test/suite/test_config03.py +++ b/test/suite/test_config03.py @@ -97,6 +97,7 @@ class test_config03(test_base03.test_base03): if value == False: value = 'false' args += ',' + var + '=' + str(value) + args = args.replace('cache_size', 'cache.size') args += ',' self.pr('wiredtiger_open with args: ' + args) diff --git a/test/suite/test_config04.py b/test/suite/test_config04.py index fdda95e74dc..8b01482ce9c 100644 --- a/test/suite/test_config04.py +++ b/test/suite/test_config04.py @@ -80,7 +80,7 @@ class test_config04(wttest.WiredTigerTestCase): self.populate_and_check() def common_cache_size_test(self, sizestr, size): - self.common_test('cache_size=' + sizestr) + self.common_test('cache.size=' + sizestr) cursor = self.session.open_cursor('statistics:', None, None) cursor.set_key(wiredtiger.stat.cache_bytes_max) self.assertEqual(cursor.search(), 0) @@ -124,15 +124,15 @@ class test_config04(wttest.WiredTigerTestCase): def test_cache_too_small(self): self.assertRaisesWithMessage(wiredtiger.WiredTigerError, - lambda: wiredtiger.wiredtiger_open('.', 'create,cache_size=900000'), - "/Value too small for key 'cache_size' the minimum is/") + lambda: wiredtiger.wiredtiger_open('.', 'create,cache.size=900000'), + "/Value too small for key 'size' the minimum is/") def test_cache_too_large(self): T11 = 11 * self.T # 11 Terabytes - configstr = 'create,cache_size=' + str(T11) + configstr = 'create,cache.size=' + str(T11) self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: wiredtiger.wiredtiger_open('.', configstr), - "/Value too large for key 'cache_size' the maximum is/") + "/Value too large for key 'size' the maximum is/") def test_eviction(self): self.common_test('eviction_target=84,eviction_trigger=94') diff --git a/test/suite/test_cursor03.py b/test/suite/test_cursor03.py index b163188837e..1be62f5c79c 100644 --- a/test/suite/test_cursor03.py +++ b/test/suite/test_cursor03.py @@ -69,7 +69,7 @@ class test_cursor03(TestCursorTracker): return self.session.open_cursor(tablearg, None, 'append') def setUpConnectionOpen(self, dir): - wtopen_args = 'create,cache_size=' + str(self.cache_size); + wtopen_args = 'create,cache.size=' + str(self.cache_size) conn = wiredtiger.wiredtiger_open(dir, wtopen_args) self.pr(`conn`) return conn diff --git a/test/suite/test_schema03.py b/test/suite/test_schema03.py index dd66e3f4e0d..8d2b6f4cb7e 100644 --- a/test/suite/test_schema03.py +++ b/test/suite/test_schema03.py @@ -286,7 +286,7 @@ class test_schema03(wttest.WiredTigerTestCase): def setUpConnectionOpen(self, dir): conn = wiredtiger.wiredtiger_open(dir, - 'create,cache_size=100m,session_max=1000') + 'create,cache.size=100m,session_max=1000') self.pr(`conn`) return conn diff --git a/test/thread/t.c b/test/thread/t.c index 313f63d7420..138b883a67b 100644 --- a/test/thread/t.c +++ b/test/thread/t.c @@ -158,7 +158,7 @@ wt_connect(char *config_open) char config[128]; snprintf(config, sizeof(config), - "create,error_prefix=\"%s\",cache_size=5MB%s%s", + "create,error_prefix=\"%s\",cache.size=5MB%s%s", progname, config_open == NULL ? "" : ",", config_open == NULL ? "" : config_open); |