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

[ENH] Migrate away from MetadataReader and VectorReader #2942

Merged

Conversation

Sicheng-Pan
Copy link
Contributor

@Sicheng-Pan Sicheng-Pan commented Oct 11, 2024

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • Migrate away from MetadataReader and VectorReader interface
  • New functionality
    • N/A

Test plan

How are these changes tested?

  • 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 repository?

Copy link
Contributor Author

Sicheng-Pan commented Oct 11, 2024

@Sicheng-Pan Sicheng-Pan mentioned this pull request Oct 11, 2024
1 task
@Sicheng-Pan Sicheng-Pan marked this pull request as ready for review October 11, 2024 20:59
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)

@Sicheng-Pan Sicheng-Pan force-pushed the 10-11-_enh_migrate_away_from_metadatareader_and_vectorreader branch from 8feb481 to c0087ce Compare October 11, 2024 21:38
@Sicheng-Pan Sicheng-Pan force-pushed the 10-10-_enh_implement_local_executor branch from e830211 to ff4c9a9 Compare October 11, 2024 23:31
@Sicheng-Pan Sicheng-Pan force-pushed the 10-11-_enh_migrate_away_from_metadatareader_and_vectorreader branch from c0087ce to 453d40d Compare October 11, 2024 23:31
@Sicheng-Pan Sicheng-Pan force-pushed the 10-10-_enh_implement_local_executor branch from ff4c9a9 to 91f3865 Compare October 11, 2024 23:33
@Sicheng-Pan Sicheng-Pan force-pushed the 10-11-_enh_migrate_away_from_metadatareader_and_vectorreader branch from 453d40d to f288c56 Compare October 11, 2024 23:34
@Sicheng-Pan Sicheng-Pan force-pushed the 10-10-_enh_implement_local_executor branch from 91f3865 to 119250e Compare October 11, 2024 23:39
@Sicheng-Pan Sicheng-Pan force-pushed the 10-11-_enh_migrate_away_from_metadatareader_and_vectorreader branch from f288c56 to 28f5d22 Compare October 11, 2024 23:39
@@ -142,7 +143,7 @@ def test_sync_threshold(settings: Settings) -> None:
)

manager = system.instance(SegmentManager)
segment = manager.get_segment(collection.id, VectorReader)
segment = manager.get_segment(collection.id, LocalHnswSegment)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious why this has to be a more specific type now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm deprecating the VectorReader abstract class because it is only going to be used by local Chroma in the future. MetadataReader is deprecated as well.

Copy link
Contributor Author

Sicheng-Pan commented Oct 14, 2024

Merge activity

  • Oct 14, 1:34 PM EDT: A user started a stack merge that includes this pull request via Graphite.
  • Oct 14, 1:41 PM EDT: Graphite rebased this pull request as part of a merge.
  • Oct 14, 1:42 PM EDT: A user merged this pull request with Graphite.

@Sicheng-Pan Sicheng-Pan force-pushed the 10-10-_enh_implement_local_executor branch from 119250e to d1f91de Compare October 14, 2024 17:37
@Sicheng-Pan Sicheng-Pan changed the base branch from 10-10-_enh_implement_local_executor to main October 14, 2024 17:39
@Sicheng-Pan Sicheng-Pan force-pushed the 10-11-_enh_migrate_away_from_metadatareader_and_vectorreader branch from 28f5d22 to 205a4e6 Compare October 14, 2024 17:40
@Sicheng-Pan Sicheng-Pan merged commit f0019e7 into main Oct 14, 2024
67 of 69 checks passed
options=None,
request_version_context=request_version_context,
return self._executor.knn(
KNNPlan(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful!

@@ -46,4 +47,4 @@ def trigger_vector_segments_max_seq_id_migration(

for collection_id in collection_ids_with_unmigrated_segments:
# Loading the segment triggers the migration on init
segment_manager.get_segment(UUID(collection_id), VectorReader)
segment_manager.get_segment(UUID(collection_id), LocalHnswSegment)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. The segment could be LocalPersistentHnswSegment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: the code is correct by coincidence. I'm going to rework on this PR a bit to re-introduce the VectorReader and MetadataReader

scope = SegmentScope.METADATA
elif type == VectorReader:
elif type == LocalHnswSegment:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are missing a type here - what about LocalPersistentHnswSegment?

Sicheng-Pan added a commit that referenced this pull request Oct 14, 2024
Sicheng-Pan added a commit that referenced this pull request Oct 14, 2024
#2950)

Reverts #2942

The `MetadataReader` and `VectorReader` should be kept for better code
readability. The plan is to remove `get_segment` abstract method from
`SegmentManager` interface and have divergent implementation for
`LocalSegmentManager` and `DistributedSegmentManager` respectively
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