@ -33,6 +33,7 @@ class CompactionPickerTest : public testing::Test {
Options options_ ;
Options options_ ;
ImmutableCFOptions ioptions_ ;
ImmutableCFOptions ioptions_ ;
MutableCFOptions mutable_cf_options_ ;
MutableCFOptions mutable_cf_options_ ;
MutableDBOptions mutable_db_options_ ;
LevelCompactionPicker level_compaction_picker ;
LevelCompactionPicker level_compaction_picker ;
std : : string cf_name_ ;
std : : string cf_name_ ;
CountingLogger logger_ ;
CountingLogger logger_ ;
@ -52,6 +53,7 @@ class CompactionPickerTest : public testing::Test {
icmp_ ( ucmp_ ) ,
icmp_ ( ucmp_ ) ,
ioptions_ ( options_ ) ,
ioptions_ ( options_ ) ,
mutable_cf_options_ ( options_ ) ,
mutable_cf_options_ ( options_ ) ,
mutable_db_options_ ( ) ,
level_compaction_picker ( ioptions_ , & icmp_ ) ,
level_compaction_picker ( ioptions_ , & icmp_ ) ,
cf_name_ ( " dummy " ) ,
cf_name_ ( " dummy " ) ,
log_buffer_ ( InfoLogLevel : : INFO_LEVEL , & logger_ ) ,
log_buffer_ ( InfoLogLevel : : INFO_LEVEL , & logger_ ) ,
@ -181,7 +183,8 @@ TEST_F(CompactionPickerTest, Empty) {
NewVersionStorage ( 6 , kCompactionStyleLevel ) ;
NewVersionStorage ( 6 , kCompactionStyleLevel ) ;
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) = = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) = = nullptr ) ;
}
}
@ -192,7 +195,8 @@ TEST_F(CompactionPickerTest, Single) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) = = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) = = nullptr ) ;
}
}
@ -205,7 +209,8 @@ TEST_F(CompactionPickerTest, Level0Trigger) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
ASSERT_EQ ( 1U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
@ -218,7 +223,8 @@ TEST_F(CompactionPickerTest, Level1Trigger) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 66U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
ASSERT_EQ ( 66U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
@ -236,7 +242,8 @@ TEST_F(CompactionPickerTest, Level1Trigger2) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 1 ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 1 ) ) ;
@ -267,7 +274,8 @@ TEST_F(CompactionPickerTest, LevelMaxScore) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 7U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
ASSERT_EQ ( 7U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
@ -314,7 +322,8 @@ TEST_F(CompactionPickerTest, Level0TriggerDynamic) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
ASSERT_EQ ( 1U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
@ -338,7 +347,8 @@ TEST_F(CompactionPickerTest, Level0TriggerDynamic2) {
ASSERT_EQ ( vstorage_ - > base_level ( ) , num_levels - 2 ) ;
ASSERT_EQ ( vstorage_ - > base_level ( ) , num_levels - 2 ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
ASSERT_EQ ( 1U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
@ -363,7 +373,8 @@ TEST_F(CompactionPickerTest, Level0TriggerDynamic3) {
ASSERT_EQ ( vstorage_ - > base_level ( ) , num_levels - 3 ) ;
ASSERT_EQ ( vstorage_ - > base_level ( ) , num_levels - 3 ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
ASSERT_EQ ( 1U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
@ -392,7 +403,8 @@ TEST_F(CompactionPickerTest, Level0TriggerDynamic4) {
ASSERT_EQ ( vstorage_ - > base_level ( ) , num_levels - 3 ) ;
ASSERT_EQ ( vstorage_ - > base_level ( ) , num_levels - 3 ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
ASSERT_EQ ( 1U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
@ -424,7 +436,8 @@ TEST_F(CompactionPickerTest, LevelTriggerDynamic4) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 5U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
ASSERT_EQ ( 5U , compaction - > input ( 0 , 0 ) - > fd . GetNumber ( ) ) ;
@ -481,7 +494,8 @@ TEST_F(CompactionPickerTest, CompactionUniversalIngestBehindReservedLevel) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
// output level should be the one above the bottom-most
// output level should be the one above the bottom-most
ASSERT_EQ ( 1 , compaction - > output_level ( ) ) ;
ASSERT_EQ ( 1 , compaction - > output_level ( ) ) ;
@ -515,7 +529,8 @@ TEST_F(CompactionPickerTest, CannotTrivialMoveUniversal) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( ! compaction - > is_trivial_move ( ) ) ;
ASSERT_TRUE ( ! compaction - > is_trivial_move ( ) ) ;
}
}
@ -541,7 +556,8 @@ TEST_F(CompactionPickerTest, AllowsTrivialMoveUniversal) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction - > is_trivial_move ( ) ) ;
ASSERT_TRUE ( compaction - > is_trivial_move ( ) ) ;
}
}
@ -569,7 +585,8 @@ TEST_F(CompactionPickerTest, UniversalPeriodicCompaction1) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction ) ;
ASSERT_TRUE ( compaction ) ;
ASSERT_EQ ( 4 , compaction - > output_level ( ) ) ;
ASSERT_EQ ( 4 , compaction - > output_level ( ) ) ;
@ -599,7 +616,8 @@ TEST_F(CompactionPickerTest, UniversalPeriodicCompaction2) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_FALSE ( compaction ) ;
ASSERT_FALSE ( compaction ) ;
}
}
@ -625,7 +643,8 @@ TEST_F(CompactionPickerTest, UniversalPeriodicCompaction3) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_FALSE ( compaction ) ;
ASSERT_FALSE ( compaction ) ;
}
}
@ -655,7 +674,8 @@ TEST_F(CompactionPickerTest, UniversalPeriodicCompaction4) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( ! compaction | |
ASSERT_TRUE ( ! compaction | |
compaction - > start_level ( ) ! = compaction - > output_level ( ) ) ;
compaction - > start_level ( ) ! = compaction - > output_level ( ) ) ;
}
}
@ -675,7 +695,8 @@ TEST_F(CompactionPickerTest, UniversalPeriodicCompaction5) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction ) ;
ASSERT_TRUE ( compaction ) ;
ASSERT_EQ ( 0 , compaction - > start_level ( ) ) ;
ASSERT_EQ ( 0 , compaction - > start_level ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
@ -699,7 +720,8 @@ TEST_F(CompactionPickerTest, UniversalPeriodicCompaction6) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction ) ;
ASSERT_TRUE ( compaction ) ;
ASSERT_EQ ( 4 , compaction - > start_level ( ) ) ;
ASSERT_EQ ( 4 , compaction - > start_level ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
@ -759,7 +781,8 @@ TEST_F(CompactionPickerTest, CompactionPriMinOverlapping1) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
// Pick file 8 because it overlaps with 0 files on level 3.
// Pick file 8 because it overlaps with 0 files on level 3.
@ -791,7 +814,8 @@ TEST_F(CompactionPickerTest, CompactionPriMinOverlapping2) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
// Picking file 7 because overlapping ratio is the biggest.
// Picking file 7 because overlapping ratio is the biggest.
@ -818,7 +842,8 @@ TEST_F(CompactionPickerTest, CompactionPriMinOverlapping3) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
// Picking file 8 because overlapping ratio is the biggest.
// Picking file 8 because overlapping ratio is the biggest.
@ -847,7 +872,8 @@ TEST_F(CompactionPickerTest, CompactionPriMinOverlapping4) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
// Picking file 8 because overlapping ratio is the biggest.
// Picking file 8 because overlapping ratio is the biggest.
@ -874,7 +900,8 @@ TEST_F(CompactionPickerTest, ParentIndexResetBug) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
}
}
// This test checks ExpandWhileOverlapping() by having overlapping user keys
// This test checks ExpandWhileOverlapping() by having overlapping user keys
@ -891,7 +918,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
@ -910,7 +938,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys2) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_files ( 0 ) ) ;
@ -937,7 +966,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys3) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 5U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 5U , compaction - > num_input_files ( 0 ) ) ;
@ -967,7 +997,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys4) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
@ -990,7 +1021,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys5) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) = = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) = = nullptr ) ;
}
}
@ -1011,7 +1043,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys6) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
@ -1031,7 +1064,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys7) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_GE ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_GE ( 1U , compaction - > num_input_files ( 0 ) ) ;
@ -1059,7 +1093,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys8) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 3U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 3U , compaction - > num_input_files ( 0 ) ) ;
@ -1091,7 +1126,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys9) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 5U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 5U , compaction - > num_input_files ( 0 ) ) ;
@ -1131,7 +1167,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys10) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
@ -1169,7 +1206,8 @@ TEST_F(CompactionPickerTest, OverlappingUserKeys11) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
@ -1206,7 +1244,8 @@ TEST_F(CompactionPickerTest, NotScheduleL1IfL0WithHigherPri1) {
ASSERT_EQ ( 0 , vstorage_ - > CompactionScoreLevel ( 0 ) ) ;
ASSERT_EQ ( 0 , vstorage_ - > CompactionScoreLevel ( 0 ) ) ;
ASSERT_EQ ( 1 , vstorage_ - > CompactionScoreLevel ( 1 ) ) ;
ASSERT_EQ ( 1 , vstorage_ - > CompactionScoreLevel ( 1 ) ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) = = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) = = nullptr ) ;
}
}
@ -1236,7 +1275,8 @@ TEST_F(CompactionPickerTest, NotScheduleL1IfL0WithHigherPri2) {
ASSERT_EQ ( 0 , vstorage_ - > CompactionScoreLevel ( 0 ) ) ;
ASSERT_EQ ( 0 , vstorage_ - > CompactionScoreLevel ( 0 ) ) ;
ASSERT_EQ ( 1 , vstorage_ - > CompactionScoreLevel ( 1 ) ) ;
ASSERT_EQ ( 1 , vstorage_ - > CompactionScoreLevel ( 1 ) ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
}
}
@ -1269,7 +1309,8 @@ TEST_F(CompactionPickerTest, NotScheduleL1IfL0WithHigherPri3) {
ASSERT_EQ ( 1 , vstorage_ - > CompactionScoreLevel ( 0 ) ) ;
ASSERT_EQ ( 1 , vstorage_ - > CompactionScoreLevel ( 0 ) ) ;
ASSERT_EQ ( 0 , vstorage_ - > CompactionScoreLevel ( 1 ) ) ;
ASSERT_EQ ( 0 , vstorage_ - > CompactionScoreLevel ( 1 ) ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
}
}
@ -1563,7 +1604,8 @@ TEST_F(CompactionPickerTest, MaxCompactionBytesHit) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
@ -1587,7 +1629,8 @@ TEST_F(CompactionPickerTest, MaxCompactionBytesNotHit) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 2U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 3U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 3U , compaction - > num_input_files ( 0 ) ) ;
@ -1616,7 +1659,8 @@ TEST_F(CompactionPickerTest, IsTrivialMoveOn) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction - > IsTrivialMove ( ) ) ;
ASSERT_TRUE ( compaction - > IsTrivialMove ( ) ) ;
}
}
@ -1637,7 +1681,8 @@ TEST_F(CompactionPickerTest, IsTrivialMoveOff) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_FALSE ( compaction - > IsTrivialMove ( ) ) ;
ASSERT_FALSE ( compaction - > IsTrivialMove ( ) ) ;
}
}
@ -1662,7 +1707,8 @@ TEST_F(CompactionPickerTest, CacheNextCompactionIndex) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
@ -1671,7 +1717,8 @@ TEST_F(CompactionPickerTest, CacheNextCompactionIndex) {
ASSERT_EQ ( 2 , vstorage_ - > NextCompactionIndex ( 1 /* level */ ) ) ;
ASSERT_EQ ( 2 , vstorage_ - > NextCompactionIndex ( 1 /* level */ ) ) ;
compaction . reset ( level_compaction_picker . PickCompaction (
compaction . reset ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_files ( 0 ) ) ;
@ -1680,7 +1727,8 @@ TEST_F(CompactionPickerTest, CacheNextCompactionIndex) {
ASSERT_EQ ( 3 , vstorage_ - > NextCompactionIndex ( 1 /* level */ ) ) ;
ASSERT_EQ ( 3 , vstorage_ - > NextCompactionIndex ( 1 /* level */ ) ) ;
compaction . reset ( level_compaction_picker . PickCompaction (
compaction . reset ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) = = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) = = nullptr ) ;
ASSERT_EQ ( 4 , vstorage_ - > NextCompactionIndex ( 1 /* level */ ) ) ;
ASSERT_EQ ( 4 , vstorage_ - > NextCompactionIndex ( 1 /* level */ ) ) ;
}
}
@ -1705,7 +1753,8 @@ TEST_F(CompactionPickerTest, IntraL0MaxCompactionBytesNotHit) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 5U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 5U , compaction - > num_input_files ( 0 ) ) ;
@ -1735,7 +1784,8 @@ TEST_F(CompactionPickerTest, IntraL0MaxCompactionBytesHit) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 4U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 4U , compaction - > num_input_files ( 0 ) ) ;
@ -1767,7 +1817,8 @@ TEST_F(CompactionPickerTest, IntraL0ForEarliestSeqno) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
std : : unique_ptr < Compaction > compaction ( level_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ , 107 ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ , 107 ) ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_TRUE ( compaction . get ( ) ! = nullptr ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 1U , compaction - > num_input_levels ( ) ) ;
ASSERT_EQ ( 4U , compaction - > num_input_files ( 0 ) ) ;
ASSERT_EQ ( 4U , compaction - > num_input_files ( 0 ) ) ;
@ -1799,7 +1850,8 @@ TEST_F(CompactionPickerTest, UniversalMarkedCompactionFullOverlap) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction ) ;
ASSERT_TRUE ( compaction ) ;
// Validate that its a compaction to reduce sorted runs
// Validate that its a compaction to reduce sorted runs
@ -1816,7 +1868,8 @@ TEST_F(CompactionPickerTest, UniversalMarkedCompactionFullOverlap) {
std : : unique_ptr < Compaction > compaction2 (
std : : unique_ptr < Compaction > compaction2 (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_FALSE ( compaction2 ) ;
ASSERT_FALSE ( compaction2 ) ;
}
}
@ -1840,7 +1893,8 @@ TEST_F(CompactionPickerTest, UniversalMarkedCompactionFullOverlap2) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction ) ;
ASSERT_TRUE ( compaction ) ;
// Validate that its a delete triggered compaction
// Validate that its a delete triggered compaction
@ -1858,7 +1912,8 @@ TEST_F(CompactionPickerTest, UniversalMarkedCompactionFullOverlap2) {
std : : unique_ptr < Compaction > compaction2 (
std : : unique_ptr < Compaction > compaction2 (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_FALSE ( compaction2 ) ;
ASSERT_FALSE ( compaction2 ) ;
}
}
@ -1898,7 +1953,8 @@ TEST_F(CompactionPickerTest, UniversalMarkedCompactionStartOutputOverlap) {
std : : unique_ptr < Compaction > compaction (
std : : unique_ptr < Compaction > compaction (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_TRUE ( compaction ) ;
ASSERT_TRUE ( compaction ) ;
// Validate that its a delete triggered compaction
// Validate that its a delete triggered compaction
@ -1928,7 +1984,8 @@ TEST_F(CompactionPickerTest, UniversalMarkedCompactionStartOutputOverlap) {
random_index = 0 ;
random_index = 0 ;
std : : unique_ptr < Compaction > compaction2 (
std : : unique_ptr < Compaction > compaction2 (
universal_compaction_picker . PickCompaction (
universal_compaction_picker . PickCompaction (
cf_name_ , mutable_cf_options_ , vstorage_ . get ( ) , & log_buffer_ ) ) ;
cf_name_ , mutable_cf_options_ , mutable_db_options_ , vstorage_ . get ( ) ,
& log_buffer_ ) ) ;
ASSERT_FALSE ( compaction2 ) ;
ASSERT_FALSE ( compaction2 ) ;
DeleteVersionStorage ( ) ;
DeleteVersionStorage ( ) ;
}
}