Skip to content
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

Oncorruption logging #188

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Oncorruption logging #188

wants to merge 4 commits into from

Conversation

djih
Copy link
Member

@djih djih commented Jan 16, 2019

  1. Added a custom onCorruption handler. Most of the code is from Android's DefaultDatabaseErrorHandler, I just added a call to Diagnostic logger to log an error with the current stack trace
  2. I tried to do something fancy where I add a callback function to the corruption handler so it can also try to re-insert the metadata in the onCorruption method, but AFAIK you can't open a new database instance from inside the DatabaseErrorHandler class
  3. Added some more metrics to the diagnostics logger (free / total / available heap, and free disk space)
  4. Also added SDK + version to the diagnostic events

Unfortunately was not able to trigger the onCorruption handler in any of the unit tests. For some reason the corrupted files trigger a SqliteException: Cannot prepare statement, base error code: 26, instead of SQLiteDatabaseCorruptException which triggers the onCorruption path

@djih djih requested a review from curtisliu January 16, 2019 00:03
@djih
Copy link
Member Author

djih commented Jan 18, 2019

Could delegate to instance of default error handler. PTAL @curtisliu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants