@ -3091,6 +3091,13 @@ TEST_F(DBCompactionTest, CompactBottomLevelFilesWithDeletions) {
// compactions should be triggered, which reduce the size of each bottom-level
// file without changing file count.
db_ - > ReleaseSnapshot ( snapshot ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
" LevelCompactionPicker::PickCompaction:Return " , [ & ] ( void * arg ) {
Compaction * compaction = reinterpret_cast < Compaction * > ( arg ) ;
ASSERT_TRUE ( compaction - > compaction_reason ( ) = =
CompactionReason : : kBottommostFiles ) ;
} ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
dbfull ( ) - > TEST_WaitForCompact ( ) ;
db_ - > GetLiveFilesMetaData ( & post_release_metadata ) ;
ASSERT_EQ ( pre_release_metadata . size ( ) , post_release_metadata . size ( ) ) ;
@ -3104,6 +3111,7 @@ TEST_F(DBCompactionTest, CompactBottomLevelFilesWithDeletions) {
// deletion markers/deleted keys.
ASSERT_LT ( post_file . size , pre_file . size ) ;
}
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
}
TEST_F ( DBCompactionTest , LevelCompactExpiredTtlFiles ) {
@ -3153,9 +3161,16 @@ TEST_F(DBCompactionTest, LevelCompactExpiredTtlFiles) {
// compacted.
ASSERT_OK ( Put ( " a " , " 1 " ) ) ;
Flush ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
" LevelCompactionPicker::PickCompaction:Return " , [ & ] ( void * arg ) {
Compaction * compaction = reinterpret_cast < Compaction * > ( arg ) ;
ASSERT_TRUE ( compaction - > compaction_reason ( ) = = CompactionReason : : kTtl ) ;
} ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
dbfull ( ) - > TEST_WaitForCompact ( ) ;
// All non-L0 files are deleted, as they contained only deleted data.
ASSERT_EQ ( " 1 " , FilesPerLevel ( ) ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
}
TEST_F ( DBCompactionTest , CompactRangeDelayedByL0FileCount ) {