Merge pull request #7430 from influxdata/jrb_24_backlogged_test_case

fix: address panic with single L0 overlapping multiple L1s
pull/24376/head
Joe-Blount 2023-04-04 11:31:16 -05:00 committed by GitHub
commit 099b33871b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2097 additions and 5 deletions

View File

@ -254,10 +254,7 @@ pub fn identify_start_level_files_to_split(
// Neither split file that overlaps with only one file in target level
// nor has a single timestamp (splitting this will lead to the same file and as a result will introduce infinite loop)
// nor has time range = 1 (splitting this will cause panic because split_time will be min_tim/max_time which is disallowed)
if overlapped_target_level_files.len() < 2
|| file.min_time == file.max_time
|| file.min_time == file.max_time - 1
{
if overlapped_target_level_files.len() < 2 || file.min_time == file.max_time {
files_not_to_split.push(file);
} else {
debug!(?file.min_time, ?file.max_time, ?file.compaction_level, "time range of file to split");

File diff suppressed because it is too large Load Diff

View File

@ -126,7 +126,9 @@ pub(crate) async fn run_layout_scenario(setup: &TestSetup) -> Vec<String> {
let compact_result = setup.run_compact().await;
// record what the compactor actually did
output.extend(compact_result.run_log);
if !setup.suppress_run_output {
output.extend(compact_result.run_log);
}
// Record any skipped compactions (is after what the compactor actually did)
output.extend(get_skipped_compactions(setup).await);

View File

@ -76,6 +76,7 @@ pub struct TestSetupBuilder<const WITH_FILES: bool> {
run_log: Arc<Mutex<Vec<String>>>,
/// Checker that catalog invariant are not violated
invariant_check: Arc<dyn InvariantCheck>,
suppress_run_output: bool,
}
impl TestSetupBuilder<false> {
@ -107,6 +108,8 @@ impl TestSetupBuilder<false> {
catalog: Arc::clone(&catalog.catalog),
});
let suppress_run_output = false;
// Intercept all catalog commit calls to record them in
// `run_log` as well as ensuring the invariants still hold
let run_log = Arc::new(Mutex::new(vec![]));
@ -157,6 +160,7 @@ impl TestSetupBuilder<false> {
files: vec![],
run_log,
invariant_check,
suppress_run_output,
}
}
@ -290,6 +294,7 @@ impl TestSetupBuilder<false> {
files,
run_log: Arc::new(Mutex::new(vec![])),
invariant_check,
suppress_run_output: false,
}
}
@ -320,6 +325,7 @@ impl TestSetupBuilder<false> {
files,
run_log: Arc::new(Mutex::new(vec![])),
invariant_check,
suppress_run_output: false,
}
}
@ -351,6 +357,7 @@ impl TestSetupBuilder<false> {
files,
run_log: Arc::new(Mutex::new(vec![])),
invariant_check,
suppress_run_output: false,
}
}
@ -504,6 +511,12 @@ impl<const WITH_FILES: bool> TestSetupBuilder<WITH_FILES> {
self
}
/// Set option to suppress output of compaction runs;
pub fn with_suppress_run_output(mut self) -> Self {
self.suppress_run_output = true;
self
}
/// set simulate_without_object_store
pub fn simulate_without_object_store(mut self) -> Self {
let run_log = Arc::clone(&self.run_log);
@ -558,6 +571,7 @@ impl<const WITH_FILES: bool> TestSetupBuilder<WITH_FILES> {
config: Arc::new(self.config),
run_log: self.run_log,
invariant_check: self.invariant_check,
suppress_run_output: self.suppress_run_output,
}
}
}
@ -577,6 +591,8 @@ pub struct TestSetup {
pub partition: Arc<TestPartition>,
/// The compactor2 configuration
pub config: Arc<Config>,
/// allows optionally suppressing output of running the test
pub suppress_run_output: bool,
/// a shared log of what happened during a simulated run
run_log: Arc<Mutex<Vec<String>>>,
/// Checker that catalog invariant are not violated