Skip to content

Conversation

@fulmicoton
Copy link
Collaborator

No description provided.

@fulmicoton fulmicoton requested a review from Copilot February 10, 2026 14:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

let mut leaf_search_state_guard =
SplitSearchStateGuard::new(ctx.split_outcome_counters.clone());

rewrite_request(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are rewritten in the caller.

return Ok(Some(get_leaf_resp_from_count(split.num_docs)));
}

if let Some(cached_answer) = ctx
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cache now happens in the caller.

@fulmicoton-dd fulmicoton-dd force-pushed the lambda2 branch 3 times, most recently from 53359d9 to d7e49de Compare February 11, 2026 09:20
@fulmicoton-dd fulmicoton-dd force-pushed the lambda2 branch 2 times, most recently from 365e416 to 01f67a7 Compare February 11, 2026 09:42
@fulmicoton-dd fulmicoton-dd force-pushed the lambda2 branch 4 times, most recently from 31fb6ac to 93b0f5a Compare February 11, 2026 10:09
@fulmicoton fulmicoton requested a review from Copilot February 11, 2026 10:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 45 out of 47 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (11)

quickwit/rest-api-tests/quickwit:1

  • This file hardcodes a developer-specific absolute path into the repo, which will break on other machines and may leak local filesystem details. Replace it with a relative path, an env var (e.g. QW_BINARY), or a small wrapper script that resolves the binary location at runtime.
    quickwit/quickwit-search/src/service.rs:1
  • Correct spelling/grammar: 'accross' -> 'across' (and 'request' -> 'requests').
    quickwit/quickwit-search/src/leaf.rs:1
  • The capacity check is off by one: batch.len() <= max_items_per_batch still allows selecting a batch that is already full, so push can create batches with max_items_per_batch + 1 items. Use a strict check (batch.len() < max_items_per_batch) so batches never exceed the configured max.
    quickwit/quickwit-search/src/search_permit_provider.rs:1
  • This computes queue depth using self.permits_requests.len() (number of requests), but then uses it to truncate permit_sizes (number of splits/permits). If a single pending request contains many splits, current_pending stays small and offloading will not trigger even when the split queue is saturated. Track pending load in the same unit as permit_sizes (e.g., total pending permits/splits remaining across queued LeafPermitRequests) before deciding how many new split permits to grant locally.
    quickwit/quickwit-search/src/search_permit_provider.rs:1
  • Changing get_permits from impl IntoIterator<Item = ByteSize> to Vec<ByteSize> is a public API regression (forces allocation/collection at call sites and prevents using iterators/arrays directly). Consider restoring IntoIterator for both get_permits and get_permits_with_offload while keeping your internal Vec<u64> conversion.
    quickwit/quickwit-search/src/search_permit_provider.rs:1
  • Changing get_permits from impl IntoIterator<Item = ByteSize> to Vec<ByteSize> is a public API regression (forces allocation/collection at call sites and prevents using iterators/arrays directly). Consider restoring IntoIterator for both get_permits and get_permits_with_offload while keeping your internal Vec<u64> conversion.
    quickwit/quickwit-search/src/search_permit_provider.rs:1
  • The new offload behavior isn’t covered by unit tests in this file. Add a test that calls get_permits_with_offload(..., offload_threshold) with a low threshold and asserts that the returned futures length is truncated as expected (and that ordering guarantees still hold for the returned subset).
    quickwit/quickwit-search/src/search_permit_provider.rs:1
  • The new offload behavior isn’t covered by unit tests in this file. Add a test that calls get_permits_with_offload(..., offload_threshold) with a low threshold and asserts that the returned futures length is truncated as expected (and that ordering guarantees still hold for the returned subset).
    quickwit/quickwit-search/src/leaf.rs:1
  • schedule_search_tasks will offload whenever searcher_config.lambda is Some, even if searcher_context.lambda_invoker is None. That makes run_offloaded_search_tasks panic at runtime via .expect(...). Ensure offloading is only enabled when both config and invoker are present (or return a structured SearchError when config requests offload but no invoker is configured).
    quickwit/quickwit-search/src/leaf.rs:1
  • schedule_search_tasks will offload whenever searcher_config.lambda is Some, even if searcher_context.lambda_invoker is None. That makes run_offloaded_search_tasks panic at runtime via .expect(...). Ensure offloading is only enabled when both config and invoker are present (or return a structured SearchError when config requests offload but no invoker is configured).
    quickwit/quickwit-search/src/leaf.rs:1
  • On JoinSet failures you drop the underlying JoinError details, making debugging hard. Include the join error (panic vs cancelled, task id, etc.) in the log and in the returned SearchError::Internal, e.g. by matching Err(join_err) and formatting it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 73 to 75
