Enable crash-recovery stress test for atomic flush (#4605)

Summary:
This PR adds test of atomic flush to our continuous stress tests.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4605

Differential Revision: D12840607

Pulled By: riversand963

fbshipit-source-id: 0da187572791a59530065a7952697c05b1197ad9
This commit is contained in:
Yanqin Jin 2018-10-30 14:01:38 -07:00 committed by Facebook Github Bot
parent 72afdf20fc
commit 912bbbbc72
2 changed files with 19 additions and 1 deletions

View File

@ -881,6 +881,7 @@ crash_test: whitebox_crash_test blackbox_crash_test
blackbox_crash_test: db_stress blackbox_crash_test: db_stress
python -u tools/db_crashtest.py --simple blackbox $(CRASH_TEST_EXT_ARGS) python -u tools/db_crashtest.py --simple blackbox $(CRASH_TEST_EXT_ARGS)
python -u tools/db_crashtest.py --enable_atomic_flush blackbox $(CRASH_TEST_EXT_ARGS)
python -u tools/db_crashtest.py blackbox $(CRASH_TEST_EXT_ARGS) python -u tools/db_crashtest.py blackbox $(CRASH_TEST_EXT_ARGS)
ifeq ($(CRASH_TEST_KILL_ODD),) ifeq ($(CRASH_TEST_KILL_ODD),)
@ -889,6 +890,8 @@ endif
whitebox_crash_test: db_stress whitebox_crash_test: db_stress
python -u tools/db_crashtest.py --simple whitebox --random_kill_odd \ python -u tools/db_crashtest.py --simple whitebox --random_kill_odd \
$(CRASH_TEST_KILL_ODD) $(CRASH_TEST_EXT_ARGS)
python -u tools/db_crashtest.py --enable_atomic_flush whitebox --random_kill_odd \
$(CRASH_TEST_KILL_ODD) $(CRASH_TEST_EXT_ARGS) $(CRASH_TEST_KILL_ODD) $(CRASH_TEST_EXT_ARGS)
python -u tools/db_crashtest.py whitebox --random_kill_odd \ python -u tools/db_crashtest.py whitebox --random_kill_odd \
$(CRASH_TEST_KILL_ODD) $(CRASH_TEST_EXT_ARGS) $(CRASH_TEST_KILL_ODD) $(CRASH_TEST_EXT_ARGS)

View File

@ -15,6 +15,9 @@ import argparse
# default_params < {blackbox,whitebox}_default_params < # default_params < {blackbox,whitebox}_default_params <
# simple_default_params < # simple_default_params <
# {blackbox,whitebox}_simple_default_params < args # {blackbox,whitebox}_simple_default_params < args
# for enable_atomic_flush:
# default_params < {blackbox,whitebox}_default_params <
# atomic_flush_params < args
expected_values_file = tempfile.NamedTemporaryFile() expected_values_file = tempfile.NamedTemporaryFile()
@ -122,6 +125,15 @@ blackbox_simple_default_params = {
whitebox_simple_default_params = {} whitebox_simple_default_params = {}
atomic_flush_params = {
"atomic_flush": 1,
"disable_wal": 1,
"reopen": 0,
# use small value for write_buffer_size so that RocksDB triggers flush
# more frequently
"write_buffer_size": 1024 * 1024,
}
def finalize_and_sanitize(src_params): def finalize_and_sanitize(src_params):
dest_params = dict([(k, v() if callable(v) else v) dest_params = dict([(k, v() if callable(v) else v)
@ -152,6 +164,8 @@ def gen_cmd_params(args):
params.update(blackbox_simple_default_params) params.update(blackbox_simple_default_params)
if args.test_type == 'whitebox': if args.test_type == 'whitebox':
params.update(whitebox_simple_default_params) params.update(whitebox_simple_default_params)
if args.enable_atomic_flush:
params.update(atomic_flush_params)
for k, v in vars(args).items(): for k, v in vars(args).items():
if v is not None: if v is not None:
@ -164,7 +178,7 @@ def gen_cmd(params, unknown_params):
'--{0}={1}'.format(k, v) '--{0}={1}'.format(k, v)
for k, v in finalize_and_sanitize(params).items() for k, v in finalize_and_sanitize(params).items()
if k not in set(['test_type', 'simple', 'duration', 'interval', if k not in set(['test_type', 'simple', 'duration', 'interval',
'random_kill_odd']) 'random_kill_odd', 'enable_atomic_flush'])
and v is not None] + unknown_params and v is not None] + unknown_params
return cmd return cmd
@ -356,6 +370,7 @@ def main():
db_stress multiple times") db_stress multiple times")
parser.add_argument("test_type", choices=["blackbox", "whitebox"]) parser.add_argument("test_type", choices=["blackbox", "whitebox"])
parser.add_argument("--simple", action="store_true") parser.add_argument("--simple", action="store_true")
parser.add_argument("--enable_atomic_flush", action='store_true')
all_params = dict(default_params.items() all_params = dict(default_params.items()
+ blackbox_default_params.items() + blackbox_default_params.items()