Introduce Partial Delete: Improved remoteDelete propagation#9663
Introduce Partial Delete: Improved remoteDelete propagation#9663vacy wants to merge 2 commits intonextcloud:masterfrom
Conversation
Implements a safety mechanism to prevent dataloss when deleting folders
that contain selective sync exclusions.
When a folder containing unsynced descendants is deleted:
- Instead of deleting the whole folder on the server, only the synced
content is deleted - i.e. content the user was able to see.
- The folder itself and any unsynced content remains on the server.
- This preserves data that would otherwise be lost.
Changes:
- common/syncjournaldb.cpp:
- added hasSelectiveSyncDescendants() to check if a path
has unsynced descendants in the selective sync blacklist.
- added getSyncedDescendants() to get all synced items
within a folder path.
- libsync/propagateremotedelete.cpp: modified start() to detect when a folder
deletion would affect unsynced content. Implements partial deletion
mode that deletes synced items individually while preserving the
folder and unsynced content.
- libsync/owncloudpropagator.cpp: added selectiveSyncList management
Fixes nextcloud#6948
Signed-off-by: Jan-Florian Hilgenberg <florianhilgenberg@gmail.com>
mgallien
left a comment
There was a problem hiding this comment.
@vacy can you please add automated tests covering the changes you have done ?
I am very unconvinced about the behavior change as it would be very confusing that when you delete a folder, it ends up not being deleted
so if I get it correctly, you would have:
parent [*]
parent/child1 [*]
parent/child2 [ ]
if you delete parent, you would like to preserve the unsynced folder parent/child2
do you also avoid deleting parent ?
|
from what I understand, the plan is that on client side, if you use selective synchronization or folders on-demand (possible on Windows and macOS with virtual files), deleting parent folder may result in this folder not being deleted we want to move away from selective sync for the more flexible option of using virtual files on all platforms (including only syncing the content of folders you have really accessed) I did some testing with other products and they apparently opt in a warning popup that local deletions is also going to be a remote deletion with an option disable the warning we would like to encourage you to keep contributing to the files desktop client and would be happy to review other PRs from you |
Summary
If a user deletes a folder, one would expect to delete only data that the user could've seen.
In case the deleted folder contains data, that was deselected for sync - thus user didnt see that - the desktop client would also delete that unseen data on the server.
I already had some discussion about a while ago in: #6948 and https://help.nextcloud.com/t/desktop-client-triggered-deletions-are-deleting-not-synced-data/199356
Comparison to competitors
Also compared this behavior to OneDrive and Dropbox. Both keep data on the server, because they assume the user has not seen it, thus does not want to delete that portion.
When would you face this problem?
You decided willingly to sync only part of the folder structure. You forget about it and delete the parent.
Syncengine decided automatically that a folder would be added to blacklist, you most likely do not know about that.
Yes the client notifies about it. But does it always? Notifications are also prone to alert fatigue.
I would also expect this problem, but that is not verified:
-> When data is incoming from your own account or a received share and the client is still downloading the data
-> You delete the folder and it deletes everything on the server, even data you didnt see yet and even data in a received share.
Changes
Implements a safety mechanism to prevent dataloss when deleting folders that contain selective sync exclusions.
When a folder containing unsynced descendants is deleted:
Changes:
common/syncjournaldb.cpp:
libsync/propagateremotedelete.cpp: modified start() to detect when a folder deletion would affect unsynced content. Implements partial deletion
mode that deletes synced items individually while preserving the
folder and unsynced content.
libsync/owncloudpropagator.cpp: added selectiveSyncList management
Fixes #6948