Fix bug which causes crash_test to always run on sync mode (#6304)

Summary:
A previous change meant to make db_stress to run on sync=1 mode for 1/20 of the time in crash_test, but a bug caused to to always run on sync=1 mode. Fix it.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6304

Test Plan: Start and kill "python -u tools/db_crashtest.py --simple whitebox" multiple times and observe that most times sync=0 is used while some times sync=1 is used.

Differential Revision: D19433000

fbshipit-source-id: 7a0adba39b17a1b3acbbd791bb0cdb743b91fa95
This commit is contained in:
sdong 2020-01-17 01:44:47 -08:00 committed by Facebook Github Bot
parent d87cffaea4
commit 6b64aed4c0

View File

@ -92,7 +92,7 @@ default_params = {
[t * 16384 if t < 3 else 1024 * 1024 * 1024 for t in range(1, 30)]), [t * 16384 if t < 3 else 1024 * 1024 * 1024 for t in range(1, 30)]),
# Sync mode might make test runs slower so running it in a smaller chance # Sync mode might make test runs slower so running it in a smaller chance
"sync" : lambda : random.choice( "sync" : lambda : random.choice(
[0 if t == 0 else 1 for t in range(1, 20)]), [1 if t == 0 else 0 for t in range(0, 20)]),
# Disable compation_readahead_size because the test is not passing. # Disable compation_readahead_size because the test is not passing.
#"compaction_readahead_size" : lambda : random.choice( #"compaction_readahead_size" : lambda : random.choice(
# [0, 0, 1024 * 1024]), # [0, 0, 1024 * 1024]),