Skip to content

[BUG]: fix missing tenant ID in version file #4408

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

Merged
merged 1 commit into from
Apr 30, 2025

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Apr 30, 2025

Description of changes

Upon compaction flush for a collection, the Sysdb creates a version file if one does not exist. To do this, it populates fields in the file using the GetCollectionEntry method.

However, before this PR, the GetCollectionEntry method always returned an empty string for the tenant. This led to the field missing in the version file and version files being saved under the wrong bucket prefix.

Test plan

How are these changes tested?

Validated that the tenant ID is now correctly populated by:

  1. tilt up with version files disabled on Sysdb.
  2. Created a collection and added data.
  3. Enabled version files on Sydb.
  4. Added more data to the collection.
  5. Observed that the tenant ID was correctly populated in the created version files.

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

n/a

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)

@@ -30,7 +30,7 @@ func (s *collectionDb) DeleteAll() error {
func (s *collectionDb) GetCollectionEntry(collectionID *string, databaseName *string) (*dbmodel.Collection, error) {
var collections []*dbmodel.Collection
query := s.db.Table("collections").
Select("collections.id, collections.name, collections.database_id, collections.is_deleted, databases.tenant_id, collections.version, collections.version_file_name, collections.root_collection_id").
Select("collections.id, collections.name, collections.database_id, collections.is_deleted, collections.tenant, collections.version, collections.version_file_name, collections.root_collection_id").
Copy link
Contributor Author

Choose a reason for hiding this comment

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

my understanding is that this annotation controls what dbmodel.Collection.Tenant pulls from:

Tenant string `gorm:"tenant"`

@codetheweb codetheweb marked this pull request as ready for review April 30, 2025 21:48
@codetheweb codetheweb requested a review from Sicheng-Pan April 30, 2025 21:48
@Sicheng-Pan
Copy link
Contributor

Note: need to read tenant id from collections table in order to set the version file path correctly

@codetheweb codetheweb force-pushed the fix-version-file-missing-tenant-id branch from a237541 to 9540f00 Compare April 30, 2025 21:59
@codetheweb codetheweb enabled auto-merge (squash) April 30, 2025 22:00
@codetheweb codetheweb merged commit a43b1f3 into main Apr 30, 2025
69 checks passed
warpbuild-benchmark-bot bot added a commit to WarpBuilds/chroma that referenced this pull request Apr 30, 2025
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