@ -3091,6 +3091,13 @@ TEST_F(DBCompactionTest, CompactBottomLevelFilesWithDeletions) {
// compactions should be triggered, which reduce the size of each bottom-level
// compactions should be triggered, which reduce the size of each bottom-level
// file without changing file count.
// file without changing file count.
db_ - > ReleaseSnapshot ( snapshot ) ;
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 ( ) ;
dbfull ( ) - > TEST_WaitForCompact ( ) ;
db_ - > GetLiveFilesMetaData ( & post_release_metadata ) ;
db_ - > GetLiveFilesMetaData ( & post_release_metadata ) ;
ASSERT_EQ ( pre_release_metadata . size ( ) , post_release_metadata . size ( ) ) ;
ASSERT_EQ ( pre_release_metadata . size ( ) , post_release_metadata . size ( ) ) ;
@ -3104,6 +3111,7 @@ TEST_F(DBCompactionTest, CompactBottomLevelFilesWithDeletions) {
// deletion markers/deleted keys.
// deletion markers/deleted keys.
ASSERT_LT ( post_file . size , pre_file . size ) ;
ASSERT_LT ( post_file . size , pre_file . size ) ;
}
}
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
}
}
TEST_F ( DBCompactionTest , LevelCompactExpiredTtlFiles ) {
TEST_F ( DBCompactionTest , LevelCompactExpiredTtlFiles ) {
@ -3153,9 +3161,16 @@ TEST_F(DBCompactionTest, LevelCompactExpiredTtlFiles) {
// compacted.
// compacted.
ASSERT_OK ( Put ( " a " , " 1 " ) ) ;
ASSERT_OK ( Put ( " a " , " 1 " ) ) ;
Flush ( ) ;
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 ( ) ;
dbfull ( ) - > TEST_WaitForCompact ( ) ;
// All non-L0 files are deleted, as they contained only deleted data.
// All non-L0 files are deleted, as they contained only deleted data.
ASSERT_EQ ( " 1 " , FilesPerLevel ( ) ) ;
ASSERT_EQ ( " 1 " , FilesPerLevel ( ) ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
}
}
TEST_F ( DBCompactionTest , CompactRangeDelayedByL0FileCount ) {
TEST_F ( DBCompactionTest , CompactRangeDelayedByL0FileCount ) {