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

Fix metadata storage with sharding #48563

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

icewind1991
Copy link
Member

And add the most minimal set of tests to ensure this keeps working.

The way of passing the storage id to the db code is a bit iffy. But I didn't want to change any public interface

@icewind1991 icewind1991 added the 3. to review Waiting for reviews label Oct 3, 2024
@icewind1991 icewind1991 added this to the Nextcloud 31 milestone Oct 3, 2024
try {
/** @var FilesMetadata $metadata */
Copy link
Contributor

Choose a reason for hiding this comment

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

Typing is not working?

Copy link
Member Author

Choose a reason for hiding this comment

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

Things are typed to return this interface, but only the implementation has the setStorageId method because I didn't want to touch the public api

Comment on lines +35 to +39
// all code paths that lead to saving metadata *should* have the storage id set
// this fallback is there just in case
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll need to update applications like Photos

$query->select('storage')
->from('filecache')
->where($query->expr()->eq('fileid', $query->createNamedParameter($filesMetadata->getFileId(), IQueryBuilder::PARAM_INT)));
return $query->executeQuery()->fetchColumn();
Copy link
Contributor

@artonge artonge Oct 3, 2024

Choose a reason for hiding this comment

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

Wondering if we should cache it with $filesMetadata->setStorageId(), but I don't think that we have scenarios where we are saving the same metadata object multiple times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants