-
Notifications
You must be signed in to change notification settings - Fork 163
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
When a realm file is considered corrupted, give the developer a way to detect and recover #3031
Comments
So like https://realm.io/docs/dotnet/2.0.0/api/reference/Realms.Exceptions.RealmInvalidDatabaseException.html but in all APIs? (and like realm/realm-java#2912 which never happened for some reason) |
It's important to acknowledge, that we do not know the root cause and there is some chance of building a scheme which would rename (or poison) a perfect realm file, because the bug is elsewhere. |
It's tempting to throw an exception full of relevant information instead of asserting. That would allow anyone who catches the exception to take appropriate action. Against it counts that in many cases, we cannot risk continued operation after the error and we know from experience that in many cases such exceptions are just caught and ignored. Not a good combination. |
➤ Brian Munkholm commented: We could reuse the current backup solution. It would have to be configurable if backups should be made. |
Ref: #2258
Today we assert when the realm file seems corrupted. That leaves users with a restarting app that can never recover unless it's reinstalled.
Solutions to this has been discussed at length here: #728
One suggestion could be:
In specific situations when we detect that the file seems corrupt an option could indicate that the file should be backed up and removed the next time it was opened.
The text was updated successfully, but these errors were encountered: