-
Notifications
You must be signed in to change notification settings - Fork 1
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
Dealing with possible database corruption #34
Comments
Possible causes of corruption on iOS that were already resolved (for reference):
Additional idea may be to use |
My android cordova project is using this plugin for 2 years and got some sqlite malform report.
|
@githoniel I highly recommend that you push an update with a recent version of this plugin to your users and advise your users to install the update, especially in case of malformed data. The recent updates should take resolve the errors mentioned in your second point ( |
@brodybits remove transaction is not enough and update the plugin is required ? |
@githoniel please update the plugin. Even sqlBatch may suffer from this kind of an issue since it does the batch in multiple steps (waits for other statements to succeed before issuing |
To address the question in storesafe/cordova-sqlite-storage#703 (comment):
Please update with a recent version of this plugin. There are some recent updates to resolve possible data loss risk issues. |
From storesafe/cordova-sqlite-storage#703 (comment):
I cannot promise anything without looking at your application, and in many cases I cannot promise an absolute solution even after looking at the application. Database corruption may occur if something really goes wrong with the access. I have already found and fixed some possible causes as described above. In general it is highly recommended to keep your application up to date with this and other plugins. This should be able to save you time investigating issues that may have already been fixed. I can think of a couple more ideas that may be worth trying if you continue to see database corruption issues after updating your application:
|
Additional discussions:
|
FYI I had an open question about whether or not using WAL could be more robust against possible database corruption ref: #10 (comment), #10 (comment) From #10 (comment):
My conclusion has been to simply use |
Another update I had made around January 2019 was to start using SQLITE_DBCONFIG_DEFENSIVE ref: |
I would like to quote a couple of major statements from a new review of some discussions on the SQLite mailing list, for the sake of further discussion: From these discussions on WAL (linked from #10 (comment)): I think this is the key information from Hipp: (4) WAL mode is much more resistant to corruption following a power failure that occurs soon after the disk drive lied and said that content was committed to oxide when in fact it was still in a volatile track buffer. And pretty much all consumer-grade disk drives tell such lies these days. From http://sqlite.1065341.n5.nabble.com/Database-is-malformed-but-no-further-information-td102451.html:
At this point I hope the "EXTRA DURABLE" build setting I made as discussed in storesafe/cordova-sqlite-storage#736 proves to be sufficiently robust against the common "consumer-grade" hardware issues discussed on the mailing list. I guess only time will tell here. |
Reports of sqlite corruption on Cordova have been extremely rare but I have a customer who is dealing with this kind of issue right now. In general I recommend that app developers upgrade to a very recent version of the plugin before diving into much deeper investigation.
In case of an app that seems vulnerable to database corruption it is recommended to do
PRAGMA integrity_check
at certain points and do the following in case it does not report "OK":I found and recommend the following links, despite what looks like some conflicting information:
See below for additional discussions.
The text was updated successfully, but these errors were encountered: