@ -11,6 +11,7 @@
# ifdef GFLAGS
# ifdef GFLAGS
# include "db_stress_tool/db_stress_common.h"
# include "db_stress_tool/db_stress_common.h"
# include "db_stress_tool/db_stress_driver.h"
# include "db_stress_tool/db_stress_driver.h"
# include "rocksdb/convenience.h"
namespace rocksdb {
namespace rocksdb {
StressTest : : StressTest ( )
StressTest : : StressTest ( )
@ -485,7 +486,7 @@ void StressTest::OperateDb(ThreadState* thread) {
}
}
thread - > shared - > IncVotedReopen ( ) ;
thread - > shared - > IncVotedReopen ( ) ;
if ( thread - > shared - > AllVotedReopen ( ) ) {
if ( thread - > shared - > AllVotedReopen ( ) ) {
thread - > shared - > GetStressTest ( ) - > Reopen ( ) ;
thread - > shared - > GetStressTest ( ) - > Reopen ( thread ) ;
thread - > shared - > GetCondVar ( ) - > SignalAll ( ) ;
thread - > shared - > GetCondVar ( ) - > SignalAll ( ) ;
} else {
} else {
thread - > shared - > GetCondVar ( ) - > Wait ( ) ;
thread - > shared - > GetCondVar ( ) - > Wait ( ) ;
@ -1746,11 +1747,26 @@ void StressTest::Open() {
}
}
}
}
void StressTest : : Reopen ( ) {
void StressTest : : Reopen ( ThreadState * thread ) {
# ifndef ROCKSDB_LITE
if ( thread - > rand . OneIn ( 2 ) ) {
CancelAllBackgroundWork ( db_ , static_cast < bool > ( thread - > rand . OneIn ( 2 ) ) ) ;
}
# else
( void ) thread ;
# endif
for ( auto cf : column_families_ ) {
for ( auto cf : column_families_ ) {
delete cf ;
delete cf ;
}
}
column_families_ . clear ( ) ;
column_families_ . clear ( ) ;
# ifndef ROCKSDB_LITE
if ( thread - > rand . OneIn ( 2 ) ) {
Status s = db_ - > Close ( ) ;
assert ( s . ok ( ) ) ;
}
# endif
delete db_ ;
delete db_ ;
db_ = nullptr ;
db_ = nullptr ;
# ifndef ROCKSDB_LITE
# ifndef ROCKSDB_LITE