diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2015-03-20 16:45:14 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2015-03-20 16:45:14 +1100 |
commit | 78fc01134ba8930f4cedf43233e4d4c7f749ba1c (patch) | |
tree | 61d1ff2c783b8daa9b90212943bb439d6acc7987 /test | |
parent | 926d40159ec12228ffe106ec5bb7a60d73dbeabd (diff) | |
parent | d553f91e06659013970ee9cf357ce435b75ee611 (diff) | |
download | mongo-78fc01134ba8930f4cedf43233e4d4c7f749ba1c.tar.gz |
Merge branch 'develop' into config-check-with-function
Conflicts:
src/config/config_def.c
Diffstat (limited to 'test')
-rw-r--r-- | test/format/Makefile.am | 2 | ||||
-rw-r--r-- | test/format/config.c | 12 | ||||
-rw-r--r-- | test/format/config.h | 4 | ||||
-rw-r--r-- | test/format/format.h | 11 | ||||
-rwxr-xr-x | test/format/s_dumpcmp.sh | 27 | ||||
-rw-r--r-- | test/format/util.c | 12 | ||||
-rw-r--r-- | test/format/wts.c | 8 | ||||
-rw-r--r-- | test/suite/test_bug011.py | 78 | ||||
-rw-r--r-- | test/suite/test_reconfig.py | 6 | ||||
-rw-r--r-- | test/suite/test_sweep01.py | 24 | ||||
-rw-r--r-- | test/suite/test_sweep02.py | 69 |
11 files changed, 202 insertions, 51 deletions
diff --git a/test/format/Makefile.am b/test/format/Makefile.am index 1dc96a04afd..421de768248 100644 --- a/test/format/Makefile.am +++ b/test/format/Makefile.am @@ -32,4 +32,4 @@ refresh: TESTS = smoke.sh clean-local: - rm -rf RUNDIR *.core + rm -rf RUNDIR s_dumpcmp *.core diff --git a/test/format/config.c b/test/format/config.c index 212cf350c0b..ce5d0a9c372 100644 --- a/test/format/config.c +++ b/test/format/config.c @@ -232,15 +232,17 @@ config_compression(void) if (!config_is_perm("compression")) { cstr = "compression=none"; switch (MMRAND(1, 20)) { - case 1: case 2: case 3: /* 30% no compression */ - case 4: case 5: case 6: + case 1: case 2: case 3: case 4: /* 20% no compression */ break; - case 7: case 8: case 9: case 10: /* 20% bzip */ + case 5: case 6: /* 10% bzip */ cstr = "compression=bzip"; break; - case 11: /* 5% bzip-raw */ + case 7: /* 5% bzip-raw */ cstr = "compression=bzip-raw"; break; + case 8: case 9: case 10: case 11: /* 20% lz4 */ + cstr = "compression=lz4"; + break; case 12: case 13: case 14: case 15: /* 20% snappy */ cstr = "compression=snappy"; break; @@ -516,6 +518,8 @@ config_map_compression(const char *s, u_int *vp) *vp = COMPRESS_BZIP; else if (strcmp(s, "bzip-raw") == 0) *vp = COMPRESS_BZIP_RAW; + else if (strcmp(s, "lz4") == 0) + *vp = COMPRESS_LZ4; else if (strcmp(s, "lzo") == 0) *vp = COMPRESS_LZO; else if (strcmp(s, "snappy") == 0) diff --git a/test/format/config.h b/test/format/config.h index cc084d5b238..3a849a36c26 100644 --- a/test/format/config.h +++ b/test/format/config.h @@ -118,8 +118,8 @@ static CONFIG c[] = { { "compression", "type of compression " - "(none | bzip | bzip-raw | lzo | snappy | zlib | zlib-noraw)", - C_IGNORE|C_STRING, 1, 5, 5, NULL, &g.c_compression }, + "(none | bzip | bzip-raw | lz4 | lzo | snappy | zlib | zlib-noraw)", + C_IGNORE|C_STRING, 0, 0, 0, NULL, &g.c_compression }, { "data_extend", "if data files are extended", /* 5% */ diff --git a/test/format/format.h b/test/format/format.h index 9d3f95697c0..f6e7a83470e 100644 --- a/test/format/format.h +++ b/test/format/format.h @@ -73,6 +73,8 @@ extern WT_EXTENSION_API *wt_api; #define BZIP_PATH \ EXTPATH "compressors/bzip2/.libs/libwiredtiger_bzip2.so" +#define LZ4_PATH \ + EXTPATH "compressors/lz4/.libs/libwiredtiger_lz4.so" #define SNAPPY_PATH \ EXTPATH "compressors/snappy/.libs/libwiredtiger_snappy.so" #define ZLIB_PATH \ @@ -239,10 +241,11 @@ typedef struct { #define COMPRESS_NONE 1 #define COMPRESS_BZIP 2 #define COMPRESS_BZIP_RAW 3 -#define COMPRESS_LZO 4 -#define COMPRESS_SNAPPY 5 -#define COMPRESS_ZLIB 6 -#define COMPRESS_ZLIB_NO_RAW 7 +#define COMPRESS_LZ4 4 +#define COMPRESS_LZO 5 +#define COMPRESS_SNAPPY 6 +#define COMPRESS_ZLIB 7 +#define COMPRESS_ZLIB_NO_RAW 8 u_int c_compression_flag; /* Compression flag value */ #define ISOLATION_RANDOM 1 diff --git a/test/format/s_dumpcmp.sh b/test/format/s_dumpcmp.sh index 82a9a214a88..453d42cda32 100755 --- a/test/format/s_dumpcmp.sh +++ b/test/format/s_dumpcmp.sh @@ -37,32 +37,7 @@ if test $# -ne 0; then exit 1 fi -ext="\"$top/ext/collators/reverse/.libs/libwiredtiger_reverse_collator.so\"" - -bzip2_ext="$top/ext/compressors/bzip2/.libs/libwiredtiger_bzip2.so" -if test -e $bzip2_ext ; then - ext="$ext,\"$bzip2_ext\"" -fi -lzo_ext=".libs/lzo_compress.so" -if test -e $lzo_ext ; then - ext="$ext,\"$lzo_ext\"" -fi -bzip_raw_ext=".libs/bzip_raw_compress.so" -if test -e $bzip_raw_ext ; then - ext="$ext,\"$bzip_raw_ext\"" -fi -snappy_ext="$top/ext/compressors/snappy/.libs/libwiredtiger_snappy.so" -if test -e $snappy_ext ; then - ext="$ext,\"$snappy_ext\"" -fi -zlib_ext="$top/ext/compressors/zlib/.libs/libwiredtiger_zlib.so" -if test -e $zlib_ext ; then - ext="$ext,\"$zlib_ext\"" -fi - -config='extensions=['$ext']' - -$top/wt -h $home -C "$config" dump $wturi | +$top/wt -h $home dump $wturi | sed -e '1,/^Data$/d' > $home/wt_dump if test "X$bdbdir" = "X"; then diff --git a/test/format/util.c b/test/format/util.c index a1d1fa2b772..27294aae79f 100644 --- a/test/format/util.c +++ b/test/format/util.c @@ -293,12 +293,15 @@ path_setup(const char *home) /* * Home directory initialize command: remove everything except the RNG * log file. + * + * Redirect the "cd" command to /dev/null so chatty cd implementations + * don't add the new working directory to our output. */ #undef CMD #ifdef _WIN32 #define CMD "cd %s && del /s /q * && rd /s /q KVS" #else -#define CMD "cd %s && rm -rf `ls | sed /rand/d`" +#define CMD "cd %s > /dev/null && rm -rf `ls | sed /rand/d`" #endif len = strlen(g.home) + strlen(CMD) + 1; if ((g.home_init = malloc(len)) == NULL) @@ -320,16 +323,19 @@ path_setup(const char *home) /* * Salvage command, save the interesting files so we can replay the * salvage command as necessary. + * + * Redirect the "cd" command to /dev/null so chatty cd implementations + * don't add the new working directory to our output. */ #undef CMD #ifdef _WIN32 #define CMD \ - "cd %s && " \ + "cd %s " \ "rd /q /s slvg.copy & mkdir slvg.copy && " \ "copy WiredTiger* slvg.copy\\ && copy wt* slvg.copy\\" #else #define CMD \ - "cd %s && " \ + "cd %s > /dev/null && " \ "rm -rf slvg.copy && mkdir slvg.copy && " \ "cp WiredTiger* wt* slvg.copy/" #endif diff --git a/test/format/wts.c b/test/format/wts.c index 0875f3900f8..553b9902a46 100644 --- a/test/format/wts.c +++ b/test/format/wts.c @@ -140,9 +140,11 @@ wts_open(const char *home, int set_api, WT_CONNECTION **connp) /* Extensions. */ p += snprintf(p, REMAIN(p, end), - ",extensions=[\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\"],", + ",extensions=[" + "\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\"],", g.c_reverse ? REVERSE_PATH : "", access(BZIP_PATH, R_OK) == 0 ? BZIP_PATH : "", + access(LZ4_PATH, R_OK) == 0 ? LZ4_PATH : "", access(LZO_PATH, R_OK) == 0 ? LZO_PATH : "", access(SNAPPY_PATH, R_OK) == 0 ? SNAPPY_PATH : "", access(ZLIB_PATH, R_OK) == 0 ? ZLIB_PATH : "", @@ -316,6 +318,10 @@ wts_create(void) p += snprintf(p, REMAIN(p, end), ",block_compressor=\"bzip2-raw-test\""); break; + case COMPRESS_LZ4: + p += snprintf(p, REMAIN(p, end), + ",block_compressor=\"lz4\""); + break; case COMPRESS_LZO: p += snprintf(p, REMAIN(p, end), ",block_compressor=\"LZO1B-6\""); diff --git a/test/suite/test_bug011.py b/test/suite/test_bug011.py new file mode 100644 index 00000000000..d2c56adb221 --- /dev/null +++ b/test/suite/test_bug011.py @@ -0,0 +1,78 @@ +#!usr/bin/env python +# +# Public Domain 2014-2015 MongoDB, Inc. +# 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 helper, random, wiredtiger, wttest +from helper import simple_populate + +# test_bug011.py +# Eviction working on more files than there are hazard pointers. +class test_bug011(wttest.WiredTigerTestCase): + """ + Test having eviction working on more files than the number of + allocated hazard pointers. + """ + table_name = 'test_bug011' + ntables = 50 + nrows = 10000 + nops = 10000 + + # Overrides WiredTigerTestCase + def setUpConnectionOpen(self, dir): + self.home = dir + conn_params = 'create,cache_size=10MB,' \ + 'hazard_max=' + str(self.ntables / 2) + conn = wiredtiger.wiredtiger_open(dir, conn_params) + self.pr(`conn`) + return conn + + def test_eviction(self): + cursors = [] + for i in range(0, self.ntables): + this_uri = 'table:%s-%03d' % (self.table_name, i) + simple_populate(self, this_uri, + 'key_format=S,allocation_size=1KB,leaf_page_max=1KB', + self.nrows) + + # Switch over to on-disk trees with multiple leaf pages + self.reopen_conn() + + # Make sure we have a cursor for the table so it stays in cache. + for i in range(0, self.ntables): + this_uri = 'table:%s-%03d' % (self.table_name, i) + cursors.append(self.session.open_cursor(this_uri, None)) + + # Make use of the cache. + for i in range(0, self.nops): + for i in range(0, self.ntables): + cursors[i].set_key(helper.key_populate(cursors[i], + random.randint(0, self.nrows - 1))) + cursors[i].search() + cursors[i].reset() + +if __name__ == '__main__': + wttest.run() diff --git a/test/suite/test_reconfig.py b/test/suite/test_reconfig.py index 06763f8f9ef..b464895f155 100644 --- a/test/suite/test_reconfig.py +++ b/test/suite/test_reconfig.py @@ -109,5 +109,11 @@ class test_reconfig(wttest.WiredTigerTestCase): self.conn.reconfigure( "statistics_log=(wait=2,sources=[lsm:],timestamp=\"%b\")") + def test_file_manager(self): + self.conn.reconfigure("file_manager=(close_scan_interval=3)") + self.conn.reconfigure("file_manager=(close_idle_time=4)") + self.conn.reconfigure( + "file_manager=(close_idle_time=4,close_scan_interval=100)") + if __name__ == '__main__': wttest.run() diff --git a/test/suite/test_sweep01.py b/test/suite/test_sweep01.py index 30efed98c80..a1a89c58838 100644 --- a/test/suite/test_sweep01.py +++ b/test/suite/test_sweep01.py @@ -40,11 +40,11 @@ import wttest class test_sweep01(wttest.WiredTigerTestCase, suite_subprocess): tablebase = 'test_sweep01' uri = 'table:' + tablebase - numfiles = 500 - numkv = 100 + numfiles = 50 + numkv = 1000 ckpt_list = [ ('off', dict(ckpt=0)), - ('on', dict(ckpt=20)), + ('on', dict(ckpt=10)), ] types = [ @@ -56,14 +56,18 @@ class test_sweep01(wttest.WiredTigerTestCase, suite_subprocess): create_params = 'key_format=r,value_format=8t')), ] - scenarios = number_scenarios(prune_scenarios(multiply_scenarios('.', types, ckpt_list), 1, 100)) + scenarios = number_scenarios( + prune_scenarios(multiply_scenarios('.', types, ckpt_list), 1, 100)) # Overrides WiredTigerTestCase def setUpConnectionOpen(self, dir): self.home = dir self.backup_dir = os.path.join(self.home, "WT_BACKUP") + # Configure sweep to run every 2 seconds with a 6 second timeout. + # That matches the ratio of the default 10 and 30 seconds. conn_params = \ ',create,error_prefix="%s: ",' % self.shortid() + \ + 'file_manager=(close_idle_time=6,close_scan_interval=2),' + \ 'checkpoint=(wait=%d),' % self.ckpt + \ 'statistics=(fast),' # print "Creating conn at '%s' with config '%s'" % (dir, conn_params) @@ -104,9 +108,9 @@ class test_sweep01(wttest.WiredTigerTestCase, suite_subprocess): nfile1 = stat_cursor[stat.conn.file_open][2] stat_cursor.close() # Inactive time on a handle must be a minute or more. - # At some point the sweep thread will run and set the time of death - # to be a minute later. So sleep 2 minutes to make sure it has run - # enough times to timeout the handles. + # We've configured the sweep server to run every 2 seconds and idle + # time to be 6 seconds. It should take at most 8 seconds for a handle + # to be closed. Sleep for 12 seconds to be safe. uri = '%s.test' % self.uri self.session.create(uri, self.create_params) # @@ -117,13 +121,13 @@ class test_sweep01(wttest.WiredTigerTestCase, suite_subprocess): c = self.session.open_cursor(uri, None) k = 0 sleep=0 - while sleep < 120: + while sleep < 12: k = k+1 c.set_key(k) c.set_value(1) c.insert() - sleep += 10 - time.sleep(10) + sleep += 2 + time.sleep(2) c.close() stat_cursor = self.session.open_cursor('statistics:', None, None) diff --git a/test/suite/test_sweep02.py b/test/suite/test_sweep02.py new file mode 100644 index 00000000000..3691bdaf35f --- /dev/null +++ b/test/suite/test_sweep02.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# +# Public Domain 2014-2015 MongoDB, Inc. +# 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. +# +# test_sweep02.py +# Test configuring and reconfiguring sweep options. +# + +import wiredtiger, wttest +from wiredtiger import wiredtiger_open +from wttest import unittest + +class test_sweep02(wttest.WiredTigerTestCase): + base_config = 'create,' + dir = 'WT_TEST' + tablebase = 'test_sweep02' + uri = 'table:' + tablebase + + # Disable default setup/shutdown steps - connections are managed manually. + def setUpSessionOpen(self, conn): + return None + + def setUpConnectionOpen(self, dir): + self.dir = dir + return None + + def test_config01(self): + self.conn = wiredtiger_open(self.dir, + self.base_config + "file_manager=()") + + def test_config02(self): + self.conn = wiredtiger_open(self.dir, + self.base_config + "file_manager=(close_scan_interval=1)") + + def test_config03(self): + self.conn = wiredtiger_open(self.dir, + self.base_config + "file_manager=(close_idle_time=1)") + + def test_config04(self): + self.conn = wiredtiger_open(self.dir, self.base_config + \ + "file_manager=(close_scan_interval=1,close_idle_time=1)") + +if __name__ == '__main__': + wttest.run() + |