Skip to content

vector-store: expose index build progress in status endpoint#506

Open
nuivall wants to merge 2 commits into
scylladb:masterfrom
nuivall:SCYLLADB-2327
Open

vector-store: expose index build progress in status endpoint#506
nuivall wants to merge 2 commits into
scylladb:masterfrom
nuivall:SCYLLADB-2327

Conversation

@nuivall

@nuivall nuivall commented Jul 7, 2026

Copy link
Copy Markdown
Member

The GET /api/v1/indexes/{keyspace}/{index}/status handler now reports the
build_progress percentage taken from the index entry's full-scan progress
(Progress::Done maps to 100%). This lets clients observe how far the
initial backfill scan has advanced while an index is BOOTSTRAPPING.

Refs: https://scylladb.atlassian.net/browse/SCYLLADB-2327

@nuivall
nuivall requested a review from DarioMirovic July 7, 2026 12:28
@nuivall

nuivall commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

@DarioMirovic could you pre-check if this rust code makes sense?

@swasik
swasik requested a review from knowack1 July 8, 2026 11:09

@knowack1 knowack1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A few comments on this. @nuivall / @swasik , should I continue working on this PR since @nuivall is now busy with new duties?

),
// version should be updated manually when there are changes in API
version = "2.0.0"
version = "2.1.0"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: this change should be in first commit. Along the actual API change.

Comment thread api/openapi.json
"type": "number",
"format": "double",
"description": "Progress of the initial full table scan that backfills the index,\nexpressed as a percentage in the range `0.0..=100.0`. It is `100.0`\nonce the index is `SERVING`. Defaults to `0.0` for backward\ncompatibility with older clients that omit the field."
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: This file (auto-generated) should be in fist commit alongside with the actual API change.

Comment thread crates/httpapi/src/lib.rs Outdated
/// Progress of the initial full table scan that backfills the index,
/// expressed as a percentage in the range `0.0..=100.0`. It is `100.0`
/// once the index is `SERVING`. Defaults to `0.0` for backward
/// compatibility with older clients that omit the field.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

"Defaults to 0.0 for backward compatibility with older clients that omit the field." - I think "defaults to 0.0" is anyhow related with backward compatibility. I mean that this is backward compatible change regardless if the default value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd say that we need default value of 100.0.

The caller using the new client would be checking both status and build_progress.
New client + old server = use default value.
Current code: the caller never progresses, because build_progress hasn't reached 100%.
100.0 default: the caller effectively just waits for status, as do the current callers that don't have build_status exposed - they only look at status.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Currently build_progress is only information about the progress of fullscan - it shouldn't be taken as a source of truth for the index state. The valid information is the state of the index - if this is SERVING it means the index is serving regardless of build_progress. If build_progress doesn't reach 100% it might be a trigger for investigation, what happened.

Comment thread api/openapi.json
"count"
],
"properties": {
"build_progress": {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: could specify:
minimum: 0
maximum: 100

#[tokio::test]
#[ntest::timeout(10_000)]
#[cfg_attr(not(feature = "slow-test-hooks"), ignore = "requires slow-test-hooks")]
async fn index_status_reports_build_progress_while_bootstrapping() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These tests are in the wrong file. routing.rs is meant for search query routing to the correct index. We could move them to status.rs or create a new index_status.rs file, as status.rs currently only covers node status.

Comment thread crates/httpapi/src/lib.rs Outdated
/// Progress of the initial full table scan that backfills the index,
/// expressed as a percentage in the range `0.0..=100.0`. It is `100.0`
/// once the index is `SERVING`. Defaults to `0.0` for backward
/// compatibility with older clients that omit the field.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd say that we need default value of 100.0.

The caller using the new client would be checking both status and build_progress.
New client + old server = use default value.
Current code: the caller never progresses, because build_progress hasn't reached 100%.
100.0 default: the caller effectively just waits for status, as do the current callers that don't have build_status exposed - they only look at status.

Comment thread crates/httpapi/src/lib.rs Outdated
Comment on lines +153 to +154
/// expressed as a percentage in the range `0.0..=100.0`. It is `100.0`
/// once the index is `SERVING`. Defaults to `0.0` for backward

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In initial_scan, if at least one preform_range_scan call fails, it drops permit, as it should, but never increments completed_scan_length for that range. The counter can never reach u64::MAX, so we'll never reach 100% build progress, even when we transition to the serving state:

impl From<u64> for Percentage {
    fn from(value: u64) -> Self {
        Percentage::try_from((value as f64 / u64::MAX as f64) * 100.0).unwrap()
    }
}

impl From<u64> for Progress {
    fn from(value: u64) -> Self {
        if value == u64::MAX {
            Progress::Done
        } else {
            Progress::InProgress(Percentage::from(value))
        }
    }
}

This is a pre-existing issue. The focus of this comment is compliance of the doc comment with the actual behavior.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You're right, currently we are skipping errors without increasing fullscan progress. There is an issue to design better handling of errors during fullscan and cdc: https://scylladb.atlassian.net/browse/VECTOR-726

@nuivall

nuivall commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

v2:

  • Default build_progress 0.0 → 100.0 (fall back to status); doc reworded
  • Added OpenAPI min/max 0–100
  • Moved index_status tests to new index_status.rs
  • Split commits: openapi + version bump into commit 1

nuivall added 2 commits July 24, 2026 17:51
Add a build_progress field to IndexStatusResponse so clients can observe
the initial full-scan backfill progress. Defaults to 100.0 when omitted,
so a new client against an older server relies solely on the authoritative
status field. Schema is bounded 0..=100.

Includes the regenerated api/openapi.json and API version bump (2.1.0). The
handler uses a placeholder 100.0 for now; real progress is wired up next.
The status handler now reports the real build_progress from the index
entry's full-scan progress (Progress::Done maps to 100%), replacing the
placeholder introduced with the API type.

Add integration tests in a dedicated index_status.rs module (routing.rs is
about query routing) covering the BOOTSTRAPPING stage with partial progress
and a serving index at 100%. Shared routing.rs helpers are made pub(crate)
for reuse.
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.

4 participants