summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsueloverso <sue@mongodb.com>2016-06-08 11:34:18 -0400
committerKeith Bostic <keith.bostic@mongodb.com>2016-06-08 11:34:18 -0400
commit43f0d0a62a8920ac3ad0e45fb695197e2455c4a5 (patch)
tree5a098e5e0d89a3afa39d30d124823fc5f82f0342
parent37cffe90333b1217ab13ac3f22d645aa4de2dbbb (diff)
downloadmongo-43f0d0a62a8920ac3ad0e45fb695197e2455c4a5.tar.gz
WT-2514 Fix logging to not use an empty path name. (#2789)
-rw-r--r--dist/api_data.py2
-rw-r--r--src/config/config_def.c41
-rw-r--r--src/include/wiredtiger.in4
-rw-r--r--test/suite/test_config04.py55
4 files changed, 65 insertions, 37 deletions
diff --git a/dist/api_data.py b/dist/api_data.py
index f7b4cd6e03b..6854890a477 100644
--- a/dist/api_data.py
+++ b/dist/api_data.py
@@ -439,7 +439,7 @@ connection_runtime_config = [
Config('file_max', '100MB', r'''
the maximum size of log files''',
min='100KB', max='2GB'),
- Config('path', '', r'''
+ 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'''),
diff --git a/src/config/config_def.c b/src/config/config_def.c
index 7a75db8857d..0d8308b48cc 100644
--- a/src/config/config_def.c
+++ b/src/config/config_def.c
@@ -976,7 +976,7 @@ static const WT_CONFIG_ENTRY config_entries[] = {
"eviction_dirty_trigger=95,eviction_target=80,eviction_trigger=95"
",file_manager=(close_handle_minimum=250,close_idle_time=30,"
"close_scan_interval=10),log=(archive=,compressor=,enabled=0,"
- "file_max=100MB,path=,prealloc=,recover=on,zero_fill=0),"
+ "file_max=100MB,path=\".\",prealloc=,recover=on,zero_fill=0),"
"lsm_manager=(merge=,worker_thread_max=4),lsm_merge=,"
"shared_cache=(chunk=10MB,name=,quota=0,reserve=0,size=500MB),"
"statistics=none,statistics_log=(json=0,on_close=0,"
@@ -1177,14 +1177,15 @@ static const WT_CONFIG_ENTRY config_entries[] = {
"file_extend=,file_manager=(close_handle_minimum=250,"
"close_idle_time=30,close_scan_interval=10),hazard_max=1000,"
"in_memory=0,log=(archive=,compressor=,enabled=0,file_max=100MB,"
- "path=,prealloc=,recover=on,zero_fill=0),lsm_manager=(merge=,"
- "worker_thread_max=4),lsm_merge=,mmap=,multiprocess=0,readonly=0,"
- "session_max=100,session_scratch_max=2MB,shared_cache=(chunk=10MB"
- ",name=,quota=0,reserve=0,size=500MB),statistics=none,"
- "statistics_log=(json=0,on_close=0,path=\"WiredTigerStat.%d.%H\","
- "sources=,timestamp=\"%b %d %H:%M:%S\",wait=0),"
- "transaction_sync=(enabled=0,method=fsync),use_environment=,"
- "use_environment_priv=0,verbose=,write_through=",
+ "path=\".\",prealloc=,recover=on,zero_fill=0),lsm_manager=(merge="
+ ",worker_thread_max=4),lsm_merge=,mmap=,multiprocess=0,readonly=0"
+ ",session_max=100,session_scratch_max=2MB,"
+ "shared_cache=(chunk=10MB,name=,quota=0,reserve=0,size=500MB),"
+ "statistics=none,statistics_log=(json=0,on_close=0,"
+ "path=\"WiredTigerStat.%d.%H\",sources=,"
+ "timestamp=\"%b %d %H:%M:%S\",wait=0),transaction_sync=(enabled=0"
+ ",method=fsync),use_environment=,use_environment_priv=0,verbose=,"
+ "write_through=",
confchk_wiredtiger_open, 38
},
{ "wiredtiger_open_all",
@@ -1198,15 +1199,15 @@ static const WT_CONFIG_ENTRY config_entries[] = {
"file_extend=,file_manager=(close_handle_minimum=250,"
"close_idle_time=30,close_scan_interval=10),hazard_max=1000,"
"in_memory=0,log=(archive=,compressor=,enabled=0,file_max=100MB,"
- "path=,prealloc=,recover=on,zero_fill=0),lsm_manager=(merge=,"
- "worker_thread_max=4),lsm_merge=,mmap=,multiprocess=0,readonly=0,"
- "session_max=100,session_scratch_max=2MB,shared_cache=(chunk=10MB"
- ",name=,quota=0,reserve=0,size=500MB),statistics=none,"
- "statistics_log=(json=0,on_close=0,path=\"WiredTigerStat.%d.%H\","
- "sources=,timestamp=\"%b %d %H:%M:%S\",wait=0),"
- "transaction_sync=(enabled=0,method=fsync),use_environment=,"
- "use_environment_priv=0,verbose=,version=(major=0,minor=0),"
- "write_through=",
+ "path=\".\",prealloc=,recover=on,zero_fill=0),lsm_manager=(merge="
+ ",worker_thread_max=4),lsm_merge=,mmap=,multiprocess=0,readonly=0"
+ ",session_max=100,session_scratch_max=2MB,"
+ "shared_cache=(chunk=10MB,name=,quota=0,reserve=0,size=500MB),"
+ "statistics=none,statistics_log=(json=0,on_close=0,"
+ "path=\"WiredTigerStat.%d.%H\",sources=,"
+ "timestamp=\"%b %d %H:%M:%S\",wait=0),transaction_sync=(enabled=0"
+ ",method=fsync),use_environment=,use_environment_priv=0,verbose=,"
+ "version=(major=0,minor=0),write_through=",
confchk_wiredtiger_open_all, 39
},
{ "wiredtiger_open_basecfg",
@@ -1218,7 +1219,7 @@ static const WT_CONFIG_ENTRY config_entries[] = {
"eviction_dirty_trigger=95,eviction_target=80,eviction_trigger=95"
",extensions=,file_extend=,file_manager=(close_handle_minimum=250"
",close_idle_time=30,close_scan_interval=10),hazard_max=1000,"
- "log=(archive=,compressor=,enabled=0,file_max=100MB,path=,"
+ "log=(archive=,compressor=,enabled=0,file_max=100MB,path=\".\","
"prealloc=,recover=on,zero_fill=0),lsm_manager=(merge=,"
"worker_thread_max=4),lsm_merge=,mmap=,multiprocess=0,readonly=0,"
"session_max=100,session_scratch_max=2MB,shared_cache=(chunk=10MB"
@@ -1238,7 +1239,7 @@ static const WT_CONFIG_ENTRY config_entries[] = {
"eviction_dirty_trigger=95,eviction_target=80,eviction_trigger=95"
",extensions=,file_extend=,file_manager=(close_handle_minimum=250"
",close_idle_time=30,close_scan_interval=10),hazard_max=1000,"
- "log=(archive=,compressor=,enabled=0,file_max=100MB,path=,"
+ "log=(archive=,compressor=,enabled=0,file_max=100MB,path=\".\","
"prealloc=,recover=on,zero_fill=0),lsm_manager=(merge=,"
"worker_thread_max=4),lsm_merge=,mmap=,multiprocess=0,readonly=0,"
"session_max=100,session_scratch_max=2MB,shared_cache=(chunk=10MB"
diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in
index 690f6becb7d..e488812477e 100644
--- a/src/include/wiredtiger.in
+++ b/src/include/wiredtiger.in
@@ -1848,7 +1848,7 @@ struct __wt_connection {
* @config{&nbsp;&nbsp;&nbsp;&nbsp;path, 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., a
- * string; default empty.}
+ * string; default \c ".".}
* @config{&nbsp;&nbsp;&nbsp;&nbsp;prealloc,
* pre-allocate log files., a boolean flag; default \c true.}
* @config{&nbsp;&nbsp;&nbsp;&nbsp;recover, run recovery or error if
@@ -2344,7 +2344,7 @@ struct __wt_connection {
* integer between 100KB and 2GB; default \c 100MB.}
* @config{&nbsp;&nbsp;&nbsp;&nbsp;path, 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., a string; default empty.}
+ * are created relative to the database home., a string; default \c ".".}
* @config{&nbsp;&nbsp;&nbsp;&nbsp;prealloc, pre-allocate log files., a boolean
* flag; default \c true.}
* @config{&nbsp;&nbsp;&nbsp;&nbsp;recover, run recovery
diff --git a/test/suite/test_config04.py b/test/suite/test_config04.py
index 7186bc3a716..dffa7479f1b 100644
--- a/test/suite/test_config04.py
+++ b/test/suite/test_config04.py
@@ -26,7 +26,7 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
-import os
+import os, shutil
import wiredtiger, wttest
from wiredtiger import stat
@@ -34,6 +34,7 @@ from wiredtiger import stat
# Individually test config options
class test_config04(wttest.WiredTigerTestCase):
table_name1 = 'test_config04'
+ log1 = 'WiredTigerLog.0000000001'
nentries = 100
K = 1024
@@ -86,6 +87,10 @@ class test_config04(wttest.WiredTigerTestCase):
self.assertEqual(cursor[stat.conn.cache_bytes_max][2], size)
cursor.close()
+ def common_log_test(self, path, dirname):
+ self.common_test('log=(archive=false,enabled,' + path + ')')
+ self.assertTrue(os.path.exists(dirname + os.sep + self.log1))
+
def test_bad_config(self):
msg = '/unknown configuration key/'
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
@@ -168,24 +173,46 @@ class test_config04(wttest.WiredTigerTestCase):
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
lambda: self.wiredtiger_open('.', '(create='), msg)
- def test_session_max(self):
- # Note: There isn't any direct way to know that this was set,
- # but we'll have a separate functionality test to test for
- # this indirectly.
- self.common_test('session_max=99')
-
- def test_multiprocess(self):
- self.common_test('multiprocess')
- # TODO: how do we verify that it was set?
-
def test_error_prefix(self):
self.common_test('error_prefix="MyOwnPrefix"')
# TODO: how do we verify that it was set?
def test_logging(self):
- self.common_test('log=(enabled=true)')
- # TODO: how do we verify that it was set? For this we could look
- # for the existence of the log file in the home dir.
+ # Test variations on the log configuration. The log test takes
+ # a configuration string as the first arg and the directory pathname
+ # to confirm the existence of the log file. For now we're testing
+ # the log pathname only.
+ #
+ # Test the default in the home directory.
+ self.common_log_test('', '.')
+ self.conn.close()
+
+ # Test a subdir of the home directory.
+ logdirname = 'logdir'
+ logdir = '.' + os.sep + logdirname
+ os.mkdir(logdir)
+ confstr = 'path=' + logdirname
+ self.common_log_test(confstr, logdir)
+ self.conn.close()
+
+ # Test an absolute path directory.
+ if os.name == 'posix':
+ logdir = '/tmp/logdir'
+ os.mkdir(logdir)
+ confstr = 'path=' + logdir
+ self.common_log_test(confstr, logdir)
+ self.conn.close()
+ shutil.rmtree(logdir, ignore_errors=True)
+
+ def test_multiprocess(self):
+ self.common_test('multiprocess')
+ # TODO: how do we verify that it was set?
+
+ def test_session_max(self):
+ # Note: There isn't any direct way to know that this was set,
+ # but we'll have a separate functionality test to test for
+ # this indirectly.
+ self.common_test('session_max=99')
def test_transactional(self):
# Note: this will have functional tests in the future.