Fix status check

This commit is contained in:
Jay Zhuang 2022-05-07 13:40:54 -07:00
parent 8ab9f4326a
commit 866cb4cf60
2 changed files with 12 additions and 10 deletions

View File

@ -586,6 +586,7 @@ struct CompactionJob::SubcompactionState {
c_iter(std::move(state.c_iter)),
start(state.start),
end(state.end),
status(std::move(state.status)),
io_status(std::move(state.io_status)),
files_to_cut_for_ttl(std::move(state.files_to_cut_for_ttl)),
cur_files_to_cut_for_ttl(state.cur_files_to_cut_for_ttl),

View File

@ -7520,7 +7520,7 @@ TEST_F(DBCompactionTest, SequenceBasedTieredStorageUniversal) {
ASSERT_OK(Flush());
seq_history.emplace_back(dbfull()->GetLatestSequenceNumber());
}
dbfull()->WaitForCompact(true);
ASSERT_OK(dbfull()->WaitForCompact(true));
// the last level file temperature is not cold
ASSERT_EQ("0,0,0,0,0,1", FilesPerLevel());
@ -7537,7 +7537,7 @@ TEST_F(DBCompactionTest, SequenceBasedTieredStorageUniversal) {
// delete all cold data
for (int i = 0; i < 10; i++) {
Delete(Key(i));
ASSERT_OK(Delete(Key(i)));
}
ASSERT_OK(Flush());
ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr));
@ -7617,7 +7617,7 @@ TEST_F(DBCompactionTest, RangeBasedTieredStorageUniversal) {
}
ASSERT_OK(Flush());
}
dbfull()->WaitForCompact(true);
ASSERT_OK(dbfull()->WaitForCompact(true));
ASSERT_EQ("0,0,0,0,0,1,1", FilesPerLevel());
ASSERT_GT(GetSstSizeHelper(Temperature::kUnknown), 0);
ASSERT_GT(GetSstSizeHelper(Temperature::kCold), 0);
@ -7660,7 +7660,8 @@ TEST_F(DBCompactionTest, RangeBasedTieredStorageUniversal) {
}
ASSERT_OK(Flush());
}
dbfull()->WaitForCompact(true); // make sure compaction is able to finish
ASSERT_OK(dbfull()->WaitForCompact(
true)); // make sure compaction is able to finish
ASSERT_EQ("0,0,0,0,0,1,1", FilesPerLevel());
ASSERT_GT(GetSstSizeHelper(Temperature::kUnknown), 0);
ASSERT_GT(GetSstSizeHelper(Temperature::kCold), 0);
@ -7671,7 +7672,7 @@ TEST_F(DBCompactionTest, RangeBasedTieredStorageUniversal) {
GetSstSizeHelper(Temperature::kCold) * max_size_amp);
// delete all cold data
Delete(Key(0));
ASSERT_OK(Delete(Key(0)));
ASSERT_OK(Flush());
ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr));
ASSERT_EQ("0,0,0,0,0,1", FilesPerLevel());
@ -7730,7 +7731,7 @@ TEST_F(DBCompactionTest, SequenceBasedTieredStorageLevel) {
}
ASSERT_OK(Flush());
}
dbfull()->WaitForCompact(true);
ASSERT_OK(dbfull()->WaitForCompact(true));
// The bottommost level is level1, no bottommost-1 to store the hot data, it
// might be a problem for small db, but if Dynamic Level Size is enabled, it
@ -7758,7 +7759,7 @@ TEST_F(DBCompactionTest, SequenceBasedTieredStorageLevel) {
ASSERT_OK(Flush());
seq_history.emplace_back(dbfull()->GetLatestSequenceNumber());
}
dbfull()->WaitForCompact(true);
ASSERT_OK(dbfull()->WaitForCompact(true));
ASSERT_EQ("0,1,0,0,0,0,1", FilesPerLevel());
ASSERT_GT(GetSstSizeHelper(Temperature::kUnknown), 0);
ASSERT_GT(GetSstSizeHelper(Temperature::kCold), 0);
@ -7788,7 +7789,7 @@ TEST_F(DBCompactionTest, SequenceBasedTieredStorageLevel) {
ASSERT_OK(Flush());
seq_history.emplace_back(dbfull()->GetLatestSequenceNumber());
}
dbfull()->WaitForCompact(true);
ASSERT_OK(dbfull()->WaitForCompact(true));
// Try to split the data to hot and cold
latest_cold_seq = seq_history[0];
@ -7799,7 +7800,7 @@ TEST_F(DBCompactionTest, SequenceBasedTieredStorageLevel) {
// delete all cold data
for (int i = 0; i < 10; i++) {
Delete(Key(i));
ASSERT_OK(Delete(Key(i)));
}
ASSERT_OK(Flush());
ASSERT_OK(db_->CompactRange(cro, nullptr, nullptr));
@ -7891,7 +7892,7 @@ TEST_F(DBCompactionTest, RangeBasedTieredStorageLevel) {
}
ASSERT_OK(Flush());
}
dbfull()->WaitForCompact(true);
ASSERT_OK(dbfull()->WaitForCompact(true));
ASSERT_EQ("0,0,0,0,0,1,1", FilesPerLevel());
ASSERT_GT(GetSstSizeHelper(Temperature::kUnknown), 0);
ASSERT_GT(GetSstSizeHelper(Temperature::kCold), 0);