diff options
author | Alex Gorrod <alexg@wiredtiger.com> | 2012-11-07 10:02:26 +1100 |
---|---|---|
committer | Alex Gorrod <alexg@wiredtiger.com> | 2012-11-07 10:02:26 +1100 |
commit | 34b38436d0e9f5fefe9fd038c7efa91ff36b4626 (patch) | |
tree | b8987db6c08566189fe881cd717503b91aacc5a4 | |
parent | d02768b4174cbf988a1579b59c540e2c1e3e706c (diff) | |
download | mongo-34b38436d0e9f5fefe9fd038c7efa91ff36b4626.tar.gz |
Add partial implementation for sub-sets of configuration options.
-rw-r--r-- | dist/api_data.py | 29 | ||||
-rw-r--r-- | dist/config.py | 84 | ||||
-rw-r--r-- | src/config/config_def.c | 346 | ||||
-rw-r--r-- | src/include/config.h | 1 | ||||
-rw-r--r-- | src/include/extern.h | 2 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 109 |
6 files changed, 343 insertions, 228 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..251b9b3aaeb 100644 --- a/dist/config.py +++ b/dist/config.py @@ -23,6 +23,15 @@ def gettype(c): ctype = 'int' return ctype or 'string' +def getsubconfigstr(c): + '''Return a string indicating if an item has sub configuration''' + ctype = gettype(c) + if ctype == 'category': + return '__wt_confchk_' + c.name + '_subconfigs' + else: + return 'NULL' + + def typedesc(c): '''Descripe what type of value is expected for the given config item''' checks = c.flags @@ -52,6 +61,28 @@ def typedesc(c): desc += ' of strings' return desc +def categorydesc(c): + desc = 'a list of configuration settings' + desc += ' @subconfigstart{' + c.name + ', see dist/api_data.py}' + for subc in c.subconfig: + desc += ' ' + parseconfig(subc) + desc = desc.replace('@config', '@subconfig') + desc += ' @subconfigend' + return desc + +def parseconfig(c): + desc = textwrap.dedent(c.desc) + '.' + desc = desc.replace(',', '\\,') + default = '\\c ' + str(c.default) if c.default or gettype(c) == 'int' \ + else 'empty' + if gettype(c) == 'category': + tdesc = categorydesc(c) + ';\n' + else: + tdesc = typedesc(c) + '; default ' + default + '.' + tdesc = tdesc.replace(',', '\\,') + output = '@config{' + ','.join((c.name, desc, tdesc)) + '}' + return output + skip = False for line in open(f, 'r'): if skip: @@ -96,14 +127,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 +158,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) + ']') @@ -156,6 +184,33 @@ def get_default(c): else: return '' +created_subconfigs=set() + +def add_subconfig(c, tfile): + created_subconfigs.add(c.name) + subname = c.name.replace('.', '_') + tfile.write(''' +const char * +__wt_confdfl_%(name)s_subconfigs = +%(config)s; +''' % { + 'name' : subname, + 'config' : '\n'.join('\t"%s"' % line + for line in w.wrap(','.join('%s=%s' % (subc.name, get_default(subc)) + for subc in sorted(c.subconfig))) or [""]), +}) + 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)), +}) + for name in sorted(api_data.methods.keys()): ctype = api_data.methods[name].config name = name.replace('.', '_') @@ -169,13 +224,18 @@ __wt_confdfl_%(name)s = for line in w.wrap(','.join('%s=%s' % (c.name, get_default(c)) for c in sorted(ctype))) or [""]), }) + # Deal with subsets of configuration settings. + for c in sorted(ctype): + if gettype(c) == 'category' and c.name not in created_subconfigs: + add_subconfig(c, tfile) + # 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 +243,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/src/config/config_def.c b/src/config/config_def.c index 7da2d8fd419..cbed4f729c0 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,38 @@ __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=,error_prefix=,eviction_target=80,eviction_trigger=95,verbose="; + +const char * +__wt_confdfl_cache_subconfigs = + "pool=,pool_chunk=,pool_min=,size=100MB"; + +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 +117,7 @@ __wt_confdfl_cursor_close = WT_CONFIG_CHECK __wt_confchk_cursor_close[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -126,37 +133,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 +172,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 +188,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 +202,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 +215,7 @@ __wt_confdfl_session_close = WT_CONFIG_CHECK __wt_confchk_session_close[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -217,7 +224,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 +233,7 @@ __wt_confdfl_session_compact = WT_CONFIG_CHECK __wt_confchk_session_compact[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -243,42 +250,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 +294,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 +304,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 +315,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 +337,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 +347,7 @@ __wt_confdfl_session_rename = WT_CONFIG_CHECK __wt_confchk_session_rename[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -349,7 +356,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 +365,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 +375,7 @@ __wt_confdfl_session_truncate = WT_CONFIG_CHECK __wt_confchk_session_truncate[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -377,7 +384,7 @@ __wt_confdfl_session_upgrade = WT_CONFIG_CHECK __wt_confchk_session_upgrade[] = { - { NULL, NULL, NULL } + { NULL, NULL, NULL, NULL } }; const char * @@ -386,10 +393,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 +405,41 @@ __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=," + "buffer_alignment=-1,cache=,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/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..0e3908277e2 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -560,6 +560,8 @@ 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 const char *__wt_confdfl_cache_subconfigs; +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..61e5965d35c 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -992,20 +992,35 @@ 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 - * 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 list of configuration + * settings @subconfigstart{cache, see dist/api_data.py} + * @subconfig{size, maximum heap memory to allocate for the cache.,an + * integer between 1MB and 10TB; default \c 100MB.} @subconfig{pool, + * name of a cache pool that is shared between databases.,a string; + * default empty.} @subconfig{pool_min, minimum amount of cache a + * connection in a cache pool can have.,an integer between 1MB and 10TB; + * default \c .} @subconfig{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 .} + * @subconfigend; } + * @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 +1191,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 list of configuration settings + * @subconfigstart{cache, see dist/api_data.py} @subconfig{size, maximum heap + * memory to allocate for the cache.,an integer between 1MB and 10TB; default \c + * 100MB.} @subconfig{pool, name of a cache pool that is shared between + * databases.,a string; default empty.} @subconfig{pool_min, minimum amount of + * cache a connection in a cache pool can have.,an integer between 1MB and 10TB; + * default \c .} @subconfig{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 .} @subconfigend; } + * @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 |