fix: add stability check to wait_for_vector_indexing (Fixes #1412)#2086
Open
rtmalikian wants to merge 1 commit into
Open
fix: add stability check to wait_for_vector_indexing (Fixes #1412)#2086rtmalikian wants to merge 1 commit into
rtmalikian wants to merge 1 commit into
Conversation
…condition Shards briefly report READY + vectorQueueSize=0 while objectCount has not yet caught up to the inserted objects. This causes wait_for_vector_indexing() to return too early. Fix: After detecting readiness, wait 0.5s and re-verify. If the shard is no longer ready, continue waiting. Fixes weaviate#1412 Signed-off-by: rtmalikian <rtmalikian@gmail.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
|
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1412
Problem
wait_for_vector_indexing()has a race condition: shards briefly reportREADY+vectorQueueSize=0whileobjectCounthas not yet caught up to the objects inserted in the batch. This causes the function to return too early, before vector indexing is actually complete.Root Cause
The readiness check (
status == "READY"ANDvectorQueueSize == 0) does not verify object count. In a brief window after insertion, the shard status can satisfy both conditions while objects are still being counted.Solution
Add a stability check after the initial readiness detection:
whileloop exits (readiness detected), wait 0.5 secondsThis ensures the readiness state is stable before returning, preventing false-positive completion.
Changes
weaviate/collections/batch/batch_wrapper.py— Both sync (_BatchWrapper) and async (_BatchWrapperAsync) pathsVerification
python3 -c "import ast; ast.parse(...)"— passesChangelog
Files Changed
wait_for_vector_indexingmethodsVerification
ast.parse()syntax check passedruff checkpassed with no errorsAbout the Author: Raphael Malikian — Clinical AI Solutions Architect. I specialise in building and fixing AI/ML systems for healthcare, including vector databases, RAG pipelines, and clinical NLP. If you need help with your project or think I can add value to your organisation, feel free to reach out — I'd love to connect.
📧 rtmalikian@gmail.com
🔗 GitHub: https://github.com/rtmalikian
🔗 LinkedIn: http://www.linkedin.com/in/raphael-t-malikian-mbbs-bsc-hons-71075436a