Skip to content
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

[BUG] fix persistent HNSW parameter migration #2511

Merged
merged 3 commits into from
Jul 15, 2024

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Jul 12, 2024

Description of changes

Now correctly handles migration of persistent HNSW params.

Test plan

I updated the cross_version_persist test to parameterize across with_persistent_hnsw_params = [False, True]. Before the changes to chromadb/db/mixins/sysdb.py, the updated test was failing.

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@HammadB
Copy link
Collaborator

HammadB commented Jul 13, 2024

If someone upgraded to 0.5.4, and the migration already ran, will it have to be rerun?

@codetheweb
Copy link
Contributor Author

If someone upgraded to 0.5.4, and the migration already ran, will it have to be rerun?

yes, @atroyn do you know where would be a good place to hook in for this?

@atroyn
Copy link
Contributor

atroyn commented Jul 15, 2024

If someone upgraded to 0.5.4, and the migration already ran, will it have to be rerun?

yes, @atroyn do you know where would be a good place to hook in for this?

I think this will have to re-run if it's already migrated, yes. The reason is the migration (which calls _insert_config_from_legacy_params on read) only checks for a None collection config string. Users who have already migrated will have this populated, so the migration will not trigger. This is my fault for missing that the persistent HNSW params were extracted on a different codepath.

The fix is going to be to make sure that the HNSWConfiguration represented in the CollectionConfiguration string contains all the HNSW metadata keys. This is annoying because it means we have to check metadata on every read.

I am not sure we want to eat that performance hit for the possibly 0 users who will have ever changed hnsw:batch_size or hnsw:sync_threshold since these are completely undocumented parameters, for which we otherwise set defaults.

@codetheweb
Copy link
Contributor Author

codetheweb commented Jul 15, 2024

Reasoning through it (lost some context from when I worked on this last week):

Without this fix, chromadb will completely refuse to fetch a collection with persistent parameters:

Screenshot 2024-07-15 at 11 06 18 AM

Users who utilized the hnsw config parameters and upgraded to 0.5.4 would have been blocked by this, so I don't think we need to worry about a case where the migration was run before this bug was fixed.

I wonder if it'd be worth adding telemetry for config fields so we have more data in the future.

@atroyn
Copy link
Contributor

atroyn commented Jul 15, 2024

I'm unclear on why this is triggering since the migration is nondestructive?

@codetheweb codetheweb merged commit 4d063ba into main Jul 15, 2024
65 checks passed
@codetheweb codetheweb deleted the fix-persistent-hnsw-config-migration branch July 15, 2024 19:49
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.

3 participants