Skip to content

Introduce Partial Delete: Improved remoteDelete propagation#9663

Open
vacy wants to merge 2 commits intonextcloud:masterfrom
vacy:master
Open

Introduce Partial Delete: Improved remoteDelete propagation#9663
vacy wants to merge 2 commits intonextcloud:masterfrom
vacy:master

Conversation

@vacy
Copy link
Copy Markdown

@vacy vacy commented Mar 23, 2026

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:

  • 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 #6948

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: client triggered deletions - partly-synced nested directories delete also directories on the server that are not configured to sync

1 participant