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 path used in sabre's tree cache #20003

Closed
wants to merge 1 commit into from
Closed

Conversation

icewind1991
Copy link
Contributor

Sabre's getChildren() cached path with a leading slash, now we properly used entries cached by getChildren() which prevents us from having to re-query the fileinfo.

Greatly improves performance when doing a Depth=1 PROPFIND (comparison)

cc @DeepDiver1975 @PVince81 @LukasReschke

@icewind1991 icewind1991 added this to the 9.0-current milestone Oct 23, 2015
@ghost ghost added the in progress label Oct 23, 2015
@DeepDiver1975
Copy link
Member

is there unit test coverage on the tree?

@icewind1991
Copy link
Contributor Author

Yes

@rullzer
Copy link
Contributor

rullzer commented Oct 25, 2015

👎

Let me explain. What happens is that the cache is used and filled in the function getNodeForPath. But it is also filled in the function getChildren https://github.com/owncloud/3rdparty/blob/master/sabre/dav/lib/DAV/Tree.php#L192-L204

The trouble is at https://github.com/owncloud/3rdparty/blob/master/sabre/dav/lib/DAV/Tree.php#L196 that for child nodes puts a '/' between the basePath and the childs name. Now of course when you are in the root there is no basePath so the child nodes get cached like /<CHILD>. However if you a subfolder they get cached like <SUBFOLDER>/<CHILD>.

So your patch will speedup PROPFINDS in the root but slow down in all subfolders.

Basically this is a bug in sabre. Or at least in how we use it ;) We could fix it by copyng the code of getChildren over an fixing it. But probably better to fix upstream. @evert do you want me to prepare a PR against 2.1.7 or will there be no 2.1.8?

@rullzer
Copy link
Contributor

rullzer commented Oct 25, 2015

@rullzer
Copy link
Contributor

rullzer commented Oct 25, 2015

Of course I did some measurements:

propfind on root with 5 folders and 5 files

what time graph
master 306ms graph
master + this patch 70.7ms graph
master + sabre patch 47.3ms graph

propfind on subfolder with 5 folders and 5 files

what time graph
master 72.9ms graph
maser + this patch 223ms graph
master + sabre patch 69.6ms graph

@LukasReschke
Copy link
Member

Awesome work @icewind1991 and @rullzer 🚀

@PVince81
Copy link
Contributor

I suggest to provide a method "setCachedEntry" that auto-adds or auto-strips the leading slash. It's not the first time this kind of thing happens, had this lately with Dropbox local cache too: see #19877

@rullzer
Copy link
Contributor

rullzer commented Oct 27, 2015

Fix is in sabre master. So we have yet another reason to upgrade ;)
Let close this then.

@rullzer rullzer closed this Oct 27, 2015
@ghost ghost removed the in progress label Oct 27, 2015
@rullzer rullzer deleted the sabre-cache-path branch October 27, 2015 09:02
@DeepDiver1975
Copy link
Member

Fix is in sabre master. So we have yet another reason to upgrade ;)
Let close this then.

in order to get this fixed in 8.2 and earlier we need a fix in 2.1 - requested at fruux/sabre-dav@6223d06#commitcomment-14005068

@ghost
Copy link

ghost commented Jan 28, 2016

@rullzer @DeepDiver1975 @icewind1991 Just stumbled over this. 2.1.9 (#21914) has included this fix.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants