Skip to content

test(storage-postgres): wait for the vector index hold release - #929

Open
LeeroyHannigan wants to merge 1 commit into
mainfrom
fix/vector-hold-release-wait
Open

LeeroyHannigan wants to merge 1 commit into
mainfrom
fix/vector-hold-release-wait

Conversation

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

What

update_table_creates_a_vector_index_and_backfills_what_is_already_there in crates/storage-postgres/tests/vector_control_plane.rs now waits up to 10 s for the build to release the vector index hold after the index shows ACTIVE. Before this change, it counted the holds once.

Why

mark_active commits the ACTIVE flip on the catalog first. It then releases the hold in a second statement on the data database. The test polled the catalog for ACTIVE and then counted the holds once, so a count between the two statements found the hold. The run-postgres-storage-tests job of #927 failed this way on 10 Nov, with left: 1, right: 0 at vector_control_plane.rs:964. The same tree passed that job an hour earlier.

The order in mark_active stays as it is. A hold released before the flip would let the worker apply a write to an unpublished index.

There is no issue for this change.

Testing done

  • I ran the test binary from this branch against PostgreSQL 16.15 with pgvector 0.8.7, in a container with no network. These runs used the debug profile. CI runs the job with --release.
  • The changed test passed in 20 of 20 runs. The whole file passed once, with 42 tests.
  • With a database trigger that keeps the hold row, the test fails after the wait with left: 1, right: 0. A leaked hold still fails the test.
  • With a trigger that delays the release by 2 s, the test passes. The server log shows 20 hold counts while the release was open, and one count after it committed.
  • rustfmt --check --edition 2024 passes on the changed file.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

ADR / RFC: n/a


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

update_table_creates_a_vector_index_and_backfills_what_is_already_there
polls the catalog until the new vector index is ACTIVE, then counts the
index holds once. mark_active commits the ACTIVE flip on the catalog
first and releases the hold afterwards, in a second statement on the
data database. A count taken between the two statements finds the
hold, and the test fails. The run-postgres-storage-tests job of #927
failed this way on 10 Nov.

The test now polls the hold count for up to 10 s, as it polls the
status. The order in mark_active stays as it is. A hold released
before the flip would let the worker apply a write to an unpublished
index.

This branch has not been deployed

No deployments
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