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

[STACKED #1237] [ENH] Move get_or_create into sysdb #1242

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

HammadB
Copy link
Collaborator

@HammadB HammadB commented Oct 13, 2023

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • Move get_or_create logic into the sys db interface
  • New functionality
    • None added

Test plan

How are these changes tested?
Existing tests as well as a new test at the sysdb level.

  • Tests pass locally with pytest for python, yarn test for js

Documentation Changes

None, all changes are to internal interfaces.

@github-actions
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 (Readbility, Modularity, Intuitiveness)

@HammadB HammadB changed the title Move get_or_create into sysdb [STACKED #1237] [ENH] Move get_or_create into sysdb Oct 13, 2023
@@ -105,33 +105,20 @@ def create_collection(
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
get_or_create: bool = False,
) -> Collection:
existing = self._sysdb.get_collections(name=name)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Logic removed from here

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

@@ -59,9 +59,13 @@ def create_collection(
name: str,
metadata: Optional[Metadata] = None,
dimension: Optional[int] = None,
get_or_create: bool = False,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add get_or_create into here

@@ -44,8 +44,11 @@ message UpdateSegmentRequest {
}

message CreateCollectionRequest {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alter grpc type to match the flattened input

) -> Collection:
"""Create a new collection and the associate topic"""
if id is None and not get_or_create:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Logic to handle get_or_create is in here now

@HammadB HammadB changed the title [STACKED #1237] [ENH] Move get_or_create into sysdb [STACKED #1237] [WIP] [ENH] Move get_or_create into sysdb Oct 13, 2023
@HammadB HammadB force-pushed the hammad/get_or_create_sysdb branch from 3e01da7 to 47c73e9 Compare October 13, 2023 07:17
@HammadB HammadB changed the title [STACKED #1237] [WIP] [ENH] Move get_or_create into sysdb [STACKED #1237] [ENH] Move get_or_create into sysdb Oct 13, 2023
Copy link
Contributor

@Ishiihara Ishiihara left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -105,33 +105,20 @@ def create_collection(
embedding_function: Optional[EmbeddingFunction] = ef.DefaultEmbeddingFunction(),
get_or_create: bool = False,
) -> Collection:
existing = self._sysdb.get_collections(name=name)
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

HammadB added a commit that referenced this pull request Oct 16, 2023
## Description of changes
This PR is stacked on #1228, please TAL at that before this. 

*Summarize the changes made by this PR.*
 - Improvements & Bug fixes
	 - n/a
 - New functionality
	 - Introduced a grpc sysdb implementation.
	 - Migrate the protobufs to support Null vs Presence where needed.
	 - Added minimal protobuf definitions to implement the grpc coordinator
	 - Add a mock grpc sysdb server that reimplements the core functionality in memory for testing.

Will address the following open questions in stacked PRs!
Open questions/issues:
- [x] Collection <> Topic Mapping
          _This requires some thought if we use hashing then we can just map the collection onto a topic and store it. Will we ever want to shard a collection across topics?_
        I don't think this is needed at this moment!
- [x] Topic management moving to sysdb interface 
           _This is conceptually simple, we make topic creation implicitly part of sysdb create collection_
          I address this in #1237 
- [x] We need to move the get_or_create concept into sysdb
          _This is conceptually simple, we just move this logic into sysdb and make it aware of it_
         I address this in #1242

## Test plan
*How are these changes tested?*
I added a mock gRPC server that implements the basic functionality of sysdb with in memory data structures.

We will run the coordinator tests with this impl in the bin/cluster test once the go coordinator service is ready from @Ishiihara 

## Documentation Changes
None required.
@HammadB HammadB force-pushed the hammad/topic_management_sysdb branch 4 times, most recently from b78877a to f4ef680 Compare October 16, 2023 04:24
@HammadB HammadB force-pushed the hammad/get_or_create_sysdb branch from 47c73e9 to ee2849b Compare October 16, 2023 05:57
@HammadB HammadB changed the base branch from hammad/topic_management_sysdb to main October 16, 2023 05:57
@HammadB HammadB enabled auto-merge (squash) October 16, 2023 05:57
@HammadB HammadB merged commit 9d89b96 into main Oct 16, 2023
85 checks passed
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.

2 participants