-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[BUG] Use InternalUpdateConfiguration in Rust, correctly update configuration in go #5069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
6b7d4ae to
c561c11
Compare
b1fde3c to
99f88de
Compare
e62b9cc to
c1e7f74
Compare
|
Fix Collection Configuration Updates and Unify Config Types Across Go and Rust This PR addresses an issue in the Go implementation where collection configuration updates (specifically, ConfigurationJsonStr) were not persisted during modifications. It remedies this, enhances the collection update logic in Go, and brings Go/Rust type and update logic into closer alignment by introducing InternalUpdateCollectionConfiguration in Rust and refactoring related code paths. Additional tests have been added to Go and Rust to ensure that configuration updates, round-tripping, and persistence behave as expected. Key Changes• Go: Fixes logic in generateCollectionUpdatesWithoutID to ensure ConfigurationJsonStr is updated when modifying a collection. Affected Areas• Go: sysdb/coordinator/model/collection_configuration.go This summary was automatically generated by @propel-code-bot |
| coll = client.get_collection(name="test_updates") | ||
| loaded_config = coll.configuration_json | ||
| if loaded_config and isinstance(loaded_config, dict): | ||
| hnsw_config = loaded_config.get("hnsw", {}) | ||
| if isinstance(hnsw_config, dict): | ||
| assert hnsw_config.get("ef_search") == 20 | ||
| assert hnsw_config.get("space") == "cosine" | ||
| assert hnsw_config.get("ef_construction") == 100 | ||
| assert hnsw_config.get("max_neighbors") == 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[BestPractice]
The logic to re-fetch a collection and verify its configuration is duplicated in this test and also in test_configuration_spann_updates and test_spann_update_from_json. To improve maintainability and reduce code duplication, consider extracting this verification logic into a helper function.
For example:
def _verify_config_persistence(client: ClientAPI, collection_name: str, index_type: str, expected_params: Dict[str, Any]) -> None:
coll = client.get_collection(name=collection_name)
loaded_config = coll.configuration_json
assert loaded_config and isinstance(loaded_config, dict)
index_config = loaded_config.get(index_type, {})
assert isinstance(index_config, dict)
for key, value in expected_params.items():
assert index_config.get(key) == valueThis would make the tests cleaner and more maintainable.
| } | ||
|
|
||
| pub fn update(&mut self, configuration: &UpdateCollectionConfiguration) { | ||
| pub fn update(&mut self, configuration: &InternalUpdateCollectionConfiguration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when is this used v/s updateCollectionConfiguration in table_catalog.go? Why do we need this if sysdb already does a Read modify write
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is used for sqlite sysdb. in that, it does the same logic of reading, then updating the config if applicable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, sqlite did not have this bug right?
| } | ||
|
|
||
| #[derive(Deserialize, Serialize, ToSchema, Debug, Clone)] | ||
| pub struct InternalUpdateCollectionConfiguration { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the difference between the internal type and not? a comment would be useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could have more tests on the rust and go update paths
c1e7f74 to
28890fe
Compare
28890fe to
e059b16
Compare
…guration in go (chroma-core#5069) ## Description of changes Previously, the go code did not update the configuration str for collections because it was not passed as part of `generateCollectionUpdatesWithoutID` This was fixed, and tests were added. It also cleans up the existing go types, and updates the rust types to use a similar InternalCollectionConfiguration for updates. ## Test plan _How are these changes tested?_ Tests were added to validate that both the modify worked, and on future fetches maintains the values. Db tests were also added to the dao - [x ] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes _Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs section](https://github.com/chroma-core/chroma/tree/main/docs/docs.trychroma.com)?_

Description of changes
Previously, the go code did not update the configuration str for collections because it was not passed as part of
generateCollectionUpdatesWithoutIDThis was fixed, and tests were added. It also cleans up the existing go types, and updates the rust types to use a similar InternalCollectionConfiguration for updates.
Test plan
How are these changes tested?
Tests were added to validate that both the modify worked, and on future fetches maintains the values. Db tests were also added to the dao
pytestfor python,yarn testfor js,cargo testfor rustDocumentation Changes
Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?