@ -158,9 +158,6 @@ class ObsoleteFilesTest : public testing::Test {
} ;
} ;
TEST_F ( ObsoleteFilesTest , RaceForObsoleteFileDeletion ) {
TEST_F ( ObsoleteFilesTest , RaceForObsoleteFileDeletion ) {
createLevel0Files ( 2 , 50000 ) ;
CheckFileTypeCounts ( options_ . wal_dir , 1 , 0 , 0 ) ;
SyncPoint : : GetInstance ( ) - > LoadDependency ( {
SyncPoint : : GetInstance ( ) - > LoadDependency ( {
{ " DBImpl::BackgroundCallCompaction:FoundObsoleteFiles " ,
{ " DBImpl::BackgroundCallCompaction:FoundObsoleteFiles " ,
" ObsoleteFilesTest::RaceForObsoleteFileDeletion:1 " } ,
" ObsoleteFilesTest::RaceForObsoleteFileDeletion:1 " } ,
@ -170,7 +167,7 @@ TEST_F(ObsoleteFilesTest, RaceForObsoleteFileDeletion) {
SyncPoint : : GetInstance ( ) - > SetCallBack (
SyncPoint : : GetInstance ( ) - > SetCallBack (
" DBImpl::DeleteObsoleteFileImpl:AfterDeletion " , [ & ] ( void * arg ) {
" DBImpl::DeleteObsoleteFileImpl:AfterDeletion " , [ & ] ( void * arg ) {
Status * p_status = reinterpret_cast < Status * > ( arg ) ;
Status * p_status = reinterpret_cast < Status * > ( arg ) ;
ASSERT_TRUE ( p_status - > ok ( ) ) ;
ASSERT_OK ( * p_status ) ;
} ) ;
} ) ;
SyncPoint : : GetInstance ( ) - > SetCallBack (
SyncPoint : : GetInstance ( ) - > SetCallBack (
" DBImpl::CloseHelper:PendingPurgeFinished " , [ & ] ( void * arg ) {
" DBImpl::CloseHelper:PendingPurgeFinished " , [ & ] ( void * arg ) {
@ -180,6 +177,9 @@ TEST_F(ObsoleteFilesTest, RaceForObsoleteFileDeletion) {
} ) ;
} ) ;
SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
createLevel0Files ( 2 , 50000 ) ;
CheckFileTypeCounts ( options_ . wal_dir , 1 , 0 , 0 ) ;
DBImpl * dbi = reinterpret_cast < DBImpl * > ( db_ ) ;
DBImpl * dbi = reinterpret_cast < DBImpl * > ( db_ ) ;
port : : Thread user_thread ( [ & ] ( ) {
port : : Thread user_thread ( [ & ] ( ) {
JobContext jobCxt ( 0 ) ;
JobContext jobCxt ( 0 ) ;
@ -196,12 +196,10 @@ TEST_F(ObsoleteFilesTest, RaceForObsoleteFileDeletion) {
user_thread . join ( ) ;
user_thread . join ( ) ;
CloseDB ( ) ;
CloseDB ( ) ;
SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
}
}
TEST_F ( ObsoleteFilesTest , DeleteObsoleteOptionsFile ) {
TEST_F ( ObsoleteFilesTest , DeleteObsoleteOptionsFile ) {
createLevel0Files ( 2 , 50000 ) ;
CheckFileTypeCounts ( options_ . wal_dir , 1 , 0 , 0 ) ;
std : : vector < uint64_t > optsfiles_nums ;
std : : vector < uint64_t > optsfiles_nums ;
std : : vector < bool > optsfiles_keep ;
std : : vector < bool > optsfiles_keep ;
SyncPoint : : GetInstance ( ) - > SetCallBack (
SyncPoint : : GetInstance ( ) - > SetCallBack (
@ -214,6 +212,9 @@ TEST_F(ObsoleteFilesTest, DeleteObsoleteOptionsFile) {
} ) ;
} ) ;
SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
createLevel0Files ( 2 , 50000 ) ;
CheckFileTypeCounts ( options_ . wal_dir , 1 , 0 , 0 ) ;
DBImpl * dbi = static_cast < DBImpl * > ( db_ ) ;
DBImpl * dbi = static_cast < DBImpl * > ( db_ ) ;
ASSERT_OK ( dbi - > DisableFileDeletions ( ) ) ;
ASSERT_OK ( dbi - > DisableFileDeletions ( ) ) ;
for ( int i = 0 ; i ! = 4 ; + + i ) {
for ( int i = 0 ; i ! = 4 ; + + i ) {
@ -245,6 +246,7 @@ TEST_F(ObsoleteFilesTest, DeleteObsoleteOptionsFile) {
}
}
}
}
ASSERT_EQ ( 2 , opts_file_count ) ;
ASSERT_EQ ( 2 , opts_file_count ) ;
SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
}
}
} //namespace rocksdb
} //namespace rocksdb