@ -1380,7 +1380,6 @@ TEST_F(ColumnFamilyTest, AutomaticAndManualCompactions) {
ColumnFamilyOptions default_cf , one , two ;
db_options_ . max_open_files = 20 ; // only 10 files in file cache
db_options_ . max_background_compactions = 3 ;
db_options_ . base_background_compactions = 3 ;
default_cf . compaction_style = kCompactionStyleLevel ;
default_cf . num_levels = 3 ;
@ -1404,6 +1403,9 @@ TEST_F(ColumnFamilyTest, AutomaticAndManualCompactions) {
two . write_buffer_size = 100000 ;
Reopen ( { default_cf , one , two } ) ;
// make sure all background compaction jobs can be scheduled
auto stop_token =
dbfull ( ) - > TEST_write_controler ( ) . GetCompactionPressureToken ( ) ;
bool cf_1_1 = true ;
rocksdb : : SyncPoint : : GetInstance ( ) - > LoadDependency (
@ -1472,7 +1474,6 @@ TEST_F(ColumnFamilyTest, ManualAndAutomaticCompactions) {
ColumnFamilyOptions default_cf , one , two ;
db_options_ . max_open_files = 20 ; // only 10 files in file cache
db_options_ . max_background_compactions = 3 ;
db_options_ . base_background_compactions = 3 ;
default_cf . compaction_style = kCompactionStyleLevel ;
default_cf . num_levels = 3 ;
@ -1496,6 +1497,9 @@ TEST_F(ColumnFamilyTest, ManualAndAutomaticCompactions) {
two . write_buffer_size = 100000 ;
Reopen ( { default_cf , one , two } ) ;
// make sure all background compaction jobs can be scheduled
auto stop_token =
dbfull ( ) - > TEST_write_controler ( ) . GetCompactionPressureToken ( ) ;
// SETUP column family "one" -- universal style
for ( int i = 0 ; i < one . level0_file_num_compaction_trigger - 2 ; + + i ) {
@ -1567,7 +1571,6 @@ TEST_F(ColumnFamilyTest, SameCFManualManualCompactions) {
ColumnFamilyOptions default_cf , one ;
db_options_ . max_open_files = 20 ; // only 10 files in file cache
db_options_ . max_background_compactions = 3 ;
db_options_ . base_background_compactions = 3 ;
default_cf . compaction_style = kCompactionStyleLevel ;
default_cf . num_levels = 3 ;
@ -1586,6 +1589,9 @@ TEST_F(ColumnFamilyTest, SameCFManualManualCompactions) {
one . write_buffer_size = 120000 ;
Reopen ( { default_cf , one } ) ;
// make sure all background compaction jobs can be scheduled
auto stop_token =
dbfull ( ) - > TEST_write_controler ( ) . GetCompactionPressureToken ( ) ;
// SETUP column family "one" -- universal style
for ( int i = 0 ; i < one . level0_file_num_compaction_trigger - 2 ; + + i ) {
@ -1665,7 +1671,6 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactions) {
ColumnFamilyOptions default_cf , one ;
db_options_ . max_open_files = 20 ; // only 10 files in file cache
db_options_ . max_background_compactions = 3 ;
db_options_ . base_background_compactions = 3 ;
default_cf . compaction_style = kCompactionStyleLevel ;
default_cf . num_levels = 3 ;
@ -1684,6 +1689,9 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactions) {
one . write_buffer_size = 120000 ;
Reopen ( { default_cf , one } ) ;
// make sure all background compaction jobs can be scheduled
auto stop_token =
dbfull ( ) - > TEST_write_controler ( ) . GetCompactionPressureToken ( ) ;
// SETUP column family "one" -- universal style
for ( int i = 0 ; i < one . level0_file_num_compaction_trigger - 2 ; + + i ) {
@ -1754,7 +1762,6 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) {
ColumnFamilyOptions default_cf , one ;
db_options_ . max_open_files = 20 ; // only 10 files in file cache
db_options_ . max_background_compactions = 3 ;
db_options_ . base_background_compactions = 3 ;
default_cf . compaction_style = kCompactionStyleLevel ;
default_cf . num_levels = 3 ;
@ -1773,6 +1780,9 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) {
one . write_buffer_size = 120000 ;
Reopen ( { default_cf , one } ) ;
// make sure all background compaction jobs can be scheduled
auto stop_token =
dbfull ( ) - > TEST_write_controler ( ) . GetCompactionPressureToken ( ) ;
// SETUP column family "one" -- level style
for ( int i = 0 ; i < one . level0_file_num_compaction_trigger - 2 ; + + i ) {
@ -1850,7 +1860,6 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticConflict) {
ColumnFamilyOptions default_cf , one ;
db_options_ . max_open_files = 20 ; // only 10 files in file cache
db_options_ . max_background_compactions = 3 ;
db_options_ . base_background_compactions = 3 ;
default_cf . compaction_style = kCompactionStyleLevel ;
default_cf . num_levels = 3 ;
@ -1869,6 +1878,9 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticConflict) {
one . write_buffer_size = 120000 ;
Reopen ( { default_cf , one } ) ;
// make sure all background compaction jobs can be scheduled
auto stop_token =
dbfull ( ) - > TEST_write_controler ( ) . GetCompactionPressureToken ( ) ;
// SETUP column family "one" -- universal style
for ( int i = 0 ; i < one . level0_file_num_compaction_trigger - 2 ; + + i ) {
@ -1969,7 +1981,6 @@ TEST_F(ColumnFamilyTest, SameCFAutomaticManualCompactions) {
ColumnFamilyOptions default_cf , one ;
db_options_ . max_open_files = 20 ; // only 10 files in file cache
db_options_ . max_background_compactions = 3 ;
db_options_ . base_background_compactions = 3 ;
default_cf . compaction_style = kCompactionStyleLevel ;
default_cf . num_levels = 3 ;
@ -1988,6 +1999,9 @@ TEST_F(ColumnFamilyTest, SameCFAutomaticManualCompactions) {
one . write_buffer_size = 120000 ;
Reopen ( { default_cf , one } ) ;
// make sure all background compaction jobs can be scheduled
auto stop_token =
dbfull ( ) - > TEST_write_controler ( ) . GetCompactionPressureToken ( ) ;
bool cf_1_1 = true ;
bool cf_1_2 = true ;
@ -2496,7 +2510,6 @@ TEST_F(ColumnFamilyTest, CreateAndDropRace) {
TEST_F ( ColumnFamilyTest , WriteStallSingleColumnFamily ) {
const uint64_t kBaseRate = 800000u ;
db_options_ . delayed_write_rate = kBaseRate ;
db_options_ . base_background_compactions = 2 ;
db_options_ . max_background_compactions = 6 ;
Open ( { " default " } ) ;
@ -2677,7 +2690,6 @@ TEST_F(ColumnFamilyTest, WriteStallSingleColumnFamily) {
}
TEST_F ( ColumnFamilyTest , CompactionSpeedupSingleColumnFamily ) {
db_options_ . base_background_compactions = 2 ;
db_options_ . max_background_compactions = 6 ;
Open ( { " default " } ) ;
ColumnFamilyData * cfd =
@ -2697,7 +2709,7 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupSingleColumnFamily) {
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 40 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 50 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
@ -2709,11 +2721,11 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupSingleColumnFamily) {
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 45 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 7 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 9 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
@ -2721,7 +2733,7 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupSingleColumnFamily) {
vstorage - > set_l0_delay_trigger_count ( 6 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
// Speed up threshold = min(4 * 2, 4 + (12 - 4)/4) = 6
mutable_cf_options . level0_file_num_compaction_trigger = 4 ;
@ -2730,7 +2742,7 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupSingleColumnFamily) {
vstorage - > set_l0_delay_trigger_count ( 5 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 7 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
@ -2738,7 +2750,7 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupSingleColumnFamily) {
vstorage - > set_l0_delay_trigger_count ( 3 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
}
TEST_F ( ColumnFamilyTest , WriteStallTwoColumnFamilies ) {
@ -2817,7 +2829,6 @@ TEST_F(ColumnFamilyTest, WriteStallTwoColumnFamilies) {
}
TEST_F ( ColumnFamilyTest , CompactionSpeedupTwoColumnFamilies ) {
db_options_ . base_background_compactions = 2 ;
db_options_ . max_background_compactions = 6 ;
column_family_options_ . soft_pending_compaction_bytes_limit = 200 ;
column_family_options_ . hard_pending_compaction_bytes_limit = 2000 ;
@ -2845,11 +2856,11 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupTwoColumnFamilies) {
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 40 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 60 ) ;
cfd1 - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
@ -2867,7 +2878,7 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupTwoColumnFamilies) {
vstorage1 - > TEST_set_estimated_compaction_needed_bytes ( 3 ) ;
cfd1 - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 9 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
@ -2879,7 +2890,7 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupTwoColumnFamilies) {
vstorage - > set_l0_delay_trigger_count ( 0 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
}
# ifndef ROCKSDB_LITE