-
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
Propagate etags across shared storages #14764
Conversation
@PVince81 I think I have all distinct cases covered by the unit tests, please check if you can think of a situation not covered |
@icewind1991 This was a quick merge conflict ... rebase required ;) |
60df28b
to
174eda0
Compare
if ($time === null) { | ||
$time = time(); | ||
} | ||
$this->config->setAppValue('files_sharing', $share['id'], $time); |
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.
Will this ever be removed again? Looks like we are going to pollute the appconfig table
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 could move the timestamp to the share table (requires schema change) or use an unshare hook to cleanup
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 remember we have a similar mechanism for external storages. Maybe that would be a candidate for a future new table for mount points ? So I'm not sure we should move it to the share table now.
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.
Here is the files_external version: https://github.com/owncloud/core/blob/master/apps/files_external/lib/etagpropagator.php#L64
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.
Maybe using oc_share isn't that bad an idea. At least it prevents requiring ALL share ids and makes it possible to only query the ones that have the dirty flag set.
Schema change: yes, if for 8.1.
I have the feeling that this whole fix isn't backportable anyway. 😦
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 already have a list of all shares from setting up the mounts
Had a quick look and it confirms what I thought: the fix for this will big and not backportable. |
yes - every user had a pseudo etag for the shared folder in his preferences. This approach no longer works. |
@@ -0,0 +1,138 @@ | |||
<?php | |||
/** | |||
* Copyright (c) 2014 Robin Appelman <[email protected]> |
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.
Man, you live in the past!
@icewind1991 did you do a blackfire compare before and after this branch to find potential perf issues ? Performance is my first worry, second one is backportability. |
$shares = Share::getAllSharesForOwner($owner); | ||
$propagator->listen('\OC\Files', 'propagate', function ($path, $entry) use ($shares) { | ||
foreach ($shares as $share) { | ||
if ((int)$share['file_source'] === $entry['fileid']) { |
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.
Hmmm wait, why do we need all shares ?
We only need all shares that have file_source = fileid, probably doable with a custom SQL statement.
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.
Maybe getUsersItemShare()
could get you all recipients https://github.com/owncloud/core/blob/master/lib/private/share/share.php#L506
And use getUsersSharingFile
https://github.com/owncloud/core/blob/master/lib/private/share/share.php#L102 for reshares, etc that will need update as well.
Sorry for the maaaany comments. The approach you used is a good idea but need a bit of tweaking. Test planOwner O shares "test" with recipients R1 and R2
R2 reshares "test" with R3
R2 reshares subdir "test/sub" with R4
Groups
|
174eda0
to
e8e9948
Compare
Did some refactoring, splitting up classes and getting rid of static stuff |
* @param string $owner | ||
*/ | ||
public function attachToPropagator(ChangePropagator $propagator, $owner) { | ||
$shares = Share::getAllSharesForOwner($owner); |
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 really need to query all shares - even if the closure below is never called?
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.
changed it to query on demand
Happens here:
|
@icewind1991 it looks like this is also triggered by the unit test "testReshareRecipientWritesToReshare" which matches the case. The test doesn't fail because it's only logged as DEBUG. Maybe the consequence is harmless or the situation is expected. |
Ok, can reproduce it now, since it's just a debug message and doesnt seem to affect the propagation can we merge this PR and raise a new issue for the message |
Ok. But I noticed that the unit test don't check the etag of "folder", I want to double check because I'm not certain that it is harmless. |
@MorrisJobke review ? |
I checked with a manual test, the etag of "folder" changes properly. So not sure about the consequences. During my quick debug session I had the feeling it would not propagate to owner (which is the code path where the warning appears) but somehow it still manages to propagate there, possibly through other means. 👍 for now, will raise the next ticket(s) as soon as this is merged |
A new inspection was created. |
Tests passed on jenkins pr |
@nickvergessen @LukasReschke @DeepDiver1975 @MorrisJobke please review. Test plan is here: #14764 (comment) (and also covered by the unit tests) |
I will do the review and merge once I'm fine with this. |
I tested most of the cases above and all succeed. I also couldn't find any errors in the logs. Awesome work @PVince81 @icewind1991 🚀 🚢 🇮🇹 👍 |
Propagate etags across shared storages
I will take care or raising tickets for the remaining issues. |
We should also look into providing a simple backportable solution for older versions, but for that we need to first indentify which cases were exactly broken. Maybe using the "etagpropagation" unit test from this PR could help. |
Raised remaining tickets:
|
💣 💣 💣 Broke sharing: #15913 💣 💣 💣 |
Propagate etags across shared storages
Solution involves three parts
cc @PVince81 @DeepDiver1975