Skip to content

[VQueues] Optimize sys_vqueue_meta point lookups#5048

Open
AhmedSoliman wants to merge 4 commits into
mainfrom
pr5048
Open

[VQueues] Optimize sys_vqueue_meta point lookups#5048
AhmedSoliman wants to merge 4 commits into
mainfrom
pr5048

Conversation

@AhmedSoliman

@AhmedSoliman AhmedSoliman commented Jul 15, 2026

Copy link
Copy Markdown
Member

Use the generic exact ID selection machinery for sys_vqueue_meta so id equality and IN predicates route directly to the owning Restate partitions.

Add a targeted vqueue-meta read path backed by bounded RocksDB multi-get batches, while keeping range scans for scope and non-point predicates. Vqueue-meta ID range scans now use total-order iteration when the bounds span multiple partition keys.

Add DataFusion coverage for vqueue-meta point queries and NOT IN handling so negated lists remain normal filters instead of lookup inputs.


Stack created with Sapling. Best reviewed with ReviewStack.

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

Test Results

  8 files    8 suites   5m 1s ⏱️
 61 tests  61 ✅ 0 💤 0 ❌
268 runs  268 ✅ 0 💤 0 ❌

Results for commit 33988b4.

♻️ This comment has been updated with latest results.

@AhmedSoliman
AhmedSoliman force-pushed the pr5048 branch 2 times, most recently from 9f81529 to 095d4b0 Compare July 16, 2026 15:59
@AhmedSoliman
AhmedSoliman marked this pull request as ready for review July 16, 2026 16:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 095d4b0482

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +188 to +189
Some(selection) if selection.keys.len() > 4096 => {
itertools::Either::Left(Some((partition_id, partition)).into_iter())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Disable exact lookups after exceeding the point-read cap

When an id IN (...) predicate contains more than 4096 values, this branch expands back to full partition ranges but still passes the unchanged predicate to each scanner. VQueueMetaFilter::new and InvocationIdFilter::new then re-extract the IDs, and their conversions dispatch MetaIdSet/InvocationIdSet multi-gets (vqueue_meta/table.rs:98-102, invocation_status/table.rs:101-105), so every point read still executes despite the stated safety fallback. Propagate that point selection was discarded, or enforce the same cap when constructing the local exact-ID filters.

Useful? React with 👍 / 👎.

Replace the specialized partition and key-range scan variants with a compact TableScan API that lowers encoded bounds to prefix or exclusive range scans. Use prefix seeking only when the encoded bounds remain within RocksDB's fixed prefix, fall back to total-order seeking for cross-prefix ranges, and turn singleton ranges into prefix scans.

Centralize iterator-bound configuration across direct, background, and transactional readers. Let callers supply ReadOptions so async I/O and transaction snapshots remain caller policy, while short prefixes safely bypass the fixed-prefix extractor and its bloom filters.

Remove the iterator wrapper plumbing, share encoded Bytes bounds across RocksDB paths, and migrate table and storage-migration callers to the consolidated API. Cover inclusive upper bounds, singleton partition ranges, and prefix-versus-total-order selection.
… reads

Keep equality and IN predicates as exact ID selections in the DataFusion filter layer instead of collapsing large sets into scan ranges. This lets point-lookup tables preserve the user's requested IDs while range-scan tables can still convert the same selection back to bounds.

Teach the partitioned table provider to group exact point reads by Restate partition when the scanner can re-fetch the exact IDs itself. Use that for sys_invocation_status by adding an InvocationIdSet scan path backed by bounded RocksDB multi-get batches.

Split partition-store inclusive key-range scans into single-prefix and total-order variants, and use total-order scans when invocation-status, journal, or journal-events ID bounds span multiple partition keys. This preserves correctness for range-scan consumers of exact ID selections.

Adapt the worker cleaner to the fallible stream shape used by the new invocation-status scan path, and add scan-mode coverage for the new total-order range variant.


This design delivers 5-10x better performance for point-lookups than the concurrent iterator-per-entry approach that was previously used. This pays more dividends on slower disks and will allow us to leverage async I/O better when we build rocksdb with folly.
Make sys_vqueue_entry_status understand exact entry_id predicates so equality and IN filters can be planned as targeted reads rather than broad partition scans. Entry IDs are parsed back to their partition keys for routing and displayed consistently from the stored EntryId representation.

Add the partition-store support needed to read selected entry-status records through bounded batched multi-get calls while preserving range scans for non-point predicates. Entry-id range scans now use total-order iteration when the bounds span multiple partition keys.

Only advertise partition_key ordering for sys_vqueue_entry_status, because the exposed entry_id string ordering does not match the raw on-disk entry-id ordering.

Cover both the DataFusion point-query path and multi-get batching behavior, including a NOT IN regression so excluded IDs are not treated as an exact lookup set.
Use the generic exact ID selection machinery for sys_vqueue_meta so id equality and IN predicates route directly to the owning Restate partitions.

Add a targeted vqueue-meta read path backed by bounded RocksDB multi-get batches, while keeping range scans for scope and non-point predicates. Vqueue-meta ID range scans now use total-order iteration when the bounds span multiple partition keys.

Add DataFusion coverage for vqueue-meta point queries and NOT IN handling so negated lists remain normal filters instead of lookup inputs.
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.

1 participant