diff options
author | Keith Bostic <keith@wiredtiger.com> | 2014-12-15 11:23:59 -0500 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2014-12-15 11:23:59 -0500 |
commit | 2c473cee309330015680560b667cf89e01dfa276 (patch) | |
tree | d3f83fec415c41d293bcd64149d2e0635bcbfa02 | |
parent | 70bb9ca0be7f57a83af4d9973f9ffdd238e2fc3f (diff) | |
download | mongo-2c473cee309330015680560b667cf89e01dfa276.tar.gz |
Add a simple test of recovery -- on timed runs, the monitor thread
optionally indirects through a NULL and core dumps, then we verify
the object.
-rw-r--r-- | test/format/config.h | 4 | ||||
-rw-r--r-- | test/format/format.h | 3 | ||||
-rw-r--r-- | test/format/ops.c | 12 | ||||
-rw-r--r-- | test/format/recover.sh | 27 |
4 files changed, 43 insertions, 3 deletions
diff --git a/test/format/config.h b/test/format/config.h index 1b5d21d109b..89262e0ec13 100644 --- a/test/format/config.h +++ b/test/format/config.h @@ -66,6 +66,10 @@ typedef struct { #define CONF_RAND(cp) MMRAND((cp)->min, (cp)->maxrand) static CONFIG c[] = { + { "abort", + "if timed run should drop core", /* 0% */ + C_BOOL, 0, 0, 0, &g.c_abort, NULL }, + { "auto_throttle", "if LSM inserts are throttled", /* 90% */ C_BOOL, 90, 0, 0, &g.c_auto_throttle, NULL }, diff --git a/test/format/format.h b/test/format/format.h index 902cea6cc5d..a12df400187 100644 --- a/test/format/format.h +++ b/test/format/format.h @@ -166,7 +166,8 @@ typedef struct { char *config_open; /* Command-line configuration */ - uint32_t c_auto_throttle; /* Config values */ + uint32_t c_abort; /* Config values */ + uint32_t c_auto_throttle; uint32_t c_backups; uint32_t c_bitcnt; uint32_t c_bloom; diff --git a/test/format/ops.c b/test/format/ops.c index bbaeabcc479..906d32fee82 100644 --- a/test/format/ops.c +++ b/test/format/ops.c @@ -139,10 +139,18 @@ wts_ops(void) break; } - /* Tell the thread if it's done. */ if (thread_ops == 0) { - if (fourths == 0) + /* + * Optionally drop core (for testing recovery), + * otherwise tell the thread it's done. + */ + if (fourths == 0) { + if (g.c_abort) { + static char *core = NULL; + *core = 0; + } tinfo[i].quit = 1; + } } else if (tinfo[i].ops >= thread_ops) tinfo[i].quit = 1; diff --git a/test/format/recover.sh b/test/format/recover.sh new file mode 100644 index 00000000000..2a2ab1b2e9e --- /dev/null +++ b/test/format/recover.sh @@ -0,0 +1,27 @@ +#! /bin/sh + +# Timer: how many minutes format runs before aborting. +timer=2 + +# Runs: set to 0 to run infinitely. +runs=1000 + +# Config: additional test/format configuration +config= + +count=0 +while true; do + count=`expr $count + 1` + if test $runs -ne 0 -a $count -gt $runs; then + exit 0 + fi + echo "recovery test: $count of $runs" + + ./t $config -q abort=1 timer=$timer + + uri='file:wt' + if `wt -h RUNDIR list | egrep table > /dev/null`; then + uri='table:wt' + fi + wt -h RUNDIR verify $uri || exit 1 +done |