Open tobiasKaminsky opened 6 years ago
Probably we should have some way to trigger a parent update on all metadata changes.
Any news here? This is already included in android and planned to be in next release, which is in mid march. Of course it needs a fallback for older server (if we do not backport the solution).
Changing the parent etag as @rullzer suggested should be the best. Then we know that something changed and sync child's metadata. Same for client, but as no file changed, it does not redownload anything.
The only problem I recently thought of is that just chaning the parent etag is not enough.
Consider:
Now with two users this is fine. But now imagin sharing a file to a group of 2000 users.
Yeah, slight overhead ;-) But is not the same happening if you put a file into a folder which is shared with 2k users? Then also the parent eTag has to be changed and propagated to all sharees...
Well yes but that happens only when those users request the info. Because the etag of the file changes so we can delay it until the info is requested. In this scenario we would have to do it on all changes.
Basically we would need to change the etag of the file and then it all would work. But doing that would lead to a redownload in the desktopclient.
Then check the modification date, it eTag changed, but mod date not, you know it is only metadata ;-) Feels very hacky -_-
@rullzer any news here? We want to do feature freeze / release 3.1rc1 on 22.03. and this should be in, or we would have to revert stuff on android.
revert to old stuff. Nothing will be fixed before 22.03
Sad ;-) On tests I also saw that share/unshare also does not change the eTag.
Reminder for myself: If we have a server fix, we need a new PR for android.
This was scheduled for NC14, but got delayed. As mentioned on NC15 meeting, please let us do it for 15.
@rullzer @icewind1991 can this new eTag also change when a share is changed?
Most likely nothing that still can be done. Sorry - see my comment in #14228
Sad to hear, especially that this was already moved from 15 to 16… At least we have a PR now ;-)
still an issue?
Yes. We would benefit quite a lot by this!
With https://github.com/nextcloud/android/issues/10783 we see this is one of our biggest area to improve. Most of time is spent on refreshing shares, as we have to do this all the time, as we do not know if it changed.
possible approaches:
1a) reuse the etag and make it change when a share, share permissions, acl, favorite, tag, etc changes
change the etag of the parent folder in which the files' metadata has change, but don't change the etag on the file itself. Here assuming that semantically we mean that a folder is like a file and when its contents (listing, metadata) changes, its etag changes
pros: already propagate, no new code needed except for the new locations where we trigger the etag change
pros: should not disturb old clients, they'd only do the discovery phase deeper without noticing changes.
cons: no distinction between content change
cons: does this clash with the Webdav spec in terms of semantics ? (we probably already aren't fully compliant, see ctag vs etag concept)
1b) like 1a but change the etag on a file also whenever its metadata changes
2) a new PROPFIND attribute "metadata-etag"
any further approaches or tweaks to the above ? @tobiasKaminsky
1a/b) cannot work as eTag is currently used to distinguish when to sync a file. So if eTag changes without it will cause a redownload of a downloaded file. Thus this must be a separate information.
I fear 2 is the only solution. We discussed this already quite a lot and never found another way…
@icewind1991 can you estimate the effort of adding an additional metadata-etag and triggering its change in various code locations, and propagating it like the initial one ?
are there any cases that we forgot to cover, like for example whether the files HPB should also expose it somehow ?
I remember that we even started with it at some point: https://github.com/nextcloud/server/search?q=metadata_etag
So DB is "ready" according to my limited knowledge. Which would make it easier to add, as it is then no big impact during upgrade.
I would like to mention that my PR #34918 is complementary to this one.
It helps in the current situation - without the metadata eTag. Will still help when the metadata eTag is implemented - in cases when the share data actually changes.
Updated version:
Provide an
eTag
for metadata changes (favorite, share, note, etc). Currently clients (Android / iOS) check for changedeTag
when entering a folder. If this is the same with stored database no realpropfind
to list folder content is needed. However if e.g. a new sharee was added, we still need to retrieve it. Therefore we check every time(!)/ocs/v2.php/apps/files_sharing/api/v1/shares
This has multiple drawbacks
On next android version we wanted to rely on changed
eTags
when syncing a folder:eTag
with locally storedeTag
eTag
differsThe problem now is that with this approach we do not get info about favorited/unfavorited folders. (encrypted/not encrypted I have not checked yet).
In my opinion at least the parent folder should then have a changed
eTag
to reflect that something has changed.@skjnldsv @icewind1991