diff options
-rw-r--r-- | dist/api_data.py | 5 | ||||
-rw-r--r-- | src/conn/conn_api.c | 6 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 5 | ||||
-rw-r--r-- | test/suite/test_config05.py | 10 |
4 files changed, 15 insertions, 11 deletions
diff --git a/dist/api_data.py b/dist/api_data.py index 840466c4970..69f993d2a74 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -700,9 +700,8 @@ methods = { use \c O_DIRECT''', type='list', choices=['checkpoint', 'data', 'log']), Config('exclusive', 'false', r''' - fail if the database exists. When false (the default), if the - object exists, open the existing database. Should generally be - paired with create option''', + 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). diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index e5bb8a340d6..e801d7bfc2b 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -926,11 +926,11 @@ __conn_single(WT_SESSION_IMPL *session, const char *cfg[]) WT_ERR(__wt_write(session, conn->lock_fh, (off_t)0, len, buf)); created = 1; } else { - WT_RET(__wt_config_gets(session, cfg, "exclusive", &cval)); + WT_ERR(__wt_config_gets(session, cfg, "exclusive", &cval)); if (cval.val != 0) WT_ERR_MSG(session, EEXIST, - "WiredTiger database already existed and " - "exclusive option defined."); + "WiredTiger database already exists and exclusive " + "option configured"); created = 0; } diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 2aa4e68b42b..36cfe20d822 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -1904,9 +1904,8 @@ struct __wt_connection { * (as a percentage)., an integer between 10 and 99; default \c 95.} * @config{eviction_workers, additional threads to help evict pages from cache., * an integer between 0 and 20; default \c 0.} - * @config{exclusive, fail if the database exists. When false (the default)\, - * if the object exists\, open the existing database. Should generally be - * paired with create option., a boolean flag; default \c false.} + * @config{exclusive, fail if the database already exists\, generally used with + * the \c create option., a boolean flag; default \c false.} * @config{extensions, 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\, diff --git a/test/suite/test_config05.py b/test/suite/test_config05.py index c1b82058637..d6ab5607686 100644 --- a/test/suite/test_config05.py +++ b/test/suite/test_config05.py @@ -81,13 +81,19 @@ class test_config05(wttest.WiredTigerTestCase): self.populate(self.session) self.verify_entries(self.session) + def test_exclusive_create(self): + self.conn = wiredtiger.wiredtiger_open('.', 'create,exclusive') + self.conn.close() + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, + lambda: wiredtiger.wiredtiger_open('.', 'exclusive'), + '/WiredTiger database already exists/') + def test_multi_create(self): self.conn = wiredtiger.wiredtiger_open('.', 'create') self.session = self.conn.open_session(None) self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: wiredtiger.wiredtiger_open('.', 'create'), - '/WiredTiger database is already being managed by another thread\ - in this process/') + '/WiredTiger database is already being managed/') if __name__ == '__main__': wttest.run() |