-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Collection in a state where it's in an inconsistent state on every sync #5666
Comments
Seems to have only started happening after I used "Select all" on some cards to change them at once. |
One of those might clear things out? While recognizing there may be something underlying causing it |
I was hoping there would be a way to determine what might be causing it. It's intermittent for me. |
There probably is a way and I want to know the cause too, but I was hoping I could get you a workaround that worked for now through the holidays as I won't have time for non-emergency items for quite a while... |
It's not urgent for me. I was hoping there would be some sort of verbose debugging that might reveal something. |
There is but you have to turn on developer mode in your phone (or run the app in an Android Studio development emulator) and listen to logcat - even then it might not show up, but there's a chance. That's beyond most so it's not the first thing I reach for as advice but if you're comfortable with that or want to give it a shot, it's the way to go. Intermittent things are the hardest as clean reproduction scenarios are normally how to pin something down |
By any luck, would you have a deck with more than a thousand cards to see today ? |
Actually, I do have such a deck. That might be the issue then. I would never have thought of that. |
Then the solution, temporary I hope, would be to ensure that you select a deck without a lot of due card before syncing. And to do this on every devices, not only on ankidroid. The reason why I state that you should select a deck with less than a thousand due cards everywhere and not only on ankidroid is that the sanity check is made on the last selected deck. Which might be either the one selected on ankidroid if you used it recently, or the one selected on another computer/phone if it was used more recently and you're trying to synchronize. There is no way of knowing this if you didn't look closely at the code and/or asked Anki's author for insight he has got on ankiweb; since no one else have access to it. Note that I might also get things completly wrong. So I'd be interested in knowing whether my advice works. |
Wow, that is completely unexpected. Great digging @Arthur-Milchior ! I remember thinking that there was no reason we shouldn't calculate the due number with more precision previously (#5322 #5326 ) but apparently we have a side effect. I'm not sure what the right thing to do is, but perhaps I can brainstorm some options: a- only store '1000' (so sync agrees with AnkiWeb/Anki___) while displaying the real number For now it seems like even if the "ideal" solution happens (upstream can store the real quantity) that would take a while to propagate so we should do something for compatibility here. Of those choices is it possible to do option A? If not, I think then at least temporarily B so we don't blow people up Thoughts? |
There seems to be to be another simpler solution. Compute the numbers as you do now. And then, during sync, instead of sending the number, sends min(1000, realNumber) I should emphasize that this number is sent appart, during the safety check steps. So it's not like we would need to edit each deck and do a lot of computations. I didn't really dig anything. Really, it was DAE who explained to me when the syncing fails. And it's even possible that actually that's two unrelated problems. |
I like the |
But does not entirely work. What I'll do is that I'll keep the 1000 limits for cards in learning (which is more than reasonable I believe) and I'll keep the 9999 limits for other kind of cards |
I should note that anyway, anki never really loads 1000 cards. I think it loads 20 cards simultaneously maximum. I assume ankidroid does the same; I've not yet check. So actually the limit 1000 is quite useless in methods which computes the next card to show the user |
@telotortium Quite sorry if you're getting spammed. I don't really know how to write down technical details, and I still went to share them with other devs'. |
Yet another update. Really sorry for the spam. I can't reproduce the problem I used to have, so can't even use android studio debugger. Not sure why. Which means anyway that my analysis was potentially unrelated to @telotortium problem (even if I'd still be interesting by having answers to the questions I asked above.) |
For what it's worth, I'm currently having a similar issue in #5728 ; and selecting a deck with less than 1000 cards on anki, then syncing from anki, then on ankidroid (without syncing from ankidroid first because it doesn't allow it without a full download|upload), then trying to sync from ankidroid, still doesn't let ankidroid manage to sync properly. Also, I do have decks with more than 1000 cards in it (been running pretty much behind recently… worst deck is a filtered deck of ~23k cards, and I also have a few non-filtered decks of a few thousands waiting cards). If there are other questions you'd like an answer to, feel free to ask, I didn't find them above! I'm not sure my problem is the same as @telotortium's, but it does appear close enough. |
Context: We send a triple of Anki-Android/AnkiDroid/src/main/java/com/ichi2/libanki/sync/Syncer.java Lines 380 to 383 in a9c689b
The server checks this value against its values, and recommends a full sync if this doesn't match. We don't send the 'correct' values in some cases. This is because we've modified I can't replicate this with normal decks, but I can replicate this with a filtered deck with over 1000 reviews.
Anki-Android/AnkiDroid/src/main/java/com/ichi2/libanki/Sched.java Lines 722 to 732 in a9c689b
Anki-Android/AnkiDroid/src/main/java/com/ichi2/libanki/Sched.java Lines 1194 to 1204 in a9c689b
Proposed Design:
|
Seems sensible, but careful with refactors in sched there are a few PRs in flight there, backlogged on stability and perturbing them for mechanical refactors has negative value until the PR stack is a lot cleaner |
Will leave the refactor for now then. Thanks for the heads up |
We modified `mReportLimit` in ankidroid#5326 to allow a user to see how many cards they had if there were more than 1000 in a queue. This had an impact on calculating the number of cards in the current deck, which is required for a sync to ensure that the server and client are consistent. This caused an inconsistency (as we calculate the proper value), and this meant that a full sync needed to occur if a dynamic deck with over 1000 cards in a queue was selected. This fixes it by using a new scheduler with the correct `mReportLimit` for calculating the number of cards in the selected deck
We modified `mReportLimit` in ankidroid#5326 to allow a user to see how many cards they had if there were more than 1000 in a queue. This had an impact on calculating the number of cards in the current deck, which is required for a sync to ensure that the server and client are consistent. This caused an inconsistency (as we calculate the proper value), and this meant that a full sync needed to occur if a dynamic deck with over 1000 cards in a queue was selected. This fixes the issue by using a new scheduler with the correct `mReportLimit` for calculating the number of cards in the selected deck
Fixes #5666 - Sync Failure on Large Dynamic Decks We modified `mReportLimit` in #5326 to allow a user to see how many cards they had if there were more than 1000 in a queue. This had an impact on calculating the number of cards in the current deck, which is required for a sync to ensure that the server and client are consistent. This caused an inconsistency (as we calculate the proper value), and this meant that a full sync needed to occur if a dynamic deck with over 1000 cards in a queue was selected. This fixes it by using a new scheduler with the correct `mReportLimit` for calculating the number of cards in the selected deck
2.10alpha55 is out with the fix, as soon as Google is done processing it and starts delivery... |
Fixes #5666 - Sync Failure on Large Dynamic Decks We modified `mReportLimit` in #5326 to allow a user to see how many cards they had if there were more than 1000 in a queue. This had an impact on calculating the number of cards in the current deck, which is required for a sync to ensure that the server and client are consistent. This caused an inconsistency (as we calculate the proper value), and this meant that a full sync needed to occur if a dynamic deck with over 1000 cards in a queue was selected. This fixes it by using a new scheduler with the correct `mReportLimit` for calculating the number of cards in the selected deck
released in 2.9.6beta4 |
It was introduced due to ankidroid#5666, but AnkiWeb has ignored the due counts in the sanity check for about 18 months, so this is no longer necessary. Also remove _updateCutoff() and _checkDay() from the public API.
It was introduced due to ankidroid#5666, but AnkiWeb has ignored the due counts in the sanity check for about 18 months, so this is no longer necessary. Also remove _updateCutoff() and _checkDay() from the public API.
It was introduced due to ankidroid#5666, but AnkiWeb has ignored the due counts in the sanity check for about 18 months, so this is no longer necessary. Also remove _updateCutoff() and _checkDay() from the public API.
It was introduced due to ankidroid#5666, but AnkiWeb has ignored the due counts in the sanity check for about 18 months, so this is no longer necessary. Also remove _updateCutoff() and _checkDay() from the public API.
It was introduced due to ankidroid#5666, but AnkiWeb has ignored the due counts in the sanity check for about 18 months, so this is no longer necessary. Also remove _updateCutoff() and _checkDay() from the public API.
It was introduced due to ankidroid#5666, but AnkiWeb has ignored the due counts in the sanity check for about 18 months, so this is no longer necessary. Also remove _updateCutoff() and _checkDay() from the public API.
It was introduced due to ankidroid#5666, but AnkiWeb has ignored the due counts in the sanity check for about 18 months, so this is no longer necessary. Also remove _updateCutoff() and _checkDay() from the public API.
It was introduced due to #5666, but AnkiWeb has ignored the due counts in the sanity check for about 18 months, so this is no longer necessary. Also remove _updateCutoff() and _checkDay() from the public API.
kotlincleanup: additional uses of .apply Reduce the API surface of AbstractSched Initial prep work for adding the V3 scheduler. Removed some methods that are only used internally, and defined some overloads concretely. eta() implementation in v1 appeared to be functionally identical to v2, despite the comment. Remove setReportLimit() It was introduced due to ankidroid#5666, but AnkiWeb has ignored the due counts in the sanity check for about 18 months, so this is no longer necessary. Also remove _updateCutoff() and _checkDay() from the public API. Split majority of AbstractSched into BaseSched - Mirrors the code layout of the desktop version, where routines like buryCard(), that are not specific to V2 or V3, are stored in a separate file. This leaves AbstractSched containing only the methods that will need to be implemented separately for V3. - Moves some methods from SchedV2 into BaseSched, as V3 will want to use them as well for now. - Some of the routines in BaseSched will only work with a schema upgrade. For now, SchedV2 overrides these so they continue to work with the legacy schema. Add support for the V3 scheduler Add V3 scheduler tests Like the desktop, this works by using a single set of tests that alter some of the checks depending on the active scheduler version, so that code duplication is avoided. Use backend to calculate legacy timezone I expect this fixes ankidroid#9368 Bumps the backend version, since the API changed. Closes ankidroid#11881 Backend language tweaks - Move logic from backend into frontend, so a new backend release is not required - Fix mapping of Chinese languages and Hindi; check others - Don't require a restart after changing language in prefs Fix LeakCanary warning when changing language/v16 schema After discarding the backend, Preferences was calling getCol and passing itself in as the context. This caused the preferences screen to be retained as the backend lives on. By switching to AnkiDroidApp, a leak can be avoided. Fix some connected tests failing when legacy_schema=false Some were irrelevant; the ones in ContentProviderTest need investigating. Updated strings from Crowdin Bumped version to 2.16alpha76 more uses of .apply reintroduced null checks and removed specified nullable type
Reproduction Steps
Expected Result
Sync completes without conflicts.
Actual Result
Sync seems to proceed as normal - data is uploaded and downloaded - and the Ankidroid complains that the local collection is inconsistent. Making changes to the collection on the desktop doesn't result in inconsistencies on the desktop side.
Debug info
Refer to the support page if you are unsure where to get the "debug info".
Research
Enter an [ x ] character to confirm the points below:
[X] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid
[X] I have checked the manual and the FAQ and could not find a solution to my issue
[X] I have searched for similar existing issues here and on the user forum
The text was updated successfully, but these errors were encountered: