Repository navigation
gui, lib: Fix tracking deleted locally-changed on encrypted (fixes #7715) - #7726
Conversation
|
Can you explain in human words what the mechanism here is? I don't fully follow. |
|
I can try: Two requirements with whatever the solution is (#7715 (comment)):
Status quo:
Problem: Valid files that exist globally, but the user mistakenly deleted locally, aren't shown as missing in the UI and thus can't be recreated (by reverting). Status PR: Instead of removing the flag for deleted, locally changed files that only ever existed locally, like we do now for receive-only folders, we delete the item from the database.
How is it done: Add a new method |
|
I need to think about this a little bit more, but I don't think we can just remove things from the database. Those entries will have taken up a sequence number, removing them and doing a meta recalculation would rewind the sequence number which is not great. |
|
That's a good point: Recalculating metadata and not resetting delta indexes seems like a dangerous thing to do in general. Even today where there should be no way the sequence number decreases when recalculating metadata, I think it would be better to ensure it doesn't (or reset delta indexes). |
|
Completely forgot about this PR - bump. |
|
🤖 beep boop I'm going to close this pull request as it has been idle for more than 90 days. This is not a rejection, merely a removal from the list of active pull requests that is periodically reviewed by humans. The pull request can be reopened when there is new activity, and merged once any remaining issues are resolved. |
|
Hmm, no. This is actually still a relevant bug-fix. Just unfortunately touching the db, i.e. an annoying one. @calmh If you'd prefer the alternative with the new flag (see below) instead of removing file-infos from db, I could create a PR for that (I'd still prefer the current approach, but very much understand the hesitance to touch/change this core/database part):
|
|
I don't like either option as it's all intrusive, complicated and annoying. :) But thinking about it again I think it's fine to remove things from the database that should be unseen. At some point I want to revive my PR to remove old deleted items as well, in order to prevent infinite index growth, and that's similar. The sequence number concern is there, but if it happens (which would only be if the removed item is the latest one) it should trigger the "out of sync with realize" path in delta indexes and force a full retransmission, fixing the issue. |
|
So with that out of the way I think this is fine; is it good for review (still?) or needs something to revive? |
|
The "sequence index going backwards on recalculation"-issue is even explicitly handled now: #7770 It was ready before, had a quick look over it now given it's been a long while, looks good and passes tests still after merging - ready for review.
|
* main: (32 commits) cmd/syncthing: Implement generate as a subcommand with optional API credential setting (fixes syncthing#8021) (syncthing#8043) lib/model: Correct "reverting folder" log entry lib/model: Correct handling of fakefs cache gui, lib: Fix tracking deleted locally-changed on encrypted (fixes syncthing#7715) (syncthing#7726) lib/config: Move the bcrypt password hashing to GUIConfiguration (syncthing#8028) lib/syncthing: Clean up / refactor LoadOrGenerateCertificate() utility function. (syncthing#8025) lib/api: http.Request.BasicAuth instead of custom code (syncthing#8039) Normalize CLI options to always use two dashes. (syncthing#8037) gui: Display identicons for discovered device IDs. (syncthing#8022) cmd/syncthing/cli: indexDumpSize doesn't need a heap (syncthing#8024) lib/model: Optimize jobQueue performance and memory use (syncthing#8023) lib/model: Limit the number of default hashers on Android (ref syncthing#2220) lib/model: Set mod. time after writing trailer in shortcut (ref syncthing#7992) lib/protocol: Simplify codeToError, errorToCode lib/protocol: Eliminate nativeModel on Unix gui: Add direct link to Ignore Patterns from folder panel (fixes syncthing#4293) (syncthing#7993) gui: Translate theme names in settings (syncthing#8006) lib/model: Pull when a new connection is established (fixes syncthing#8012) (syncthing#8013) gui, man, authors: Update docs, translations, and contributors gui, man, authors: Update docs, translations, and contributors ...
* main: (32 commits) cmd/syncthing: Implement generate as a subcommand with optional API credential setting (fixes syncthing#8021) (syncthing#8043) lib/model: Correct "reverting folder" log entry lib/model: Correct handling of fakefs cache gui, lib: Fix tracking deleted locally-changed on encrypted (fixes syncthing#7715) (syncthing#7726) lib/config: Move the bcrypt password hashing to GUIConfiguration (syncthing#8028) lib/syncthing: Clean up / refactor LoadOrGenerateCertificate() utility function. (syncthing#8025) lib/api: http.Request.BasicAuth instead of custom code (syncthing#8039) Normalize CLI options to always use two dashes. (syncthing#8037) gui: Display identicons for discovered device IDs. (syncthing#8022) cmd/syncthing/cli: indexDumpSize doesn't need a heap (syncthing#8024) lib/model: Optimize jobQueue performance and memory use (syncthing#8023) lib/model: Limit the number of default hashers on Android (ref syncthing#2220) lib/model: Set mod. time after writing trailer in shortcut (ref syncthing#7992) lib/protocol: Simplify codeToError, errorToCode lib/protocol: Eliminate nativeModel on Unix gui: Add direct link to Ignore Patterns from folder panel (fixes syncthing#4293) (syncthing#7993) gui: Translate theme names in settings (syncthing#8006) lib/model: Pull when a new connection is established (fixes syncthing#8012) (syncthing#8013) gui, man, authors: Update docs, translations, and contributors gui, man, authors: Update docs, translations, and contributors ...
This PR removes the ugly hack explained in #7715:
Instead it adds the non-ugly, but somewhat scary ability to remove file infos from the database. We already do that, but only in bulk when a device changes index-id/is removed. It isn't rocket science, it's just the half of
updateLocalFilesthat removes the old file. The scary bit is just that the code it touches is already scary.An alternative to this approach would be adding a new flag (e.g.
FlagLocalReceiveEncryptedDeleted) and mark locally-changed, deleted items in receive-encrypted folders with that flag. This sidesteps the database changes, but instead of getting rid of useless file-infos, it keeps them with a new flag. That's why I'd prefer the db variant.To facilitate removing as well as updating files while scanning, I added a
scanBatchtype withUpdateandRemovemethods, that replaces thebatchAppendFunctionthat was passed around as a function argument before.Testing
Added one new test that ensures that spurious files added to either receive-only or receive-encrypted folders, that are subsequently deleted, don't show up as locally-changed. And extended an existing test to check the same thing.