-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[stable9] Backport lazy init of shared storage/mount #26912
Conversation
@PVince81, thanks for your PR! By analyzing the history of the files in this pull request, we identified @butonic and @DeepDiver1975 to be potential reviewers. |
Good news: the Now there is still a risk that the recursion happens when calling
|
Attempting to find steps to reproduce the recursion in question, because we never really had steps for that... Here #25557 (comment) |
Could not reproduce the infinite recursion on this PR here #25557 (comment). It is likely that the code is too different. But there is still a slight chance that some code paths triggers it, so I decided to backport the recursion safety commit as well as it won't hurt other code paths: dc7d55c The FailedStorage backport looks unnecessary as the SharedStorage is not a I think this PR is now ready for review and testing. |
b0326cc
to
e6d8779
Compare
@mrow4a this is ready for testing, please run your magic tests on this branch. Thanks |
Looks like e6d8779 breaks some unit tests:
|
This because the tests create shares the old way which doesn't create flat reshares. |
I had to compile a few backports to make tests pass again. The reason is that the getPath() shortcut is based on the assumption that reshares are flat. But the unit tests use the old API which uses the old chain-like shares. Note that the old API isn't used any more.
|
Looks like I'll have to figure out how to run the complex performance tests myself... Can I at least get a code review ? |
Also, am running smashbox against this branch, just in case. |
@PVince81 I have everything set up, OC server with different versions, smashbox appliance etc. I just need to checkout the branch on one of server VM, put correct config files and run the tests on "smashbox" VM. Everything is there, I will try to finish quickly university stuff and help you -> https://malibu.int.owncloud.com:8006/ on internal network, password you know, |
@mrow4a thanks a lot! |
if ($storage->instanceOfStorage('\OC\Files\Storage\Shared')) { | ||
$rootId = (int)$storage->getShare()['file_source']; | ||
// note: SharedMount goes there | ||
if (method_exists($mount, 'getStorageRootId')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary? IMountPoint
has this method, if it does not exist you would either get an error for something not implementing IMountPoint
correctly, or not injecting an object of type IMountPoint
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMountPoint
only has this method on stable9.1 or master and we don't want to introduce new methods as it qualifies as API change. Other implementers of IMountPoint (ex: external storage) will likely not implement this one in this version. So this hack is there to accomodate for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, i didn't think about that! Makes sense then!
To prevent recursions in initMountPoints which requires the numeric id to populate oc_mounts
e6d8779
to
32bde45
Compare
Rebased to include #26927, tests should pass now. |
@mrow4a has just confirmed that this improves performance significantly, and some results aren't exponential any more. The results aren't too close to master, but good enough to be released. Please review the code @PhilippSchaffrath @jvillafanez This PR will also need some regression testing @owncloud/qa |
@@ -58,9 +61,10 @@ class SharedMount extends MountPoint implements MoveableMount { | |||
public function __construct($storage, array $mountpoints, $arguments = null, $loader = null) { | |||
$this->user = $arguments['user']; | |||
$this->recipientView = new View('/' . $this->user . '/files'); | |||
$newMountPoint = $this->verifyMountPoint($arguments['share'], $mountpoints); | |||
$this->share = $arguments['share']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check if the "share" key is present and throw an error otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
*/ | ||
public function __construct(IUser $user, IMountPoint $mount) { | ||
$this->user = $user; | ||
$this->mount = $mount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have to call the parent constructor. The parent might not be properly initialized otherwise and could cause issues.
If this is intended, write a comment explaining it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was backported from 9.1 which didn't call the parent either (not my code), I hope it had a good reason
@@ -1663,6 +1665,11 @@ public function getPath($id) { | |||
/** | |||
* @var \OC\Files\Mount\MountPoint $mount | |||
*/ | |||
if (!$includeShares && $mount instanceof SharedMount) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this will be enough to prevent the infinite loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was enough on 9.1, at least for known cases
I think we'll have to review the First I think it's pointless to have both classes ( Second, usually the class on top ( I don't expect to solve this in this PR because it's a backport, but we have to take this into account. |
You're right. I'm also not too happy about these. Would you suggest merging both classes into a single one ? (in a separate tech debt PR) That would likely solve all points you mentionned (calling parent, always lazy and no weird control) |
Users won't care about the specific implementation as long as it's fast enough, and a don't think there are cases where one implementation would perform better than the other one in order to provide a switch for those cases, so one implementation is enough. |
@jvillafanez I added the required checks. Your |
👍 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
LazyStorageMountInfo
Related Issue
Hopefully fixes the issue described in #26702
Motivation and Context
There's a perf regression in 9.0 that didn't exist in 8.2 due to the introduction of oc_mounts.
Perf was improved in 9.1 through #25789 so hopefully backporting a subset of it will also improve performance in 9.0.
How Has This Been Tested?
Steps:
curl -D - -X GET -u recipient:recipient http://localhost/owncloud/remote.php/webdav/file1.txt > file.txt
=> ignore the resultcurl -D - -X GET -u recipient:recipient http://localhost/owncloud/remote.php/webdav/file1.txt > file.txt
, again, and have a look at the value of "Time spent"Before this fix (v9.0.7): time spent was 7 seconds
After this fix: time spent is down to 4 seconds
Running the same test on v9.1.3 also gives 4 seconds.
Screenshots (if appropriate):
Types of changes
Checklist:
TODOs:
Jail
instance, so no further regression that were observed on 9.1 would happen