diff --git a/db/compaction/compaction_service_test.cc b/db/compaction/compaction_service_test.cc index ce5fa6535a4..bb53a4029b6 100644 --- a/db/compaction/compaction_service_test.cc +++ b/db/compaction/compaction_service_test.cc @@ -103,10 +103,8 @@ class MyTestCompactionService : public CompactionService { InstrumentedMutexLock l(&mutex_); if (is_override_wait_result_) { *result = override_wait_result_; - } else { - CompactionServiceResult::Read(*result, &deserialized_result_) - .PermitUncheckedError(); } + result_ = *result; } compaction_num_.fetch_add(1); if (s.ok()) { @@ -149,7 +147,9 @@ class MyTestCompactionService : public CompactionService { void SetCanceled(bool canceled) { canceled_ = canceled; } - CompactionServiceResult GetResult() { return deserialized_result_; } + void GetResult(CompactionServiceResult* deserialized) { + CompactionServiceResult::Read(result_, deserialized).PermitUncheckedError(); + } CompactionServiceJobStatus GetFinalCompactionServiceJobStatus() { return final_updated_status_.load(); @@ -172,7 +172,7 @@ class MyTestCompactionService : public CompactionService { CompactionServiceJobStatus override_wait_status_ = CompactionServiceJobStatus::kFailure; bool is_override_wait_result_ = false; - CompactionServiceResult deserialized_result_; + std::string result_; std::string override_wait_result_; std::vector> listeners_; std::vector> @@ -342,7 +342,14 @@ TEST_F(CompactionServiceTest, BasicCompactions) { ReopenWithColumnFamilies({kDefaultColumnFamilyName, "cf_1", "cf_2", "cf_3"}, options); ASSERT_GT(verify_passed, 0); - ASSERT_TRUE(my_cs->GetResult().stats.is_remote_compaction); + CompactionServiceResult result; + my_cs->GetResult(&result); + if (s.IsAborted()) { + ASSERT_NOK(result.status); + } else { + ASSERT_OK(result.status); + } + ASSERT_TRUE(result.stats.is_remote_compaction); Close(); } @@ -382,8 +389,11 @@ TEST_F(CompactionServiceTest, ManualCompaction) { ASSERT_GE(my_cs->GetCompactionNum(), comp_num + 1); VerifyTestData(); - ASSERT_TRUE(my_cs->GetResult().stats.is_manual_compaction); - ASSERT_TRUE(my_cs->GetResult().stats.is_remote_compaction); + CompactionServiceResult result; + my_cs->GetResult(&result); + ASSERT_OK(result.status); + ASSERT_TRUE(result.stats.is_manual_compaction); + ASSERT_TRUE(result.stats.is_remote_compaction); } TEST_F(CompactionServiceTest, CancelCompactionOnRemoteSide) {