@ -2458,7 +2458,7 @@ TEST_F(ColumnFamilyTest, WriteStallSingleColumnFamily) {
ASSERT_TRUE ( ! dbfull ( ) - > TEST_write_controler ( ) . IsStopped ( ) ) ;
ASSERT_TRUE ( dbfull ( ) - > TEST_write_controler ( ) . NeedsDelay ( ) ) ;
ASSERT_EQ ( kBaseRate , dbfull ( ) - > TEST_write_controler ( ) . delayed_write_rate ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 400 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
@ -2466,7 +2466,7 @@ TEST_F(ColumnFamilyTest, WriteStallSingleColumnFamily) {
ASSERT_TRUE ( dbfull ( ) - > TEST_write_controler ( ) . NeedsDelay ( ) ) ;
ASSERT_EQ ( kBaseRate / 1.2 ,
dbfull ( ) - > TEST_write_controler ( ) . delayed_write_rate ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 500 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
@ -2522,7 +2522,7 @@ TEST_F(ColumnFamilyTest, WriteStallSingleColumnFamily) {
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_TRUE ( dbfull ( ) - > TEST_write_controler ( ) . IsStopped ( ) ) ;
ASSERT_TRUE ( ! dbfull ( ) - > TEST_write_controler ( ) . NeedsDelay ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 3001 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
@ -2547,7 +2547,7 @@ TEST_F(ColumnFamilyTest, WriteStallSingleColumnFamily) {
ASSERT_TRUE ( dbfull ( ) - > TEST_write_controler ( ) . NeedsDelay ( ) ) ;
ASSERT_EQ ( kBaseRate / 1.2 ,
dbfull ( ) - > TEST_write_controler ( ) . delayed_write_rate ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 101 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
@ -2641,31 +2641,31 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupSingleColumnFamily) {
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 40 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 50 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 300 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 45 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 7 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 9 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 6 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
// Speed up threshold = min(4 * 2, 4 + (12 - 4)/4) = 6
mutable_cf_options . level0_file_num_compaction_trigger = 4 ;
@ -2674,15 +2674,15 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupSingleColumnFamily) {
vstorage - > set_l0_delay_trigger_count ( 5 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 7 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 3 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
}
TEST_F ( ColumnFamilyTest , WriteStallTwoColumnFamilies ) {
@ -2794,41 +2794,41 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupTwoColumnFamilies) {
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 40 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 60 ) ;
cfd1 - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage1 - > TEST_set_estimated_compaction_needed_bytes ( 30 ) ;
cfd1 - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage1 - > TEST_set_estimated_compaction_needed_bytes ( 70 ) ;
cfd1 - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > TEST_set_estimated_compaction_needed_bytes ( 20 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage1 - > TEST_set_estimated_compaction_needed_bytes ( 3 ) ;
cfd1 - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 9 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage1 - > set_l0_delay_trigger_count ( 2 ) ;
cfd1 - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 6 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
vstorage - > set_l0_delay_trigger_count ( 0 ) ;
cfd - > RecalculateWriteStallConditions ( mutable_cf_options ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 2 , dbfull ( ) - > TEST_ BGCompactionsAllowed( ) ) ;
}
# ifndef ROCKSDB_LITE