Skip to content

Commit 4c76c23

Browse files
committed
Also wait when the commit type is force
1 parent 5c27737 commit 4c76c23

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

quickwit/quickwit-ingest/src/ingest_v2/router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ impl IngestRouter {
457457
max_num_attempts: usize,
458458
) -> IngestResponseV2 {
459459
let commit_type = ingest_request.commit_type();
460-
let mut workbench = if commit_type == CommitTypeV2::WaitFor {
460+
let mut workbench = if matches!(commit_type, CommitTypeV2::Force | CommitTypeV2::WaitFor) {
461461
IngestWorkbench::new_with_publish_tracking(
462462
ingest_request.subrequests,
463463
max_num_attempts,

quickwit/quickwit-integration-tests/src/tests/ingest_tests.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ async fn test_commit_force() {
330330
- name: body
331331
type: text
332332
indexing_settings:
333-
commit_timeout_secs: 20
333+
commit_timeout_secs: 60
334334
"#
335335
);
336336

@@ -344,22 +344,21 @@ async fn test_commit_force() {
344344

345345
sandbox.enable_ingest_v2();
346346

347-
ingest_with_retry(
348-
&sandbox.indexer_rest_client,
349-
index_id,
350-
ingest_json!({"body": "force"}),
351-
CommitType::Force,
347+
// commit_timeout_secs is set to a large value, so this would timeout if
348+
// the commit isn't forced
349+
tokio::time::timeout(
350+
Duration::from_secs(20),
351+
ingest_with_retry(
352+
&sandbox.indexer_rest_client,
353+
index_id,
354+
ingest_json!({"body": "force"}),
355+
CommitType::Force,
356+
),
352357
)
353358
.await
359+
.unwrap()
354360
.unwrap();
355361

356-
// commit_timeout_secs is set to a large value, so this would timeout if
357-
// CommitType::Force is not working
358-
sandbox
359-
.wait_for_splits(index_id, Some(vec![SplitState::Published]), 1)
360-
.await
361-
.unwrap();
362-
363362
sandbox.assert_hit_count(index_id, "body:force", 1).await;
364363

365364
sandbox.shutdown().await.unwrap();
@@ -405,6 +404,7 @@ async fn test_commit_wait_for() {
405404
.await
406405
.unwrap();
407406

407+
// This test is not powerful enough to ensure that `wait_for` does not force the commit
408408
sandbox.assert_hit_count(index_id, "body:wait", 1).await;
409409

410410
sandbox.shutdown().await.unwrap();

0 commit comments

Comments
 (0)