@ -15,6 +15,7 @@
# include "db_stress_tool/db_stress_table_properties_collector.h"
# include "db_stress_tool/db_stress_table_properties_collector.h"
# include "rocksdb/convenience.h"
# include "rocksdb/convenience.h"
# include "rocksdb/sst_file_manager.h"
# include "rocksdb/sst_file_manager.h"
# include "rocksdb/types.h"
# include "util/cast_util.h"
# include "util/cast_util.h"
# include "utilities/fault_injection_fs.h"
# include "utilities/fault_injection_fs.h"
@ -525,6 +526,16 @@ void StressTest::OperateDb(ThreadState* thread) {
fault_fs_guard - > SetThreadLocalReadErrorContext ( thread - > shared - > GetSeed ( ) ,
fault_fs_guard - > SetThreadLocalReadErrorContext ( thread - > shared - > GetSeed ( ) ,
FLAGS_read_fault_one_in ) ;
FLAGS_read_fault_one_in ) ;
}
}
if ( FLAGS_write_fault_one_in ) {
IOStatus error_msg = IOStatus : : IOError ( " Retryable IO Error " ) ;
error_msg . SetRetryable ( true ) ;
std : : vector < FileType > types ;
types . push_back ( FileType : : kTableFile ) ;
types . push_back ( FileType : : kDescriptorFile ) ;
types . push_back ( FileType : : kCurrentFile ) ;
fault_fs_guard - > SetRandomWriteError (
thread - > shared - > GetSeed ( ) , FLAGS_write_fault_one_in , error_msg , types ) ;
}
# endif // NDEBUG
# endif // NDEBUG
thread - > stats . Start ( ) ;
thread - > stats . Start ( ) ;
for ( int open_cnt = 0 ; open_cnt < = FLAGS_reopen ; + + open_cnt ) {
for ( int open_cnt = 0 ; open_cnt < = FLAGS_reopen ; + + open_cnt ) {
@ -618,7 +629,8 @@ void StressTest::OperateDb(ThreadState* thread) {
# ifndef ROCKSDB_LITE
# ifndef ROCKSDB_LITE
// Verify GetLiveFiles with a 1 in N chance.
// Verify GetLiveFiles with a 1 in N chance.
if ( thread - > rand . OneInOpt ( FLAGS_get_live_files_one_in ) ) {
if ( thread - > rand . OneInOpt ( FLAGS_get_live_files_one_in ) & &
! FLAGS_write_fault_one_in ) {
Status status = VerifyGetLiveFiles ( ) ;
Status status = VerifyGetLiveFiles ( ) ;
if ( ! status . ok ( ) ) {
if ( ! status . ok ( ) ) {
VerificationAbort ( shared , " VerifyGetLiveFiles status not OK " , status ) ;
VerificationAbort ( shared , " VerifyGetLiveFiles status not OK " , status ) ;
@ -1460,7 +1472,7 @@ Status StressTest::TestCheckpoint(ThreadState* thread,
FLAGS_db + " /.checkpoint " + ToString ( thread - > tid ) ;
FLAGS_db + " /.checkpoint " + ToString ( thread - > tid ) ;
Options tmp_opts ( options_ ) ;
Options tmp_opts ( options_ ) ;
tmp_opts . listeners . clear ( ) ;
tmp_opts . listeners . clear ( ) ;
tmp_opts . env = db_stress_env - > target ( ) ;
tmp_opts . env = db_stress_env ;
DestroyDB ( checkpoint_dir , tmp_opts ) ;
DestroyDB ( checkpoint_dir , tmp_opts ) ;
@ -1952,6 +1964,7 @@ void StressTest::PrintEnv() const {
fprintf ( stdout , " Use dynamic level : %d \n " ,
fprintf ( stdout , " Use dynamic level : %d \n " ,
static_cast < int > ( FLAGS_level_compaction_dynamic_level_bytes ) ) ;
static_cast < int > ( FLAGS_level_compaction_dynamic_level_bytes ) ) ;
fprintf ( stdout , " Read fault one in : %d \n " , FLAGS_read_fault_one_in ) ;
fprintf ( stdout , " Read fault one in : %d \n " , FLAGS_read_fault_one_in ) ;
fprintf ( stdout , " Write fault one in : %d \n " , FLAGS_write_fault_one_in ) ;
fprintf ( stdout , " Sync fault injection : %d \n " , FLAGS_sync_fault_injection ) ;
fprintf ( stdout , " Sync fault injection : %d \n " , FLAGS_sync_fault_injection ) ;
fprintf ( stdout , " Best efforts recovery : %d \n " ,
fprintf ( stdout , " Best efforts recovery : %d \n " ,
static_cast < int > ( FLAGS_best_efforts_recovery ) ) ;
static_cast < int > ( FLAGS_best_efforts_recovery ) ) ;