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: hint table for columns for sharded queries #1630

Merged
merged 2 commits into from
Jan 15, 2025
Merged

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Jan 10, 2025

Fix #1619

Based on nextcloud/groupfolders#3483

For queries to the filecache we need to provide the sharding key (storage id) so the sharding logic in server can put the query to the right shard. https://github.com/nextcloud/collectives/pull/1630/files#diff-070d4f3f410c3f2fe7c8c4ab40af4884d62b754f28350d2bb0ebc4fc3f846117R208 is the most relevant change

CI run in #1634
Failure shown in nextcloud/collectives/actions/runs/12777873556/job/35619586742?pr=1634

@juliusknorr
Copy link
Member Author

@icewind1991 Do we have some docs on how to setup sharding and anything on how it works concept wise?

@max-nextcloud
Copy link
Collaborator

Thanks for looking into this @juliusknorr

As there are no instructions for testing i will compare with the groupfolders code you linked to and perform a general code check. Hope that works for you.

@juliusknorr
Copy link
Member Author

juliusknorr commented Jan 13, 2025

Sorry forgot to update, we tried on daily, but didn't work, waiting for feedback from @icewind1991 first now

@juliusknorr juliusknorr changed the base branch from main to ci/sharding January 14, 2025 23:01
@juliusknorr juliusknorr changed the base branch from ci/sharding to main January 14, 2025 23:02
lib/Mount/CollectiveFolderManager.php Outdated Show resolved Hide resolved
->leftJoin('co', 'filecache', 'fc', $qb->expr()->eq('fc.name', $qb->expr()->castColumn('co.id', IQueryBuilder::PARAM_STR)))
->where($qb->expr()->eq('co.id', $qb->createNamedParameter($id)))
->andWhere($qb->expr()->eq('fc.parent', $qb->createNamedParameter($this->getFolderRootId())))
->andWhere($qb->expr()->eq('fc.storage', $qb->createNamedParameter($this->getRootFolderStorageId(), IQueryBuilder::PARAM_INT)));
Copy link
Member

Choose a reason for hiding this comment

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

cannot judge whether specifying the storage id is safe here. Could there be, for example, incoming shares?

Copy link
Member Author

Choose a reason for hiding this comment

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

This will always be the storage id of the mount point and in the case of collectives the storage id of the root folder as collective data is stored in app data.

@juliusknorr juliusknorr added bug Something isn't working 3. to review labels Jan 15, 2025
@juliusknorr juliusknorr merged commit 32c496a into main Jan 15, 2025
53 checks passed
@juliusknorr juliusknorr deleted the fix/sharding branch January 15, 2025 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sharding compatibility
4 participants