Fix clang-analyze: use uninitiated variable (#8325)

Summary:
Error:
```
db/db_compaction_test.cc:5211:47: warning: The left operand of '*' is a garbage value
uint64_t total = (l1_avg_size + l2_avg_size * 10) * 10;
```

Pull Request resolved: https://github.com/facebook/rocksdb/pull/8325

Test Plan: `$ make analyze`

Reviewed By: pdillinger

Differential Revision: D28620916

Pulled By: jay-zhuang

fbshipit-source-id: f6d58ab84eefbcc905cda45afb9522b0c6d230f8
This commit is contained in:
Jay Zhuang 2021-05-21 19:05:54 -07:00 committed by Facebook GitHub Bot
parent 7303d02bdf
commit 55853de661
1 changed files with 2 additions and 2 deletions

View File

@ -5154,7 +5154,7 @@ TEST_F(DBCompactionTest, ManualCompactionBottomLevelOptimized) {
}
TEST_F(DBCompactionTest, ManualCompactionMax) {
uint64_t l1_avg_size, l2_avg_size;
uint64_t l1_avg_size = 0, l2_avg_size = 0;
auto generate_sst_func = [&]() {
Random rnd(301);
for (auto i = 0; i < 100; i++) {
@ -5208,7 +5208,7 @@ TEST_F(DBCompactionTest, ManualCompactionMax) {
ASSERT_TRUE(num_compactions.load() == 1);
// split the compaction to 5
uint64_t total = (l1_avg_size + l2_avg_size * 10) * 10;
uint64_t total = (l1_avg_size * 10) + (l2_avg_size * 100);
int num_split = 5;
opts.max_compaction_bytes = total / num_split;
DestroyAndReopen(opts);