diff --git a/query_tests/src/scenarios/delete.rs b/query_tests/src/scenarios/delete.rs index c61de74def..d12b74f933 100644 --- a/query_tests/src/scenarios/delete.rs +++ b/query_tests/src/scenarios/delete.rs @@ -638,12 +638,23 @@ async fn make_chunk_with_deletes_at_different_stages( // Move MUB to RUB match chunk_stage { ChunkStage::Rub | ChunkStage::RubOs | ChunkStage::Os => { - let chunk = db + let chunk_result = db .compact_chunks(table_name, partition_key, |chunk| chunk.id() == chunk_id) .await - .unwrap() .unwrap(); - chunk_id = chunk.id(); + + match chunk_result { + Some(chunk) => { + chunk_id = chunk.id(); + } + None => { + // MUB has all soft deleted data, no RUB will be created + // no more data to affect further delete + let scenario_name = + format!("Deleted data from one {} chunk{}", chunk_stage, display); + return DbScenario { scenario_name, db }; + } + } } _ => {} } @@ -665,16 +676,27 @@ async fn make_chunk_with_deletes_at_different_stages( // Move RUB to OS match chunk_stage { ChunkStage::RubOs | ChunkStage::Os => { - let chunk = db + let chunk_result = db .persist_partition( table_name, partition_key, Instant::now() + Duration::from_secs(1), ) .await - .unwrap() .unwrap(); - chunk_id = chunk.id(); + + match chunk_result { + Some(chunk) => { + chunk_id = chunk.id(); + } + None => { + // RUB has all soft deleted data, no OS will be created + // no more data to affect further delete + let scenario_name = + format!("Deleted data from one {} chunk{}", chunk_stage, display); + return DbScenario { scenario_name, db }; + } + } } _ => {} } diff --git a/query_tests/src/sql.rs b/query_tests/src/sql.rs index 3f8ba55f59..560966de47 100644 --- a/query_tests/src/sql.rs +++ b/query_tests/src/sql.rs @@ -868,11 +868,6 @@ async fn sql_select_all_different_tags_chunks() { // ---------------------------------------------- // Delete tests - -// reproduce of https://github.com/influxdata/influxdb_iox/issues/2546 -// Not throw error when all of rows of a OS or RUB chunk are soft deleted -// ignore until we have a fix that I am actively working on -#[ignore] #[tokio::test] async fn sql_select_with_delete_from_one_expr_delete_all() { let expected = vec!["++", "++"]; @@ -1160,3 +1155,6 @@ async fn sql_select_with_three_deletes_from_three_chunks_with_select_predicate() ) .await; } + +#[tokio::test] +async fn delete_empty_predicate() {}