diff options
author | Alex Gorrod <alexg@wiredtiger.com> | 2014-03-12 17:26:49 +1100 |
---|---|---|
committer | Alex Gorrod <alexg@wiredtiger.com> | 2014-03-28 16:01:30 +1100 |
commit | 44f3e099f4e09af6bf82ce518ef1379201699471 (patch) | |
tree | cfb3d730c79b81f716e393dc2615b61d4779eaee | |
parent | 3d94b015fa37dc506c36a81837803d8cc5effb2e (diff) | |
download | mongo-44f3e099f4e09af6bf82ce518ef1379201699471.tar.gz |
Update shared cache configuration options:
* Change enable to enabled to match log setting.
* Return an error if there is a shared_cache configuration string
but it's not enabled and not explicit cache_size configuration.
-rw-r--r-- | dist/api_data.py | 2 | ||||
-rw-r--r-- | src/config/config_def.c | 6 | ||||
-rw-r--r-- | src/conn/conn_cache_pool.c | 21 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 4 |
4 files changed, 24 insertions, 9 deletions
diff --git a/dist/api_data.py b/dist/api_data.py index 412f0603efd..379c4ddd69b 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -300,7 +300,7 @@ connection_runtime_config = [ shared cache configuration options. A database should configure either a cache_size or a shared_cache not both''', type='category', subconfig=[ - Config('enable', 'false', r''' + Config('enabled', 'false', r''' whether the connection is using a shared cache''', type='boolean'), Config('chunk', '10MB', r''' diff --git a/src/config/config_def.c b/src/config/config_def.c index 2c01cac1a85..d49bba44364 100644 --- a/src/config/config_def.c +++ b/src/config/config_def.c @@ -25,7 +25,7 @@ static const WT_CONFIG_CHECK confchk_connection_open_session[] = { static const WT_CONFIG_CHECK confchk_shared_cache_subconfigs[] = { { "chunk", "int", "min=1MB,max=10TB", NULL }, - { "enable", "boolean", NULL, NULL }, + { "enabled", "boolean", NULL, NULL }, { "name", "string", NULL, NULL }, { "reserve", "int", NULL, NULL }, { "size", "int", "min=1MB,max=10TB", NULL }, @@ -322,7 +322,7 @@ static const WT_CONFIG_ENTRY config_entries[] = { { "connection.reconfigure", "cache_size=100MB,error_prefix=,eviction_dirty_target=80," "eviction_target=80,eviction_trigger=95,shared_cache=(chunk=10MB," - "enable=0,name=pool,reserve=0,size=500MB),statistics=none," + "enabled=0,name=pool,reserve=0,size=500MB),statistics=none," "verbose=", confchk_connection_reconfigure }, @@ -432,7 +432,7 @@ static const WT_CONFIG_ENTRY config_entries[] = { "eviction_dirty_target=80,eviction_target=80,eviction_trigger=95," "extensions=,file_extend=,hazard_max=1000,log=(archive=,enabled=0" ",file_max=100MB,path=\"\"),lsm_merge=,mmap=,multiprocess=0," - "session_max=100,shared_cache=(chunk=10MB,enable=0,name=pool," + "session_max=100,shared_cache=(chunk=10MB,enabled=0,name=pool," "reserve=0,size=500MB),statistics=none," "statistics_log=(path=\"WiredTigerStat.%d.%H\",sources=," "timestamp=\"%b %d %H:%M:%S\",wait=0),transaction_sync=fsync," diff --git a/src/conn/conn_cache_pool.c b/src/conn/conn_cache_pool.c index 34b6a51570b..dd0a8b6ea02 100644 --- a/src/conn/conn_cache_pool.c +++ b/src/conn/conn_cache_pool.c @@ -48,10 +48,25 @@ __wt_conn_cache_pool_config(WT_SESSION_IMPL *session, const char **cfg) reconfiguring = 1; else { /* Only setup if a shared cache was explicitly configured. */ - WT_RET(__wt_config_gets( - session, cfg, "shared_cache.enable", &cval)); - if (!cval.val) + ret = __wt_config_gets( + session, cfg, "shared_cache.enabled", &cval); + if (ret != 0 || !cval.val) { + /* + * If the user specified any shared_cache config but + * didn't enable it or provide an cache_size setting + * return an error - it was likely a mistake. + */ + if (__wt_config_gets(session, cfg, + "shared_cache", &cval) != WT_NOTFOUND && + __wt_config_gets(session, &cfg[1], + "cache_size", &cval) == WT_NOTFOUND) + WT_RET_MSG(session, EINVAL, + "Partial shared cache configuration " + "provided. Configuring a shared cache " + "requires that enabled is set to true"); + return (0); + } WT_RET_NOTFOUND_OK( __wt_config_gets(session, cfg, "shared_cache.name", &cval)); /* diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 6334bca2061..770d4862822 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -1236,7 +1236,7 @@ struct __wt_connection { * @config{shared_cache = (, shared cache configuration options. A * database should configure either a cache_size or a shared_cache not * both., a set of related configuration options defined below.} - * @config{ enable, whether the connection is + * @config{ enabled, whether the connection is * using a shared cache., a boolean flag; default \c false.} * @config{ chunk, the granularity that a shared * cache is redistributed., an integer between 1MB and 10TB; default \c @@ -1549,7 +1549,7 @@ struct __wt_connection { * @config{shared_cache = (, shared cache configuration options. A database * should configure either a cache_size or a shared_cache not both., a set of * related configuration options defined below.} - * @config{ enable, whether the connection is using a + * @config{ enabled, whether the connection is using a * shared cache., a boolean flag; default \c false.} * @config{ chunk, the granularity that a shared cache is * redistributed., an integer between 1MB and 10TB; default \c 10MB.} |