Skip to content

fix(config): raise when an update tries to change the vector index type - #2194

Open
jackiectl2 wants to merge 1 commit into
weaviate:mainfrom
jackiectl2:fix/immutable-vector-index-type
Open

jackiectl2 wants to merge 1 commit into
weaviate:mainfrom
jackiectl2:fix/immutable-vector-index-type

Conversation

@jackiectl2

Copy link
Copy Markdown

Fixes #1277

The vector index type of a collection / named vector is immutable server-side, but collection.config.update() didn't check it:

  • single (unnamed) vector: config.update(vectorizer_config=Reconfigure.VectorIndex.dynamic()) on a flat collection returned without error and the index stayed flat — vectorIndexType is never sent, the new fields are just merged into the old config.
  • named vectors: the client sent the new vectorIndexType together with the old index config; against Weaviate 1.39.7 changing flat -> hnsw/dynamic returns HTTP 500 (server log: interface conversion: interface {} is flat.UserConfig, not hnsw.UserConfig).

This adds a client-side check in _CollectionConfigUpdate.merge_with_existing (all four vector index update paths) that raises WeaviateInvalidInputError when the requested index type differs from the existing one, similar to the existing quantizer-switch check. Updates that keep the same index type are unchanged. (An earlier attempt, #2080, was closed by its author without review; this takes the same approach.)

Testing

  • New unit tests in test/collection/test_config_update.py (single vector via vector_index_config/vectorizer_config, named vector via NamedVectors.update/Vectors.update, plus same-type updates still merging). The raise tests fail without the change.
  • pytest test (531 passed), pytest mock_tests (65 passed), ruff format, ruff check, flake8 clean.
  • Manually against a local Weaviate 1.39.7: confirmed the silent no-op / HTTP 500 on main and the new error with this change.

The vector index type is immutable server-side. Updating a single-vector
collection with a different index type was silently ignored, and doing so
for a named vector made the server fail with an internal error. Raise a
WeaviateInvalidInputError client-side instead.

Fixes weaviate#1277

Signed-off-by: Tianlang (Jackie) Chen <305351710+jackiectl2@users.noreply.github.com>

@orca-security-eu orca-security-eu 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.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot

Copy link
Copy Markdown

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.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

@jackiectl2

Copy link
Copy Markdown
Author

I agree with the CLA.

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.

Throw error message when trying to update vector index type configuration in a collection

2 participants