Open Faltenreich opened 3 years ago
Hi @Faltenreich ,
We have experienced the same issue with database corruptions. When Database corruption is detected, Android's default behaviour is to remove that database completely (see DefaultDatabaseErrorHandler). This behaviour can be overridden if you supply your own implementation of the DatabaseErrorHandler.
To make it possible to provide our own implementation of the DatabaseErrorHandler new constructor has been introduced in the PR #120 .
There are multiple possible reasons for database corruptions see howtocorrupt.
The plan for our APP is to have a daily database backup job running and restoring the last good known database if corruption is detected in our own DatabaseErrorHandler implementation.
Hi @yuriy-blinov,
this sounds frightening!
Thank you for posting your fix which is really interesting. Backing up the whole database on a daily basis seems like a really big step to me. In my scenario, not the whole database is wiped but only a few dataset entries. Maybe this is not the same problem as you experienced?
Any update on this?
First of all I would like to thank you for OrmLite as it was and is very helpful for migrating my app from using custom cursors to full-fledged object-relational mapping.
Issue Description
Sadly I have some users reporting missing data. These reports come far and few between and so far I was not able to identify common denominators between users. They stretch from several years ago until yesterday when one user reported that some data is going missing sporadically on his Galaxy S9 Dual.
There are no batch tasks that delete data and the only way a DELETE is called is when users delete data manually, one by one. I have checked my CRUD operations and am rather sure that this is some kind of meta-issue affecting OrmLite, the database file or something OS-related. I can only guess wildly since I am not able to reproduce this issue.
Maybe someone has experienced something like that and could help me point in the right direction because I am running out of ideas.
Thank you!
Information
build.gradle
Initialization