Skip to content

Commit e32c14e

Browse files
hx235meta-codesync[bot]
authored andcommitted
Stress/crash test improvement to remote compaction with resumable compaction (facebook#14041)
Summary: **Context/Summary:** - Add resumable compaction to stress test with adaptive progress cancellation - Add fault injection to remote compaction - Fix a real minor bug in a couple testing framework bugs with remote compaction Pull Request resolved: facebook#14041 Test Plan: - Rehearsal stress test, finding bugs for facebook#13984 effectively and did not create new failures. Reviewed By: jaykorean Differential Revision: D84524194 Pulled By: hx235 fbshipit-source-id: 42b4264e428c6739631ed9aa5eb02723367510bc
1 parent 6d9b526 commit e32c14e

16 files changed

Lines changed: 419 additions & 125 deletions

BUCK

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ rocks_cpp_library_wrapper(name="rocksdb_stress_lib", srcs=[
425425
"db_stress_tool/batched_ops_stress.cc",
426426
"db_stress_tool/cf_consistency_stress.cc",
427427
"db_stress_tool/db_stress_common.cc",
428+
"db_stress_tool/db_stress_compaction_service.cc",
428429
"db_stress_tool/db_stress_compression_manager.cc",
429430
"db_stress_tool/db_stress_driver.cc",
430431
"db_stress_tool/db_stress_filters.cc",

db/compaction/compaction_job.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,8 @@ void CompactionJob::FinalizeCompactionRun(
950950
UpdateCompactionJobInputStatsFromInternalStats(internal_stats_,
951951
num_input_range_del);
952952
}
953-
UpdateCompactionJobOutputStatsFromInternalStats(internal_stats_);
953+
UpdateCompactionJobOutputStatsFromInternalStats(input_status,
954+
internal_stats_);
954955
RecordCompactionIOStats();
955956

956957
LogFlush(db_options_.info_log);
@@ -2527,6 +2528,7 @@ void CompactionJob::UpdateCompactionJobInputStatsFromInternalStats(
25272528
}
25282529

25292530
void CompactionJob::UpdateCompactionJobOutputStatsFromInternalStats(
2531+
const Status& status,
25302532
const InternalStats::CompactionStatsFull& internal_stats) const {
25312533
assert(job_stats_);
25322534
job_stats_->elapsed_micros = internal_stats.output_level_stats.micros;
@@ -2557,7 +2559,7 @@ void CompactionJob::UpdateCompactionJobOutputStatsFromInternalStats(
25572559
internal_stats.proximal_level_stats.num_output_files_blob;
25582560
}
25592561

2560-
if (job_stats_->num_output_files > 0) {
2562+
if (status.ok() && job_stats_->num_output_files > 0) {
25612563
CopyPrefix(compact_->SmallestUserKey(),
25622564
CompactionJobStats::kMaxPrefixLength,
25632565
&job_stats_->smallest_output_key_prefix);

db/compaction/compaction_job.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ class CompactionJob {
208208

209209
protected:
210210
void UpdateCompactionJobOutputStatsFromInternalStats(
211+
const Status& status,
211212
const InternalStats::CompactionStatsFull& internal_stats) const;
212213

213214
void LogCompaction();

db/compaction/compaction_service_job.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ Status CompactionServiceCompactionJob::Run() {
411411
// 2. Update job-level output stats with the aggregated internal_stats_
412412
// Please note that input stats will be updated by primary host when all
413413
// subcompactions are finished
414-
UpdateCompactionJobOutputStatsFromInternalStats(internal_stats_);
414+
UpdateCompactionJobOutputStatsFromInternalStats(status, internal_stats_);
415415
// and set fields that are not propagated as part of the update
416416
compaction_result_->stats.is_manual_compaction = c->is_manual_compaction();
417417
compaction_result_->stats.is_full_compaction = c->is_full_compaction();

db_stress_tool/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ add_executable(db_stress${ARTIFACT_SUFFIX}
22
batched_ops_stress.cc
33
cf_consistency_stress.cc
44
db_stress.cc
5+
db_stress_compaction_service.cc
56
db_stress_compression_manager.cc
67
db_stress_common.cc
78
db_stress_driver.cc

0 commit comments

Comments
 (0)