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

make collection_id primary key for segment, fix system tests #1731

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

weiligu
Copy link
Contributor

@weiligu weiligu commented Feb 17, 2024

Description of changes

Test plan

How are these changes tested?

  • passing existing tests

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)

// Update collection to new value
segment.CollectionID = sampleCollections[1].ID
Copy link
Contributor

Choose a reason for hiding this comment

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

Why comment these tests? These tests are ported from the python system test.

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 don't see why we need to set collection id to null or modify the collection id for a segment. And it is not possible to do it because collection_id is now primary key of segment

@@ -165,20 +165,23 @@ func generateSegmentUpdatesWithoutID(in *dbmodel.UpdateSegment) map[string]inter
}
}

if in.ResetCollection {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why comment out this code?

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 don't see why we need to set collection id to null. And it is not possible to do it because collection_id is now primary key of segment

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.

Discussed with @weiligu offline. Here are the follow ups:

  • Recommend to add comments on the trade off between primary key collection_id + id and secondary index on collection_id.
  • File an issue in github on the error handling for unique constraint violation.

LGTM after addressing the follow ups.

Copy link
Contributor Author

weiligu commented Feb 20, 2024

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@weiligu
Copy link
Contributor Author

weiligu commented Feb 20, 2024

Discussed with @weiligu offline. Here are the follow ups:

  • Recommend to add comments on the trade off between primary key collection_id + id and secondary index on collection_id.
  • File an issue in github on the error handling for unique constraint violation.

LGTM after addressing the follow ups.

@weiligu weiligu enabled auto-merge (squash) February 21, 2024 00:00
@weiligu weiligu merged commit 05fdd46 into main Feb 21, 2024
96 checks passed
atroyn pushed a commit to csbasil/chroma that referenced this pull request Apr 3, 2024
…core#1731)

## Description of changes

- collection id should be primary key of segment table, for getSegments
performance (there will be a follow up on fixing get Segment since we
should push down collection_id)
-
https://linear.app/trychroma/issue/CHR-324/segment-table-should-have-collection-id-as-primary-key
- fixing tests broken by
chroma-core@93194c8

## Test plan
*How are these changes tested?*

- [x] passing existing tests
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