// Process each split in parallel. The SearchPermitProvider inside
// SearcherContext gates concurrency based on memory budget.
let mut split_search_futures = Vec::new();
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite the comment, the split searches are executed sequentially: you collect async blocks into a Vec and then .await them one by one. If you want true parallel execution, drive them concurrently (e.g. try_join_all, FuturesUnordered, or JoinSet) while still preserving ordering if needed (store indices and reorder, or rely on join_all preserving input order).

Copilot uses AI. Check for mistakes.
Comment on lines 99 to 110
// Collect results, preserving split order.
let mut responses: Vec<LeafSearchResponse> = Vec::with_capacity(num_splits);
for split_search_fut in split_search_futures {
let search_result = split_search_fut.await;
let response =
search_result.map_err(|e| LambdaError::Internal(format!("leaf search failed: {e}")))?;
responses.push(response);
}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite the comment, the split searches are executed sequentially: you collect async blocks into a Vec and then .await them one by one. If you want true parallel execution, drive them concurrently (e.g. try_join_all, FuturesUnordered, or JoinSet) while still preserving ordering if needed (store indices and reorder, or rely on join_all preserving input order).

Copilot uses AI. Check for mistakes.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build script declares QUICKWIT_LAMBDA_ZIP_URL as an input, but never actually reads it; it always uses the LAMBDA_ZIP_URL constant. This makes the override documented in quickwit-lambda-client/README.md ineffective and also makes rerun-if-env-changed misleading. Read QUICKWIT_LAMBDA_ZIP_URL from env (falling back to the constant) and use that value for the download + cache marker comparison.

Copilot uses AI. Check for mistakes.
true
};

let lambda_zip_payload: Vec<u8> = if needs_download {
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build script declares QUICKWIT_LAMBDA_ZIP_URL as an input, but never actually reads it; it always uses the LAMBDA_ZIP_URL constant. This makes the override documented in quickwit-lambda-client/README.md ineffective and also makes rerun-if-env-changed misleading. Read QUICKWIT_LAMBDA_ZIP_URL from env (falling back to the constant) and use that value for the download + cache marker comparison.

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +51
| `function_name` | Name of the AWS Lambda function to invoke. | `quickwit-lambda-search` |
| `max_splits_per_invocation` | Maximum number of splits to send in a single Lambda invocation. Must be at least 1. | `10` |
| `offload_threshold` | Number of pending local searches before offloading to Lambda. A value of `0` offloads everything to Lambda. | `100` |
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two concrete issues: (1) docs say offload_threshold default is 100, but LambdaConfig::default_offload_threshold() in code is 10—please align docs and code. (2) The example function_name: {} is invalid YAML and reads like a placeholder; replace it with a real example value or omit the field.

Copilot uses AI. Check for mistakes.
## Example configuration

Minimal configuration (manual deployment):

Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two concrete issues: (1) docs say offload_threshold default is 100, but LambdaConfig::default_offload_threshold() in code is 10—please align docs and code. (2) The example function_name: {} is invalid YAML and reads like a placeholder; replace it with a real example value or omit the field.

Copilot uses AI. Check for mistakes.
Comment on lines 540 to 543
// Sort by version number descending (most recent first)
quickwit_lambda_versions.sort();

// We keep the last 5 versions.
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is incorrect: sort() sorts ascending, not descending. Either update the comment to reflect ascending sort (and that the list represents versions to delete), or explicitly sort descending if that’s what the subsequent logic is meant to rely on.

Suggested change
// Sort by version number descending (most recent first)
quickwit_lambda_versions.sort();
// We keep the last 5 versions.
// Sort by version number ascending (oldest first)
quickwit_lambda_versions.sort();
// Keep only versions to delete: preserve the most recent GC_KEEP_RECENT_VERSIONS

Copilot uses AI. Check for mistakes.
@fulmicoton-dd fulmicoton-dd force-pushed the lambda2 branch 3 times, most recently from 341e346 to c83de48 Compare February 11, 2026 10:44
@fulmicoton-dd fulmicoton-dd force-pushed the lambda2 branch 2 times, most recently from 2ccad61 to c9b8223 Compare February 11, 2026 13:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 45 out of 47 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (3)

quickwit/quickwit-search/src/service.rs:1

  • Corrected spelling of 'accross' to 'across'.
    quickwit/quickwit-search/src/search_permit_provider.rs:1
  • Corrected spelling of 'lambdas' to 'Lambdas' for consistency with AWS Lambda naming convention.
    quickwit/quickwit-search/src/leaf.rs:1
  • The filter condition allows batches with length <= max_items_per_batch, but the logic should prevent adding items to batches that already have max_items_per_batch items. The condition should be batch.len() < max_items_per_batch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants