Skip to content

feat(store): added store interface for batched exact-window queries - #627

Merged
milindsrivastava1997 merged 3 commits into
mainfrom
worktree-issue-609-batched-exact-window-query
Aug 26, 2026
Merged

feat(store): added store interface for batched exact-window queries#627
milindsrivastava1997 merged 3 commits into
mainfrom
worktree-issue-609-batched-exact-window-query

Conversation

@milindsrivastava1997

Copy link
Copy Markdown
Contributor

Adds Store::query_precomputed_output_exact_batch: resolves N windows against one (metric, aggregation_id) shard in a single lock acquisition instead of N.

Closes #609.

Checkpoint before merging main (legacy stores gated behind feature
flag in #624). Not yet wired into scan_windows_via_exact; no tests
yet.
…via_exact (#609)

Checkpoint before rebasing onto main (legacy stores removed in #625).
/// `current_epoch` / `sealed_epochs` in a single pass. Otherwise identical semantics
/// to calling `query_precomputed_output_exact` once per window and merging the
/// results (a window with no exact match simply contributes nothing).
fn query_precomputed_output_exact_batch(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The new batched exact-query methods drop the lock_profiling instrumentation (wait/hold time logging) present on the single-window query_precomputed_output_exact.

Building with --features lock_profiling to diagnose lock contention on range/instant queries: query_precomputed_output_exact_batch (here and in global.rs:692) never emits the lock wait/hold time logs that the single-window path emits, so exactly the code path most affected by the increased lock-hold-duration (see other comment) is invisible to that diagnostic tooling.

/// whole `windows` slice instead of once per window. Otherwise identical semantics to
/// calling `query_precomputed_output_exact` once per window and merging the results
/// (a window with no exact match simply contributes nothing).
fn query_precomputed_output_exact_batch(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

query_precomputed_output_exact_batch is duplicated almost line-for-line between this file and per_key.rs (epoch lookup loop, read-count update loop, debug logging), adding ~90 more lines of near-identical logic that must be kept in sync by hand.

A future fix to the exact-match resolution order (current_epoch then sealed_epochs newest-to-oldest) or to the read-count bookkeeping could get applied to one copy (per_key.rs:801-831) and forgotten in the other (here, 722-753), silently reintroducing a bug in one of the two lock strategies — the contract test suite may not catch a strategy-specific regression.

@milindsrivastava1997
milindsrivastava1997 marked this pull request as ready for review August 26, 2026 03:48
@milindsrivastava1997 milindsrivastava1997 changed the title Batched exact-window store query (#609) feat(store): added store interface for batched exact-window queries Aug 26, 2026
…e per_key/global

Addresses review feedback on #609's batch method:
- per_key.rs and global.rs had dropped the lock_profiling wait/hold-time
  instrumentation that the single-window path has, on exactly the path
  now most affected by longer lock hold times.
- The per-window epoch-resolution loop (current_epoch/sealed_epochs
  lookup, read-count bookkeeping) was copy-pasted between the two
  backends. Extracted into common::resolve_exact_windows, shared by both.
@milindsrivastava1997
milindsrivastava1997 merged commit 95f79aa into main Aug 26, 2026
7 checks passed
@milindsrivastava1997
milindsrivastava1997 deleted the worktree-issue-609-batched-exact-window-query branch August 26, 2026 03:57
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.

Add a batched exact-window query API to the store

1 participant