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

Allow configuring the location of the appdata_[instanceid] folder #36337

Closed
wants to merge 1 commit into from

Conversation

summersab
Copy link
Contributor

@summersab summersab commented Jan 24, 2023

Allow configuring the location of the appdata_[instanceid] folder

Summary

This allows administrators to change the location of the appdata_[instanceid] folder by specifying an appdataroot value in config.php. This is especially useful when using shared storage, object storage as primary storage (storing appdata_[instanceid] in an object store is extremely slow), etc.

TODO

Resolved with commit 783ad06

However, I am having permission issues. The system is able to create files and folders at the mount point, but when it tries to read the folders, they don't appear to exist, and errors are thrown. I think it has something to do with the OC\FilesView attached to the mount point/folder, but I'm not sure. It seems to occur at this function:

if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) {

If that doesn't make sense, please feel free to ask me to explain in further detail.

Checklist

@szaimen szaimen added this to the Nextcloud 26 milestone Jan 24, 2023
@szaimen szaimen added enhancement 3. to review Waiting for reviews labels Jan 24, 2023
@szaimen szaimen requested review from a team, ArtificialOwl, icewind1991 and blizzz and removed request for a team January 24, 2023 21:23
@kesselb
Copy link
Contributor

kesselb commented Jan 25, 2023

Thanks 👍

Can you have a look at tests/lib/Files/AppData/AppDataTest.php?

image

@summersab
Copy link
Contributor Author

summersab commented Jan 26, 2023

@kesselb - I hope I did that right? I've never made a commit to a project as big as this.

I see some of the other tests are failing. What else do I need to do?

@summersab summersab force-pushed the appdata_location branch 2 times, most recently from 2ce53a5 to 9cdfd1e Compare January 27, 2023 00:27
@summersab

This comment was marked as resolved.

@summersab summersab force-pushed the appdata_location branch 3 times, most recently from cea86b9 to 145000e Compare January 28, 2023 15:49
@blizzz blizzz mentioned this pull request Feb 1, 2023
@summersab

This comment was marked as resolved.

@summersab

This comment was marked as resolved.

@nickvergessen
Copy link
Member

Something went wrong with your rebase.

Try:

git checkout master
# Replace nextcloud with the name of the remote, if you don't know, post the result of `git remote -v`
git pull nextcloud master
git checkout appdata_location
git rebase -i nextcloud/master
# Remove all commits which are not yours, then save and exit
git push --force origin appdata_location

@summersab summersab force-pushed the appdata_location branch 2 times, most recently from 33d6508 to 783ad06 Compare February 9, 2023 17:20
@summersab
Copy link
Contributor Author

summersab commented Feb 9, 2023

Something went wrong with your rebase.

Yeah, I'm not the best with git, yet. I think I fixed it.

My latest commit also fixes the issue I was having trouble with as described in my initial comment (being unable to use the root of the new mount as appdata_[instanceid]. It was a issue with the caching and LocalRootScanner. In short, the PR now works the way it should have from the start.

Signed-off-by: summersab <arthur.summers@gmail.com>
Signed-off-by: summersab <18727110+summersab@users.noreply.github.com>

Set type of `$rootFolder`

Signed-off-by: summersab <arthur.summers@gmail.com>
Signed-off-by: summersab <18727110+summersab@users.noreply.github.com>

implement test method

Signed-off-by: summersab <18727110+summersab@users.noreply.github.com>

update `config.sample.php` with `appdataroot` parameter

Signed-off-by: summersab <18727110+summersab@users.noreply.github.com>

fix caching issue preventing files from being written directly to mount point

update method to check mount points and determine if cache scanner should run

simplify method to check mount points

fix unit test

add missing line; cleanup lint

perform lint cleanup

run cs-fixer

replace deprecated methods; fix invalid value for `$mountPoint` in `LocalRootScanner:shouldScanPath`

rename appdataroot to appdatadirectory

remove inaccurate language from `config.sample.php`

Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
@juliusknorr juliusknorr removed their request for review September 9, 2023 07:50
$arguments = [
'datadir' => $appdatadirectory,
];
$storage = new LocalRootStorage($arguments);
Copy link
Member

Choose a reason for hiding this comment

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

This should just be Local not LocalRootStorage

$this->config = $systemConfig;
$this->appId = $appId;
$this->folders = new CappedMemoryCache();

$this->rootFolder = new LazyRoot(function () use ($rootFolder, $systemConfig) {
Copy link
Member

Choose a reason for hiding this comment

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

Why are you creating a new LazyRoot?

Comment on lines +48 to +53
$storageId = $this->storage->getId();
$mount = Filesystem::getMountManager()->findByStorageId($storageId);
$mountPoint = sizeof($mount) == 1 ? $mount[0]->getMountPoint() : "null";

$path = trim($path, '/');
return $path === '' || str_starts_with($path, 'appdata_') || str_starts_with($path, '__groupfolders');
return $path === '' || str_starts_with($path, 'appdata_') || str_starts_with($path, '__groupfolders') || str_starts_with($mountPoint, '/appdata_');
Copy link
Member

Choose a reason for hiding this comment

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

If you want to stop the scanner from touching the new appdata mountpoint, you can instead create a storage with a "noop" scanner.

@skjnldsv skjnldsv mentioned this pull request Nov 1, 2023
This was referenced Nov 6, 2023
This was referenced Nov 14, 2023
@blizzz blizzz modified the milestones: Nextcloud 28, Nextcloud 29 Nov 23, 2023
@imchasingshadows
Copy link

Is there still work that needs to be done here? Seems like this has been idle for quite some time.

@susnux
Copy link
Contributor

susnux commented Feb 15, 2024

Is there still work that needs to be done here? Seems like this has been idle for quite some time.

See the unresolved comments above, so yes there is work to be done.
But feel free to fork and contribute on the feature :)

This was referenced Mar 12, 2024
@skjnldsv skjnldsv added 2. developing Work in progress stale Ticket or PR with no recent activity and removed 3. to review Waiting for reviews labels Mar 15, 2024
@skjnldsv skjnldsv removed this from the Nextcloud 29 milestone Mar 15, 2024
@skjnldsv skjnldsv marked this pull request as draft March 15, 2024 15:14
@susnux susnux added this to the Nextcloud 30 milestone Apr 18, 2024
@skjnldsv
Copy link
Member

skjnldsv commented May 2, 2024

Closing this pull request due to lack of recent activity and updates. We appreciate your contribution and encourage you to reopen or provide further updates if necessary. ☺️
Our aim is to keep the project moving forward with active collaboration. Thank you for your understanding and continued support! 🙏

@skjnldsv skjnldsv closed this May 2, 2024
@luxzg
Copy link

luxzg commented May 2, 2024

Wait, you closed an issue due to inactivity, issue that had already started development and people are actively waiting for it? If you want activity I will repost comment here every week so issue is "active". I don't think that's what is expected, and is usually considered spam on GitHub, but after this closing it seems this project has different code of conduct - "spam us if you want the feature".

Please be reasonable and keep the issue open until it is finished, reviewed and accepted.

It was planned for NC 26, then 27, 28, 29... I have no words...

@ChristophWurst
Copy link
Member

It was planned for NC 26, then 27, 28, 29...

For your information: assigning to a milestone is not a sign of planning. All PRs are moved to the next milestone after the branch-off.
This PR is waiting for the author or someone else to finish the work, then it can be merged. The requested changes had been pending for half a year.

@luxzg
Copy link

luxzg commented May 2, 2024

Ok, sorry for misinterpreting the closing comment, it was just for this commit which indeed got stale, not the original issue. Hopefully someone will step up to finish the needed work.

@skjnldsv skjnldsv removed this from the Nextcloud 30 milestone Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress enhancement stale Ticket or PR with no recent activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow configuration of appdata directory location