-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fix(db): remote invalid files cannot be the global version #10161
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
Conversation
|
From description and code, it looks like the local file is special in that it is considered global, even if it is invalid - if that's wrong, the following is moot: |
Good question, and that was also my gut feeling & first fix attempt. We do use the local-is-global-is-invalid scenario in one case, namely receive only folders with local changes. Their behaviour seems to depend on this enough that a couple of tests fail if we don't do it. I didn't want to get too deep into those weeds right now. It does in any case end up consistent (I think; from what I can see), as we do exclude files with the ignored flag when doing the local counts etc. At least when I test... |
|
Ok, I understand now how this ends up with consistent local and global counts: We do consider local flags in counts, but we don't consider the invalid bool. That's why marking an invalid local file as global is fine, it has local flags, while adding a invalid remote file inflates counts. And don't we need a migration to remove the global flags with this change from the affected files? Also long-term/conceptually, I think it's nice-ish to keep marking invalid files as global. That e.g. allows to find all files that are "globally invalid" easily, so we could also drop them from the DB. Given we now clean up old deleted files (still a bit worried about this one :) ), also cleaning up old invalid files seems quite sensible. |
... in principle, yes. But we're talking about a few hundred RC users so far. I was going to say reset deltas if this is an actual problem.
This sounds like it has merit. Let me look into that (or you can, if you get to it first ;) |
I am already 90% there, started before I saw your message - hope we didn't do it twice now. Still looks like it has merits to me, just a bit a pervasive change :) |
|
Here it is. However take with a good bit of salt, I just pushed this to pass tests without stopping to think overly much along the way, good chance there are some questionable (at best) decisions in there: |
This fixes a problem where remote invalid files (such as files that were once announced but then ignored) would be accounted into the "global size" counters, leading to confusion in the GUI. The handling of such files is slightly different between v1 and v2.
In v1, we let invalid files become the global but avoid adding them to the need list. We then exclude them files from the accounting too, to avoid just the problem I'm solving here.
In v2, we don't have a separate need list but we set a need bit per file, which we already don't do for these files. However we did mark them as "global" which would mean they got accounted. Instead of hacking the accounting, avoid marking them as global as it does not make sense anyway.
Removes a test for an old bug that expects to be able to get an invalid file as the global version. This is no longer and thing (and shouldn't be), and whatever it tested for should ideally not be relevant any more... 😬 That was somehow related to #7474 which is a whole other can of worms (I added a comment there...)