Fixed false alarm of size comparison in compaction_job_stats_test
Summary: Fixed false alarm of size comparison in compaction_job_stats_test Test Plan: compaction_job_stats_test Reviewers: igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D39921
This commit is contained in:
parent
cccd2199a6
commit
5fec963877
@ -371,11 +371,9 @@ class CompactionJobStatsChecker : public EventListener {
|
|||||||
|
|
||||||
// A helper function which verifies whether two CompactionJobStats
|
// A helper function which verifies whether two CompactionJobStats
|
||||||
// match. The verification of all compaction stats are done by
|
// match. The verification of all compaction stats are done by
|
||||||
// ASSERT_EQ except the following stats, which we use ASSERT_GE
|
// ASSERT_EQ except for the total input / output bytes, which we
|
||||||
// and ASSERT_LE with a reasonable (< 15%) bias:
|
// use ASSERT_GE and ASSERT_LE with a reasonable bias ---
|
||||||
// 1. write-amplication
|
// 10% in uncompressed case and 20% when compression is used.
|
||||||
// 2. actual bytes input and output, which relies on the compression
|
|
||||||
// ratio and the implementation of table formats.
|
|
||||||
void Verify(const CompactionJobStats& current_stats,
|
void Verify(const CompactionJobStats& current_stats,
|
||||||
const CompactionJobStats& stats) {
|
const CompactionJobStats& stats) {
|
||||||
// time
|
// time
|
||||||
@ -397,7 +395,7 @@ class CompactionJobStatsChecker : public EventListener {
|
|||||||
stats.is_manual_compaction);
|
stats.is_manual_compaction);
|
||||||
|
|
||||||
// file size
|
// file size
|
||||||
double kFileSizeBias = 0.15;
|
double kFileSizeBias = compression_enabled_ ? 0.20 : 0.10;
|
||||||
ASSERT_GE(current_stats.total_input_bytes * (1.00 + kFileSizeBias),
|
ASSERT_GE(current_stats.total_input_bytes * (1.00 + kFileSizeBias),
|
||||||
stats.total_input_bytes);
|
stats.total_input_bytes);
|
||||||
ASSERT_LE(current_stats.total_input_bytes,
|
ASSERT_LE(current_stats.total_input_bytes,
|
||||||
@ -569,7 +567,7 @@ TEST_F(CompactionJobStatsTest, CompactionJobStatsTest) {
|
|||||||
MakeTableWithKeyValues(
|
MakeTableWithKeyValues(
|
||||||
&rnd, start_key, start_key + key_base - 1,
|
&rnd, start_key, start_key + key_base - 1,
|
||||||
kKeySize, kValueSize, key_interval,
|
kKeySize, kValueSize, key_interval,
|
||||||
kCompressionRatio, 1);
|
compression_ratio, 1);
|
||||||
snprintf(buf, kBufSize, "%d", ++num_L0_files);
|
snprintf(buf, kBufSize, "%d", ++num_L0_files);
|
||||||
ASSERT_EQ(std::string(buf), FilesPerLevel(1));
|
ASSERT_EQ(std::string(buf), FilesPerLevel(1));
|
||||||
}
|
}
|
||||||
@ -627,7 +625,7 @@ TEST_F(CompactionJobStatsTest, CompactionJobStatsTest) {
|
|||||||
&rnd, start_key, start_key + key_base * sparseness - 1,
|
&rnd, start_key, start_key + key_base * sparseness - 1,
|
||||||
kKeySize, kValueSize,
|
kKeySize, kValueSize,
|
||||||
key_base * sparseness / num_keys_per_L0_file,
|
key_base * sparseness / num_keys_per_L0_file,
|
||||||
kCompressionRatio, 1);
|
compression_ratio, 1);
|
||||||
snprintf(buf, kBufSize, "%d,%d", ++num_L0_files, num_L1_files);
|
snprintf(buf, kBufSize, "%d,%d", ++num_L0_files, num_L1_files);
|
||||||
ASSERT_EQ(std::string(buf), FilesPerLevel(1));
|
ASSERT_EQ(std::string(buf), FilesPerLevel(1));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user