From ba96b20b1fffa4e0a03ab2df8999dc4d3aecff3e Mon Sep 17 00:00:00 2001 From: Nga Tran Date: Mon, 4 Oct 2021 12:28:49 -0400 Subject: [PATCH 1/2] test: turn on tests of delete all --- query_tests/src/scenarios/delete.rs | 34 ++++++++++++++++++++++++----- query_tests/src/sql.rs | 8 +++---- 2 files changed, 31 insertions(+), 11 deletions(-) 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() {} From 64cd0cb3ce4b51ca0fb4f250cc54de171a556118 Mon Sep 17 00:00:00 2001 From: Nga Tran Date: Mon, 4 Oct 2021 12:43:35 -0400 Subject: [PATCH 2/2] chore: cleanup --- query_tests/src/sql.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/query_tests/src/sql.rs b/query_tests/src/sql.rs index 560966de47..0ac89c3fc6 100644 --- a/query_tests/src/sql.rs +++ b/query_tests/src/sql.rs @@ -1155,6 +1155,3 @@ async fn sql_select_with_three_deletes_from_three_chunks_with_select_predicate() ) .await; } - -#[tokio::test] -async fn delete_empty_predicate() {}