diff options
author | Michael Cahill <mjc@wiredtiger.com> | 2014-10-16 10:19:24 +1100 |
---|---|---|
committer | Michael Cahill <mjc@wiredtiger.com> | 2014-10-16 10:19:24 +1100 |
commit | f4b199470480c973d3c1825d48784793d6cd58a9 (patch) | |
tree | f0e71a35951696d175c7858caeaee7583403d108 | |
parent | 2fb71dc122963f399436892ea432a9674b6159d9 (diff) | |
parent | d39b6a9f6c45c8f5a54281d57167b608ebea84b8 (diff) | |
download | mongo-f4b199470480c973d3c1825d48784793d6cd58a9.tar.gz |
Merge pull request #1274 from wiredtiger/basecfg-version
Basecfg version
-rw-r--r-- | dist/api_data.py | 210 | ||||
-rw-r--r-- | dist/filelist | 1 | ||||
-rw-r--r-- | dist/filelist.win | 1 | ||||
-rw-r--r-- | dist/s_string.ok | 1 | ||||
-rw-r--r-- | src/config/config_def.c | 206 | ||||
-rw-r--r-- | src/config/config_upgrade.c | 32 | ||||
-rw-r--r-- | src/conn/conn_api.c | 227 | ||||
-rw-r--r-- | src/docs/database-config.dox | 29 | ||||
-rw-r--r-- | src/docs/programming.dox | 3 | ||||
-rw-r--r-- | src/docs/upgrade.dox | 83 | ||||
-rw-r--r-- | src/include/config.h | 3 | ||||
-rw-r--r-- | src/include/extern.h | 1 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 3 | ||||
-rw-r--r-- | src/lsm/lsm_meta.c | 1 | ||||
-rw-r--r-- | test/suite/test_home.py (renamed from test/suite/test_gethome.py) | 32 | ||||
-rw-r--r-- | test/suite/test_isnew.py | 46 |
16 files changed, 673 insertions, 206 deletions
diff --git a/dist/api_data.py b/dist/api_data.py index 8e42ba72b88..d133c8a082c 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -356,6 +356,9 @@ connection_runtime_config = [ merge LSM chunks where possible''', type='boolean') ]), + Config('lsm_merge', 'true', r''' + merge LSM chunks where possible (deprecated)''', + type='boolean', undoc=True), Config('eviction', '', r''' eviction configuration options.''', type='category', subconfig=[ @@ -462,6 +465,88 @@ session_config = [ choices=['read-uncommitted', 'read-committed', 'snapshot']), ] +common_wiredtiger_open = [ + Config('buffer_alignment', '-1', r''' + in-memory alignment (in bytes) for buffers used for I/O. The + default value of -1 indicates a platform-specific alignment + value should be used (4KB on Linux systems, zero elsewhere)''', + min='-1', max='1MB'), + Config('checkpoint_sync', 'true', r''' + flush files to stable storage when closing or writing + checkpoints''', + type='boolean'), + Config('direct_io', '', r''' + Use \c O_DIRECT to access files. Options are given as a list, + such as <code>"direct_io=[data]"</code>. Configuring + \c direct_io requires care, see @ref + tuning_system_buffer_cache_direct_io for important warnings. + Including \c "data" will cause WiredTiger data files to use + \c O_DIRECT, including \c "log" will cause WiredTiger log files + to use \c O_DIRECT, and including \c "checkpoint" will cause + WiredTiger data files opened at a checkpoint (i.e: read only) to + use \c O_DIRECT''', + type='list', choices=['checkpoint', 'data', 'log']), + Config('extensions', '', r''' + list of shared library extensions to load (using dlopen). + Any values specified to an library extension are passed to + WT_CONNECTION::load_extension as the \c config parameter + (for example, + <code>extensions=(/path/ext.so={entry=my_entry})</code>)''', + type='list'), + Config('file_extend', '', r''' + file extension configuration. If set, extend files of the set + type in allocations of the set size, instead of a block at a + time as each new block is written. For example, + <code>file_extend=(data=16MB)</code>''', + type='list', choices=['data', 'log']), + Config('hazard_max', '1000', r''' + maximum number of simultaneous hazard pointers per session + handle''', + min='15'), + Config('log', '', r''' + enable logging''', + type='category', subconfig=[ + Config('archive', 'true', r''' + automatically archive unneeded log files''', + type='boolean'), + Config('enabled', 'false', r''' + enable logging subsystem''', + type='boolean'), + Config('file_max', '100MB', r''' + the maximum size of log files''', + min='100KB', max='2GB'), + Config('path', '""', r''' + the path to a directory into which the log files are written. + If the value is not an absolute path name, the files are created + relative to the database home'''), + ]), + Config('mmap', 'true', r''' + Use memory mapping to access files when possible''', + type='boolean'), + Config('multiprocess', 'false', r''' + 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>''', + type='boolean'), + Config('session_max', '100', r''' + maximum expected number of sessions (including server + threads)''', + min='1'), + Config('transaction_sync', '', r''' + how to sync log records when the transaction commits''', + type='category', subconfig=[ + Config('enabled', 'false', r''' + whether to sync the log on every commit by default, can + be overridden by the \c sync setting to + WT_SESSION::begin_transaction''', + type='boolean'), + Config('method', 'fsync', r''' + the method used to ensure log records are stable on disk, + see @ref tune_durability for more information''', + choices=['dsync', 'fsync', 'none']), + ]), +] + methods = { 'file.meta' : Method(file_meta), @@ -710,97 +795,68 @@ methods = { 'session.reconfigure' : Method(session_config), -'wiredtiger_open' : Method(connection_runtime_config + [ - Config('buffer_alignment', '-1', r''' - in-memory alignment (in bytes) for buffers used for I/O. The - default value of -1 indicates a platform-specific alignment - value should be used (4KB on Linux systems, zero elsewhere)''', - min='-1', max='1MB'), - Config('checkpoint_sync', 'true', r''' - flush files to stable storage when closing or writing - checkpoints''', +# There are 4 variants of the wiredtiger_open configurations. +# wiredtiger_open: +# Configuration values allowed in the application's configuration +# argument to the wiredtiger_open call. +# wiredtiger_open_basecfg: +# Configuration values allowed in the WiredTiger.basecfg file (remove +# creation-specific configuration strings and add a version string). +# wiredtiger_open_usercfg: +# Configuration values allowed in the WiredTiger.config file (remove +# creation-specific configuration strings). +# wiredtiger_open_all: +# All of the above configuration values combined +'wiredtiger_open' : Method( + connection_runtime_config + + common_wiredtiger_open + [ + Config('config_base', 'true', r''' + write the base configuration file if creating the database, + see @ref config_base for more information''', type='boolean'), Config('create', 'false', r''' create the database if it does not exist''', type='boolean'), - Config('direct_io', '', r''' - Use \c O_DIRECT to access files. Options are given as a list, - such as <code>"direct_io=[data]"</code>. Configuring - \c direct_io requires care, see @ref - tuning_system_buffer_cache_direct_io for important warnings. - Including \c "data" will cause WiredTiger data files to use - \c O_DIRECT, including \c "log" will cause WiredTiger log files - to use \c O_DIRECT, and including \c "checkpoint" will cause - WiredTiger data files opened at a checkpoint (i.e: read only) to - use \c O_DIRECT''', - type='list', choices=['checkpoint', 'data', 'log']), Config('exclusive', 'false', r''' fail if the database already exists, generally used with the \c create option''', type='boolean'), - Config('extensions', '', r''' - list of shared library extensions to load (using dlopen). - Any values specified to an library extension are passed to - WT_CONNECTION::load_extension as the \c config parameter - (for example, - <code>extensions=(/path/ext.so={entry=my_entry})</code>)''', - type='list'), - Config('file_extend', '', r''' - file extension configuration. If set, extend files of the set - type in allocations of the set size, instead of a block at a - time as each new block is written. For example, - <code>file_extend=(data=16MB)</code>''', - type='list', choices=['data', 'log']), - Config('hazard_max', '1000', r''' - maximum number of simultaneous hazard pointers per session - handle''', - min='15'), - Config('log', '', r''' - enable logging''', - type='category', subconfig=[ - Config('archive', 'true', r''' - automatically archive unneeded log files''', - type='boolean'), - Config('enabled', 'false', r''' - enable logging subsystem''', - type='boolean'), - Config('file_max', '100MB', r''' - the maximum size of log files''', - min='100KB', max='2GB'), - Config('path', '""', r''' - the path to a directory into which the log files are written. - If the value is not an absolute path name, the files are created - relative to the database home'''), - ]), - Config('mmap', 'true', r''' - Use memory mapping to access files when possible''', + Config('use_environment_priv', 'false', r''' + 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''', type='boolean'), - Config('multiprocess', 'false', r''' - 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>''', +]), +'wiredtiger_open_basecfg' : Method( + connection_runtime_config + + common_wiredtiger_open + [ + Config('version', '(major=0,minor=0)', r''' + the file version'''), +]), +'wiredtiger_open_usercfg' : Method( + connection_runtime_config + + common_wiredtiger_open +), +'wiredtiger_open_all' : Method( + connection_runtime_config + + common_wiredtiger_open + [ + Config('config_base', 'true', r''' + write the base configuration file if creating the database, + see @ref config_base for more information''', + type='boolean'), + Config('create', 'false', r''' + create the database if it does not exist''', + type='boolean'), + Config('exclusive', 'false', r''' + fail if the database already exists, generally used with the + \c create option''', type='boolean'), - Config('session_max', '100', r''' - maximum expected number of sessions (including server - threads)''', - min='1'), - Config('transaction_sync', '', r''' - how to sync log records when the transaction commits''', - type='category', subconfig=[ - Config('enabled', 'false', r''' - whether to sync the log on every commit by default, can - be overridden by the \c sync setting to - WT_SESSION::begin_transaction''', - type='boolean'), - Config('method', 'fsync', r''' - the method used to ensure log records are stable on disk, - see @ref tune_durability for more information''', - choices=['dsync', 'fsync', 'none']), - ]), Config('use_environment_priv', 'false', r''' 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''', type='boolean'), + Config('version', '(major=0,minor=0)', r''' + the file version'''), ]), } diff --git a/dist/filelist b/dist/filelist index f7fa0d5dcb7..a69a551ef04 100644 --- a/dist/filelist +++ b/dist/filelist @@ -56,6 +56,7 @@ src/config/config_collapse.c src/config/config_concat.c src/config/config_def.c src/config/config_ext.c +src/config/config_upgrade.c src/conn/api_strerror.c src/conn/api_version.c src/conn/conn_api.c diff --git a/dist/filelist.win b/dist/filelist.win index 517af1f4e07..bd8be9728ca 100644 --- a/dist/filelist.win +++ b/dist/filelist.win @@ -56,6 +56,7 @@ src/config/config_collapse.c src/config/config_concat.c src/config/config_def.c src/config/config_ext.c +src/config/config_upgrade.c src/conn/api_strerror.c src/conn/api_version.c src/conn/conn_api.c diff --git a/dist/s_string.ok b/dist/s_string.ok index 0cbf72060b0..13d8b7bb696 100644 --- a/dist/s_string.ok +++ b/dist/s_string.ok @@ -1088,6 +1088,7 @@ uri uri's usecs usedp +usercfg usr utf util diff --git a/src/config/config_def.c b/src/config/config_def.c index 5a08945d19e..7a8310a1512 100644 --- a/src/config/config_def.c +++ b/src/config/config_def.c @@ -92,6 +92,7 @@ static const WT_CONFIG_CHECK confchk_connection_reconfigure[] = { { "eviction_trigger", "int", "min=10,max=99", NULL }, { "lsm_manager", "category", NULL, confchk_lsm_manager_subconfigs }, + { "lsm_merge", "boolean", NULL, NULL }, { "shared_cache", "category", NULL, confchk_shared_cache_subconfigs }, { "statistics", "list", @@ -310,6 +311,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open[] = { { "checkpoint", "category", NULL, confchk_checkpoint_subconfigs }, { "checkpoint_sync", "boolean", NULL, NULL }, + { "config_base", "boolean", NULL, NULL }, { "create", "boolean", NULL, NULL }, { "direct_io", "list", "choices=[\"checkpoint\",\"data\",\"log\"]", @@ -326,6 +328,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open[] = { { "log", "category", NULL, confchk_log_subconfigs }, { "lsm_manager", "category", NULL, confchk_lsm_manager_subconfigs }, + { "lsm_merge", "boolean", NULL, NULL }, { "mmap", "boolean", NULL, NULL }, { "multiprocess", "boolean", NULL, NULL }, { "session_max", "int", "min=1", NULL }, @@ -349,6 +352,144 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open[] = { { NULL, NULL, NULL, NULL } }; +static const WT_CONFIG_CHECK confchk_wiredtiger_open_all[] = { + { "async", "category", NULL, confchk_async_subconfigs }, + { "buffer_alignment", "int", "min=-1,max=1MB", NULL }, + { "cache_size", "int", "min=1MB,max=10TB", NULL }, + { "checkpoint", "category", NULL, + confchk_checkpoint_subconfigs }, + { "checkpoint_sync", "boolean", NULL, NULL }, + { "config_base", "boolean", NULL, NULL }, + { "create", "boolean", NULL, NULL }, + { "direct_io", "list", + "choices=[\"checkpoint\",\"data\",\"log\"]", + NULL }, + { "error_prefix", "string", NULL, NULL }, + { "eviction", "category", NULL, confchk_eviction_subconfigs }, + { "eviction_dirty_target", "int", "min=10,max=99", NULL }, + { "eviction_target", "int", "min=10,max=99", NULL }, + { "eviction_trigger", "int", "min=10,max=99", NULL }, + { "exclusive", "boolean", NULL, NULL }, + { "extensions", "list", NULL, NULL }, + { "file_extend", "list", "choices=[\"data\",\"log\"]", NULL }, + { "hazard_max", "int", "min=15", NULL }, + { "log", "category", NULL, confchk_log_subconfigs }, + { "lsm_manager", "category", NULL, + confchk_lsm_manager_subconfigs }, + { "lsm_merge", "boolean", NULL, NULL }, + { "mmap", "boolean", NULL, NULL }, + { "multiprocess", "boolean", NULL, NULL }, + { "session_max", "int", "min=1", NULL }, + { "shared_cache", "category", NULL, + confchk_shared_cache_subconfigs }, + { "statistics", "list", + "choices=[\"all\",\"fast\",\"none\",\"clear\"]", + NULL }, + { "statistics_log", "category", NULL, + confchk_statistics_log_subconfigs }, + { "transaction_sync", "category", NULL, + confchk_transaction_sync_subconfigs }, + { "use_environment_priv", "boolean", NULL, NULL }, + { "verbose", "list", + "choices=[\"api\",\"block\",\"checkpoint\",\"compact\",\"evict\"" + ",\"evictserver\",\"fileops\",\"log\",\"lsm\",\"metadata\"," + "\"mutex\",\"overflow\",\"read\",\"reconcile\",\"recovery\"," + "\"salvage\",\"shared_cache\",\"split\",\"temporary\",\"verify\"," + "\"version\",\"write\"]", + NULL }, + { "version", "string", NULL, NULL }, + { NULL, NULL, NULL, NULL } +}; + +static const WT_CONFIG_CHECK confchk_wiredtiger_open_basecfg[] = { + { "async", "category", NULL, confchk_async_subconfigs }, + { "buffer_alignment", "int", "min=-1,max=1MB", NULL }, + { "cache_size", "int", "min=1MB,max=10TB", NULL }, + { "checkpoint", "category", NULL, + confchk_checkpoint_subconfigs }, + { "checkpoint_sync", "boolean", NULL, NULL }, + { "direct_io", "list", + "choices=[\"checkpoint\",\"data\",\"log\"]", + NULL }, + { "error_prefix", "string", NULL, NULL }, + { "eviction", "category", NULL, confchk_eviction_subconfigs }, + { "eviction_dirty_target", "int", "min=10,max=99", NULL }, + { "eviction_target", "int", "min=10,max=99", NULL }, + { "eviction_trigger", "int", "min=10,max=99", NULL }, + { "extensions", "list", NULL, NULL }, + { "file_extend", "list", "choices=[\"data\",\"log\"]", NULL }, + { "hazard_max", "int", "min=15", NULL }, + { "log", "category", NULL, confchk_log_subconfigs }, + { "lsm_manager", "category", NULL, + confchk_lsm_manager_subconfigs }, + { "lsm_merge", "boolean", NULL, NULL }, + { "mmap", "boolean", NULL, NULL }, + { "multiprocess", "boolean", NULL, NULL }, + { "session_max", "int", "min=1", NULL }, + { "shared_cache", "category", NULL, + confchk_shared_cache_subconfigs }, + { "statistics", "list", + "choices=[\"all\",\"fast\",\"none\",\"clear\"]", + NULL }, + { "statistics_log", "category", NULL, + confchk_statistics_log_subconfigs }, + { "transaction_sync", "category", NULL, + confchk_transaction_sync_subconfigs }, + { "verbose", "list", + "choices=[\"api\",\"block\",\"checkpoint\",\"compact\",\"evict\"" + ",\"evictserver\",\"fileops\",\"log\",\"lsm\",\"metadata\"," + "\"mutex\",\"overflow\",\"read\",\"reconcile\",\"recovery\"," + "\"salvage\",\"shared_cache\",\"split\",\"temporary\",\"verify\"," + "\"version\",\"write\"]", + NULL }, + { "version", "string", NULL, NULL }, + { NULL, NULL, NULL, NULL } +}; + +static const WT_CONFIG_CHECK confchk_wiredtiger_open_usercfg[] = { + { "async", "category", NULL, confchk_async_subconfigs }, + { "buffer_alignment", "int", "min=-1,max=1MB", NULL }, + { "cache_size", "int", "min=1MB,max=10TB", NULL }, + { "checkpoint", "category", NULL, + confchk_checkpoint_subconfigs }, + { "checkpoint_sync", "boolean", NULL, NULL }, + { "direct_io", "list", + "choices=[\"checkpoint\",\"data\",\"log\"]", + NULL }, + { "error_prefix", "string", NULL, NULL }, + { "eviction", "category", NULL, confchk_eviction_subconfigs }, + { "eviction_dirty_target", "int", "min=10,max=99", NULL }, + { "eviction_target", "int", "min=10,max=99", NULL }, + { "eviction_trigger", "int", "min=10,max=99", NULL }, + { "extensions", "list", NULL, NULL }, + { "file_extend", "list", "choices=[\"data\",\"log\"]", NULL }, + { "hazard_max", "int", "min=15", NULL }, + { "log", "category", NULL, confchk_log_subconfigs }, + { "lsm_manager", "category", NULL, + confchk_lsm_manager_subconfigs }, + { "lsm_merge", "boolean", NULL, NULL }, + { "mmap", "boolean", NULL, NULL }, + { "multiprocess", "boolean", NULL, NULL }, + { "session_max", "int", "min=1", NULL }, + { "shared_cache", "category", NULL, + confchk_shared_cache_subconfigs }, + { "statistics", "list", + "choices=[\"all\",\"fast\",\"none\",\"clear\"]", + NULL }, + { "statistics_log", "category", NULL, + confchk_statistics_log_subconfigs }, + { "transaction_sync", "category", NULL, + confchk_transaction_sync_subconfigs }, + { "verbose", "list", + "choices=[\"api\",\"block\",\"checkpoint\",\"compact\",\"evict\"" + ",\"evictserver\",\"fileops\",\"log\",\"lsm\",\"metadata\"," + "\"mutex\",\"overflow\",\"read\",\"reconcile\",\"recovery\"," + "\"salvage\",\"shared_cache\",\"split\",\"temporary\",\"verify\"," + "\"version\",\"write\"]", + NULL }, + { NULL, NULL, NULL, NULL } +}; + static const WT_CONFIG_ENTRY config_entries[] = { { "colgroup.meta", "app_metadata=,columns=,source=,type=file", @@ -392,7 +533,7 @@ static const WT_CONFIG_ENTRY config_entries[] = { "checkpoint=(log_size=0,name=\"WiredTigerCheckpoint\",wait=0)," "error_prefix=,eviction=(threads_max=1,threads_min=1)," "eviction_dirty_target=80,eviction_target=80,eviction_trigger=95," - "lsm_manager=(merge=,worker_thread_max=4)," + "lsm_manager=(merge=,worker_thread_max=4),lsm_merge=," "shared_cache=(chunk=10MB,name=,reserve=0,size=500MB)," "statistics=none,statistics_log=(on_close=0," "path=\"WiredTigerStat.%d.%H\",sources=," @@ -503,12 +644,13 @@ static const WT_CONFIG_ENTRY config_entries[] = { { "wiredtiger_open", "async=(enabled=0,ops_max=1024,threads=2),buffer_alignment=-1," "cache_size=100MB,checkpoint=(log_size=0," - "name=\"WiredTigerCheckpoint\",wait=0),checkpoint_sync=,create=0," - "direct_io=,error_prefix=,eviction=(threads_max=1,threads_min=1)," - "eviction_dirty_target=80,eviction_target=80,eviction_trigger=95," - "exclusive=0,extensions=,file_extend=,hazard_max=1000," - "log=(archive=,enabled=0,file_max=100MB,path=\"\")," - "lsm_manager=(merge=,worker_thread_max=4),mmap=,multiprocess=0," + "name=\"WiredTigerCheckpoint\",wait=0),checkpoint_sync=," + "config_base=,create=0,direct_io=,error_prefix=," + "eviction=(threads_max=1,threads_min=1),eviction_dirty_target=80," + "eviction_target=80,eviction_trigger=95,exclusive=0,extensions=," + "file_extend=,hazard_max=1000,log=(archive=,enabled=0," + "file_max=100MB,path=\"\"),lsm_manager=(merge=," + "worker_thread_max=4),lsm_merge=,mmap=,multiprocess=0," "session_max=100,shared_cache=(chunk=10MB,name=,reserve=0," "size=500MB),statistics=none,statistics_log=(on_close=0," "path=\"WiredTigerStat.%d.%H\",sources=," @@ -516,6 +658,56 @@ static const WT_CONFIG_ENTRY config_entries[] = { ",method=fsync),use_environment_priv=0,verbose=", confchk_wiredtiger_open }, + { "wiredtiger_open_all", + "async=(enabled=0,ops_max=1024,threads=2),buffer_alignment=-1," + "cache_size=100MB,checkpoint=(log_size=0," + "name=\"WiredTigerCheckpoint\",wait=0),checkpoint_sync=," + "config_base=,create=0,direct_io=,error_prefix=," + "eviction=(threads_max=1,threads_min=1),eviction_dirty_target=80," + "eviction_target=80,eviction_trigger=95,exclusive=0,extensions=," + "file_extend=,hazard_max=1000,log=(archive=,enabled=0," + "file_max=100MB,path=\"\"),lsm_manager=(merge=," + "worker_thread_max=4),lsm_merge=,mmap=,multiprocess=0," + "session_max=100,shared_cache=(chunk=10MB,name=,reserve=0," + "size=500MB),statistics=none,statistics_log=(on_close=0," + "path=\"WiredTigerStat.%d.%H\",sources=," + "timestamp=\"%b %d %H:%M:%S\",wait=0),transaction_sync=(enabled=0" + ",method=fsync),use_environment_priv=0,verbose=,version=(major=0," + "minor=0)", + confchk_wiredtiger_open_all + }, + { "wiredtiger_open_basecfg", + "async=(enabled=0,ops_max=1024,threads=2),buffer_alignment=-1," + "cache_size=100MB,checkpoint=(log_size=0," + "name=\"WiredTigerCheckpoint\",wait=0),checkpoint_sync=," + "direct_io=,error_prefix=,eviction=(threads_max=1,threads_min=1)," + "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_manager=(merge=," + "worker_thread_max=4),lsm_merge=,mmap=,multiprocess=0," + "session_max=100,shared_cache=(chunk=10MB,name=,reserve=0," + "size=500MB),statistics=none,statistics_log=(on_close=0," + "path=\"WiredTigerStat.%d.%H\",sources=," + "timestamp=\"%b %d %H:%M:%S\",wait=0),transaction_sync=(enabled=0" + ",method=fsync),verbose=,version=(major=0,minor=0)", + confchk_wiredtiger_open_basecfg + }, + { "wiredtiger_open_usercfg", + "async=(enabled=0,ops_max=1024,threads=2),buffer_alignment=-1," + "cache_size=100MB,checkpoint=(log_size=0," + "name=\"WiredTigerCheckpoint\",wait=0),checkpoint_sync=," + "direct_io=,error_prefix=,eviction=(threads_max=1,threads_min=1)," + "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_manager=(merge=," + "worker_thread_max=4),lsm_merge=,mmap=,multiprocess=0," + "session_max=100,shared_cache=(chunk=10MB,name=,reserve=0," + "size=500MB),statistics=none,statistics_log=(on_close=0," + "path=\"WiredTigerStat.%d.%H\",sources=," + "timestamp=\"%b %d %H:%M:%S\",wait=0),transaction_sync=(enabled=0" + ",method=fsync),verbose=", + confchk_wiredtiger_open_usercfg + }, { NULL, NULL, NULL } }; diff --git a/src/config/config_upgrade.c b/src/config/config_upgrade.c new file mode 100644 index 00000000000..24297df839b --- /dev/null +++ b/src/config/config_upgrade.c @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2008-2014 WiredTiger, Inc. + * All rights reserved. + * + * See the file LICENSE for redistribution information. + */ + +#include "wt_internal.h" + +/* + * __wt_config_upgrade -- + * Upgrade a configuration string by appended the replacement version. + */ +int +__wt_config_upgrade(WT_SESSION_IMPL *session, WT_ITEM *buf) +{ + WT_CONFIG_ITEM v; + const char *config; + + config = buf->data; + + /* + * wiredtiger_open: + * lsm_merge=boolean -> lsm_manager=(merge=boolean) + */ + if (__wt_config_getones( + session, config, "lsm_merge", &v) != WT_NOTFOUND) + WT_RET(__wt_buf_catfmt(session, buf, + ",lsm_manager=(merge=%s)", v.val ? "true" : "false")); + + return (0); +} diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index 6c2a536cb92..d33412ba34b 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -714,27 +714,66 @@ __conn_config_append(const char *cfg[], const char *config) } /* + * __conn_config_check_version -- + * Check if a configuration version isn't compatible. + */ +static int +__conn_config_check_version(WT_SESSION_IMPL *session, const char *config) +{ + WT_CONFIG_ITEM vmajor, vminor; + + /* + * Version numbers aren't included in all configuration strings, but + * we check all of them just in case. Ignore configurations without + * a version. + */ + if (__wt_config_getones( + session, config, "version.major", &vmajor) == WT_NOTFOUND) + return (0); + WT_RET(__wt_config_getones(session, config, "version.minor", &vminor)); + + if (vmajor.val > WIREDTIGER_VERSION_MAJOR || + (vmajor.val == WIREDTIGER_VERSION_MAJOR && + vminor.val > WIREDTIGER_VERSION_MINOR)) + WT_RET_MSG(session, ENOTSUP, + "WiredTiger configuration is from an incompatible release " + "of the WiredTiger engine"); + + return (0); +} + +/* * __conn_config_file -- - * Read in any WiredTiger_config file in the home directory. + * Read WiredTiger config files from the home directory. */ static int __conn_config_file(WT_SESSION_IMPL *session, - const char *filename, const char **cfg, WT_ITEM *cbuf) + const char *filename, int is_user, const char **cfg, WT_ITEM *cbuf) { + WT_CONNECTION_IMPL *conn; WT_DECL_RET; WT_FH *fh; size_t len; wt_off_t size; int exist, quoted; - uint8_t *p, *t; + char *p, *t; + conn = S2C(session); fh = NULL; - /* Check for an optional configuration file. */ + /* Configuration files are always optional. */ WT_RET(__wt_exist(session, filename, &exist)); if (!exist) return (0); + /* + * The base configuration should not exist if we are creating this + * database. + */ + if (!is_user && conn->is_new) + WT_RET_MSG(session, EINVAL, + "%s exists before database creation", filename); + /* Open the configuration file. */ WT_RET(__wt_open(session, filename, 0, 0, 0, &fh)); WT_ERR(__wt_filesize(session, fh, &size)); @@ -831,14 +870,18 @@ __conn_config_file(WT_SESSION_IMPL *session, } } *t = '\0'; + cbuf->size = WT_PTRDIFF(t, cbuf->data); -#if 0 - fprintf(stderr, "file config: {%s}\n", (const char *)cbuf->data); -#endif + /* Check any version. */ + WT_ERR(__conn_config_check_version(session, cbuf->data)); - /* Check the configuration string. */ - WT_ERR(__wt_config_check(session, - WT_CONFIG_REF(session, wiredtiger_open), cbuf->data, 0)); + /* Upgrade the configuration string. */ + WT_ERR(__wt_config_upgrade(session, cbuf)); + + /* Check the configuration information. */ + WT_ERR(__wt_config_check(session, is_user ? + WT_CONFIG_REF(session, wiredtiger_open_usercfg) : + WT_CONFIG_REF(session, wiredtiger_open_basecfg), cbuf->data, 0)); /* Append it to the stack. */ __conn_config_append(cfg, cbuf->data); @@ -853,14 +896,18 @@ err: if (fh != NULL) * Read configuration from an environment variable, if set. */ static int -__conn_config_env(WT_SESSION_IMPL *session, const char *cfg[]) +__conn_config_env(WT_SESSION_IMPL *session, const char *cfg[], WT_ITEM *cbuf) { WT_CONFIG_ITEM cval; const char *env_config; + size_t len; - if ((env_config = getenv("WIREDTIGER_CONFIG")) == NULL || - strlen(env_config) == 0) + if ((env_config = getenv("WIREDTIGER_CONFIG")) == NULL) return (0); + len = strlen(env_config); + if (len == 0) + return (0); + WT_RET(__wt_buf_set(session, cbuf, env_config, len)); /* * Security stuff: @@ -874,11 +921,19 @@ __conn_config_env(WT_SESSION_IMPL *session, const char *cfg[]) "WIREDTIGER_CONFIG environment variable set but process " "lacks privileges to use that environment variable"); - /* Check the configuration string. */ + /* Check any version. */ + WT_RET(__conn_config_check_version(session, env_config)); + + /* Upgrade the configuration string. */ + WT_RET(__wt_config_upgrade(session, cbuf)); + + /* Check the configuration information. */ WT_RET(__wt_config_check(session, WT_CONFIG_REF(session, wiredtiger_open), env_config, 0)); + /* Append it to the stack. */ __conn_config_append(cfg, env_config); + return (0); } @@ -1189,16 +1244,32 @@ __wt_verbose_config(WT_SESSION_IMPL *session, const char *cfg[]) */ static int __conn_write_config( - WT_SESSION_IMPL *session, const char *filename, const char *config) + WT_SESSION_IMPL *session, const char *filename, const char *cfg[]) { FILE *fp; WT_CONFIG parser; - WT_CONFIG_ITEM ckey, cval; + WT_CONFIG_ITEM k, v; WT_DECL_RET; char *path; - /* If there is no configuration, don't bother creating an empty file. */ - if (config == NULL) + /* + * We were passed an array of configuration strings where slot 0 is all + * all possible values and the second and subsequent slots are changes + * specified by the application during open (using the wiredtiger_open + * configuration string, an environment variable, or user-configuration + * file). The base configuration file contains all changes to default + * settings made at create, and we include the user-configuration file + * in that list, even though we don't expect it to change. Of course, + * an application could leave that file as it is right now and not + * remove a configuration we need, but applications can also guarantee + * all database users specify consistent environment variables and + * wiredtiger_open configuration arguments, and if we protect against + * those problems, might as well include the application's configuration + * file as well. + * + * If there is no configuration, don't bother creating an empty file. + */ + if (cfg[1] == NULL) return (0); WT_RET(__wt_filename(session, filename, &path)); @@ -1215,23 +1286,41 @@ __conn_write_config( "# to store persistent database settings. Instead of changing\n" "# these settings, set a WIREDTIGER_CONFIG environment variable\n" "# or create a WiredTiger.config file to override them."); - WT_ERR(__wt_config_init(session, &parser, config)); - while ((ret = __wt_config_next(&parser, &ckey, &cval)) == 0) { - /* Skip "create". */ - if (WT_STRING_MATCH("create", ckey.str, ckey.len)) - continue; - /* Fix quoting for non-trivial settings. */ - if (cval.type == WT_CONFIG_ITEM_STRING) { - --cval.str; - cval.len += 2; + fprintf(fp, "version=(major=%d,minor=%d)\n\n", + WIREDTIGER_VERSION_MAJOR, WIREDTIGER_VERSION_MINOR); + + /* + * We want the list of defaults that have been changed, that is, if the + * application didn't somehow configure a setting, we don't write out a + * default value, so future releases may silently migrate to new default + * values. + */ + while (*++cfg != NULL) { + WT_ERR(__wt_config_init( session, + &parser, WT_CONFIG_BASE(session, wiredtiger_open_basecfg))); + while ((ret = __wt_config_next(&parser, &k, &v)) == 0) { + if ((ret = + __wt_config_getone(session, *cfg, &k, &v)) == 0) { + /* Fix quoting for non-trivial settings. */ + if (v.type == WT_CONFIG_ITEM_STRING) { + --v.str; + v.len += 2; + } + fprintf(fp, "%.*s=%.*s\n", + (int)k.len, k.str, (int)v.len, v.str); + } + WT_ERR_NOTFOUND_OK(ret); } - fprintf(fp, "%.*s=%.*s\n", - (int)ckey.len, ckey.str, (int)cval.len, cval.str); + WT_ERR_NOTFOUND_OK(ret); } - WT_ERR_NOTFOUND_OK(ret); err: WT_TRET(fclose(fp)); + + /* Don't leave a damaged file in place. */ + if (ret != 0) + (void)__wt_remove(session, filename); + return (ret); } @@ -1270,10 +1359,9 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, WT_CONFIG_ITEM cval, sval; WT_CONNECTION_IMPL *conn; WT_DECL_RET; - WT_ITEM cbbuf, cubuf; + WT_ITEM i1, i2, i3; const WT_NAME_FLAG *ft; WT_SESSION_IMPL *session; - int exist; /* Leave space for optional additional configuration. */ const char *cfg[] = { NULL, NULL, NULL, NULL, NULL, NULL }; @@ -1282,8 +1370,14 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, conn = NULL; session = NULL; - WT_CLEAR(cbbuf); - WT_CLEAR(cubuf); + + /* + * We could use scratch buffers, but I'd rather the default session + * not tie down chunks of memory past the open call. + */ + WT_CLEAR(i1); + WT_CLEAR(i2); + WT_CLEAR(i3); WT_RET(__wt_library_init()); @@ -1308,13 +1402,13 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, /* Remaining basic initialization of the connection structure. */ WT_ERR(__wt_connection_init(conn)); - /* Check/set the configuration strings. */ + /* Check/set the application-specified configuration string. */ WT_ERR(__wt_config_check(session, WT_CONFIG_REF(session, wiredtiger_open), config, 0)); cfg[0] = WT_CONFIG_BASE(session, wiredtiger_open); cfg[1] = config; - /* Finish configuring error messages so we get them right early. */ + /* Configure error messages so we get them right early. */ WT_ERR(__wt_config_gets(session, cfg, "error_prefix", &cval)); if (cval.len != 0) WT_ERR(__wt_strndup( @@ -1330,45 +1424,39 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, * Build the configuration stack, in the following order (where later * entries override earlier entries): * - * 1. default wiredtiger_open configuration + * 1. all possible wiredtiger_open configurations * 2. base configuration file, created with the database (optional) * 3. the config passed in by the application. * 4. user configuration file (optional) * 5. environment variable settings (optional) * - * Clear the entry we added to the stack, we're going to build it in + * Clear the entries we added to the stack, we're going to build it in * order. */ + cfg[0] = WT_CONFIG_BASE(session, wiredtiger_open_all); cfg[1] = NULL; - - /* - * The base configuration should not exist if we are creating this - * database. - */ - exist = 0; - if (conn->is_new) { - WT_ERR(__wt_exist(session, WT_BASECONFIG, &exist)); - if (exist) - WT_ERR_MSG(session, EINVAL, - "%s exists on creation", WT_BASECONFIG); - } else - WT_ERR(__conn_config_file(session, WT_BASECONFIG, cfg, &cbbuf)); - - /* Add the config string passed in by the application. */ + WT_ERR(__conn_config_file(session, WT_BASECONFIG, 0, cfg, &i1)); __conn_config_append(cfg, config); - - /* - * Read in user's config file and the config environment variable. - */ - WT_ERR(__conn_config_file(session, WT_USERCONFIG, cfg, &cubuf)); - WT_ERR(__conn_config_env(session, cfg)); + WT_ERR(__conn_config_file(session, WT_USERCONFIG, 1, cfg, &i2)); + WT_ERR(__conn_config_env(session, cfg, &i3)); /* * Configuration ... * * We can't open sessions yet, so any configurations that cause * sessions to be opened must be handled inside __wt_connection_open. + * + * The error message configuration might have changed (if set in a + * configuration file, and not in the application's configuration + * string), get it again. Do it first, make error messages correct. */ + WT_ERR(__wt_config_gets(session, cfg, "error_prefix", &cval)); + if (cval.len != 0) { + __wt_free(session, conn->error_prefix); + WT_ERR(__wt_strndup( + session, cval.str, cval.len, &conn->error_prefix)); + } + WT_ERR(__wt_config_gets(session, cfg, "hazard_max", &cval)); conn->hazard_max = (uint32_t)cval.val; @@ -1423,10 +1511,6 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, WT_ERR(__wt_lsm_manager_config(session, cfg)); WT_ERR(__wt_verbose_config(session, cfg)); - /* Write the base configuration file, if we're creating the database. */ - if (conn->is_new) - WT_ERR(__conn_write_config(session, WT_BASECONFIG, config)); - /* Now that we know if verbose is configured, output the version. */ WT_ERR(__wt_verbose( session, WT_VERB_VERSION, "%s", WIREDTIGER_VERSION_STRING)); @@ -1455,6 +1539,17 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, WT_ERR(__conn_load_extensions(session, cfg)); /* + * We've completed configuration, write the base configuration file if + * we're creating the database. + */ + if (conn->is_new) { + WT_ERR(__wt_config_gets(session, cfg, "config_base", &cval)); + if (cval.val) + WT_ERR( + __conn_write_config(session, WT_BASECONFIG, cfg)); + } + + /* * Start the worker threads last. */ WT_ERR(__wt_connection_workers(session, cfg)); @@ -1465,8 +1560,10 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, WT_STATIC_ASSERT(offsetof(WT_CONNECTION_IMPL, iface) == 0); *wt_connp = &conn->iface; -err: __wt_buf_free(session, &cbbuf); - __wt_buf_free(session, &cubuf); +err: /* Discard the configuration strings. */ + __wt_buf_free(session, &i1); + __wt_buf_free(session, &i2); + __wt_buf_free(session, &i3); if (ret != 0 && conn != NULL) WT_TRET(__wt_connection_close(conn)); diff --git a/src/docs/database-config.dox b/src/docs/database-config.dox index b86971ca450..b8dee0be980 100644 --- a/src/docs/database-config.dox +++ b/src/docs/database-config.dox @@ -67,12 +67,27 @@ replaced with commas. @section config_base WiredTiger.basecfg file -When a WiredTiger database is created, the configuration string passed -to ::wiredtiger_open is saved to a WiredTiger home directory file named -\c WiredTiger.basecfg, and that configuration file is read whenever the -database is subsequently opened. - -Users should not edit this file, set the \c WIREDTIGER_CONFIG -environment variable or create a \c WiredTiger.config file instead. +When a WiredTiger database is created, non-default configuration +information specified to ::wiredtiger_open is saved to a WiredTiger home +directory file named \c WiredTiger.basecfg, and that configuration file +is read whenever the database is subsequently opened. + +For example, if a shared library extensions are required, those settings +will be saved to the base configuration file so it's easier to write +general-purpose applications that might not be aware of how a particular +database was created and configured. + +Users should not not edit this file, set the \c WIREDTIGER_CONFIG +environment variable or create a \c WiredTiger.config file instead, as +those settings override the settings in the base configuration file. + +This file is a potential problem for applications that want to retain +the ability to downgrade to previous releases. If a new database is +created after an upgrade, the base configuration file might have +configuration strings that would cause a previous version of the +application to fail. For this reason, applications that may want to +downgrade should configure the ::wiredtiger_open value \c config_base +to \c false so the base configuration file is not written as part of +database create. */ diff --git a/src/docs/programming.dox b/src/docs/programming.dox index c16fc86657d..cdfb6d336e8 100644 --- a/src/docs/programming.dox +++ b/src/docs/programming.dox @@ -33,7 +33,7 @@ each of which is ordered by one or more columns. - @subpage signals @m_endif -<h2>Advanced features</h2> +<h2>Advanced topics</h2> - @subpage checkpoint - @subpage durability - @subpage backup @@ -42,6 +42,7 @@ each of which is ordered by one or more columns. - @subpage statistics - @subpage shared_cache - @subpage cursor_log +- @subpage upgrade @m_if{c} <h2>Extending WiredTiger</h2> diff --git a/src/docs/upgrade.dox b/src/docs/upgrade.dox new file mode 100644 index 00000000000..7952efa0343 --- /dev/null +++ b/src/docs/upgrade.dox @@ -0,0 +1,83 @@ +/*! @page upgrade Upgrading and downgrading databases + +The upgrade/downgrade process is only necessary for major or minor +WiredTiger releases (releases where the major or minor version number +changed). Patch releases (where only the patch number changed), do not +contain any API or file format changes, and do not require anything +other than a link step or shared library installation for upgrading or +downgrading. However, the complete WiredTiger library must be re-built +from scratch when changing versions, as there is no guarantee modules +from one version of the library will work with modules from any other +version. + +The rest of this page discusses upgrading and downgrading WiredTiger +major and minor releases. Specifically, by upgrading, we mean migrating +an application and its databases to a newer WiredTiger release, and by +downgrading, we mean reverting to an older version. + +When upgrading or downgrading between WiredTiger releases, there are two +components to consider: the WiredTiger library API and the underlying +data files used for the database (for example, log files or B+tree +files). + +As part of each WiredTiger release, a new @ref upgrading documentation +section is created, describing changes in the WiredTiger API and in the +format of underlying files, if any. Changes to the format of the +underlying data files are extremely rare, while changes to WiredTiger +API are more common. Generally, when the WiredTiger API changes, the +changes are backward compatible and applications do not require +modifications in order to upgrade to the new release. + +Note it is not necessary to upgrade (downgrade) to intermediate +releases, you can ignore intermediate releases and upgrade (downgrade) +directly to the release you plan to use. + +To upgrade to a new release of WiredTiger: + +-# Review the information for each release after the WiredTiger release +you're currently using, up to and including the release you plan to use. +Changes to the WiredTiger API are normally backward compatible, that is, +you can continue to use the same WiredTiger configuration values used +previously. However, it will likely enhance program maintainability to +switch to newer versions of the configuration strings, as documentation +for the deprecated values will no longer be available. +<br><br> +-# Once you have reviewed the relevant release notes and modified your +application as necessary, install the new version of the application by +relinking or installing a new version of the WiredTiger shared library. +<br><br> +-# Shut down the old version of the application. +<br><br> +-# Start the new version of the application. +<br><br> +If the upgrading documentation for any release after the previous +release and up to and including the release you are using, specifies +underlying data file formats are no longer backward compatible and will +not be upgraded at run-time, a data upgrade step is required before the +data can be accessed. In this case, data files must be upgraded using +the WT_SESSION::upgrade method. + +Applications wanting the ability to downgrade to previous releases of +WiredTiger are constrained in some important ways: + +- The underlying data file formats must not have changed between the +release currently being run and the release to which you are +downgrading. In other words, data file format changes are not backward +compatible, and an upgraded data file cannot be downgraded without being +dumped and re-loaded. +<br><br> +- Applications concerned with downgrading should configure the +::wiredtiger_open \c config_base value to \c false, so WiredTiger does +not write the base configuration file file when creating databases. +Because the base configuration file is written using a current version +of the WiredTiger API, writing this file could cause applications using +previous versions of the WiredTiger API to fail. See @ref config_base +for more information. + +To downgrade to a previous release of WiredTiger: + +-# Shut down the new version of the application. +<br><br> +-# Start the old version of the application. + +*/ diff --git a/src/include/config.h b/src/include/config.h index a32442d25ac..b9c4c97fa00 100644 --- a/src/include/config.h +++ b/src/include/config.h @@ -76,6 +76,9 @@ struct __wt_config_parser_impl { #define WT_CONFIG_ENTRY_session_verify 28 #define WT_CONFIG_ENTRY_table_meta 29 #define WT_CONFIG_ENTRY_wiredtiger_open 30 +#define WT_CONFIG_ENTRY_wiredtiger_open_all 31 +#define WT_CONFIG_ENTRY_wiredtiger_open_basecfg 32 +#define WT_CONFIG_ENTRY_wiredtiger_open_usercfg 33 /* * configuration section: END * DO NOT EDIT: automatically built by dist/flags.py. diff --git a/src/include/extern.h b/src/include/extern.h index 807092f6060..523529eca02 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -219,6 +219,7 @@ extern int __wt_conn_config_init(WT_SESSION_IMPL *session); extern void __wt_conn_config_discard(WT_SESSION_IMPL *session); extern int __wt_ext_config_parser_open(WT_EXTENSION_API *wt_ext, WT_SESSION *wt_session, const char *config, size_t len, WT_CONFIG_PARSER **config_parserp); extern int __wt_ext_config_get(WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, WT_CONFIG_ARG *cfg_arg, const char *key, WT_CONFIG_ITEM *cval); +extern int __wt_config_upgrade(WT_SESSION_IMPL *session, WT_ITEM *buf); extern int __wt_collator_config(WT_SESSION_IMPL *session, const char **cfg, WT_COLLATOR **collatorp, int *ownp); extern int __wt_conn_remove_collator(WT_SESSION_IMPL *session); extern int __wt_conn_remove_compressor(WT_SESSION_IMPL *session); diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index c83c5f49144..de4a04f1d66 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -1805,6 +1805,9 @@ struct __wt_connection { * @config{ ),,} * @config{checkpoint_sync, flush files to stable storage when closing or * writing checkpoints., a boolean flag; default \c true.} + * @config{config_base, write the base configuration file if creating the + * database\, see @ref config_base for more information., a boolean flag; + * default \c true.} * @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/src/lsm/lsm_meta.c b/src/lsm/lsm_meta.c index 6580992ff24..fbb5a9958d5 100644 --- a/src/lsm/lsm_meta.c +++ b/src/lsm/lsm_meta.c @@ -147,7 +147,6 @@ __wt_lsm_meta_read(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree) } else if (WT_STRING_MATCH("merge_threads", ck.str, ck.len)) { } else WT_ERR(__wt_illegal_value(session, "LSM metadata")); - } WT_ERR_NOTFOUND_OK(ret); diff --git a/test/suite/test_gethome.py b/test/suite/test_home.py index 6f8817f43dc..78310d69079 100644 --- a/test/suite/test_gethome.py +++ b/test/suite/test_home.py @@ -28,8 +28,23 @@ import os import wiredtiger, wttest -# test_gethome.py -# connection level is-new operation. +# test_isnew +# database is-new method +class test_isnew(wttest.WiredTigerTestCase): + + # Test is-new of a connection. + def test_isnew(self): + # We just created a connection, is_new should return True. + self.assertEquals(self.conn.is_new(), True) + + # Close and re-open the connection, is_new should return False. + self.conn.close() + self.conn = self.setUpConnectionOpen(".") + self.assertEquals(self.conn.is_new(), False) + + +# test_gethome +# database get-home method class test_gethome(wttest.WiredTigerTestCase): # Test gethome of a connection, the initially created one is ".". @@ -45,5 +60,18 @@ class test_gethome(wttest.WiredTigerTestCase): self.assertEquals(self.conn.get_home(), name) +# test_base_config +# test base configuration file config. +class test_base_config(wttest.WiredTigerTestCase): + def test_base_config(self): + # We just created a database, there should be a base configuration file. + self.assertTrue(os.path.exists("./WiredTiger.basecfg")) + + # Open up another database, configure without base configuration. + os.mkdir("A") + conn = wiredtiger.wiredtiger_open("A", "create,config_base=false") + self.assertFalse(os.path.exists("A/WiredTiger.basecfg")) + + if __name__ == '__main__': wttest.run() diff --git a/test/suite/test_isnew.py b/test/suite/test_isnew.py deleted file mode 100644 index 56a569877d9..00000000000 --- a/test/suite/test_isnew.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python -# -# Public Domain 2008-2014 WiredTiger, Inc. -# -# This is free and unencumbered software released into the public domain. -# -# Anyone is free to copy, modify, publish, use, compile, sell, or -# distribute this software, either in source code form or as a compiled -# binary, for any purpose, commercial or non-commercial, and by any -# means. -# -# In jurisdictions that recognize copyright laws, the author or authors -# of this software dedicate any and all copyright interest in the -# software to the public domain. We make this dedication for the benefit -# of the public at large and to the detriment of our heirs and -# successors. We intend this dedication to be an overt act of -# relinquishment in perpetuity of all present and future rights to this -# software under copyright law. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. - -import wiredtiger, wttest - -# test_isnew.py -# connection level is-new operation. -class test_isnew(wttest.WiredTigerTestCase): - - # Test is-new of a connection. - def test_isnew(self): - # We just created a connection, is_new should return True. - self.assertEquals(self.conn.is_new(), True) - - # Close and re-open the connection, is_new should return False. - self.conn.close() - self.conn = self.setUpConnectionOpen(".") - self.assertEquals(self.conn.is_new(), False) - - -if __name__ == '__main__': - wttest.run() |