Skip to content

fix(next storage): Force SQLite checkpoint on Pie and up #582

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

Merged
merged 3 commits into from
Apr 23, 2021

Conversation

krizzu
Copy link
Member

@krizzu krizzu commented Apr 9, 2021

Summary

From Pie and up, Android started to use Write-ahead logging (WAL) by default, instead of journal rollback. WAL does not write directly to the database file, rather to the supporting WAL file. The content of WAL file is "flushed" to original DB file (this action is called a checkpoint), when page size threshold is reached (default is 1000).

Because of that, migration to Next storage might not be successful, because RKStorage database content might still be in WAL file (and Next AsyncStorage uses RKStorage file to rehydrate itself). This PR introduces a helper that will make sure we force checkpoint, to always have the latest content on db file, before migrating.

@EvanBacon I suspect we'd want the same thing happen for Expo migration as well?

@krizzu krizzu requested a review from tido64 April 9, 2021 08:01
@krizzu krizzu force-pushed the fix/next-storage-migration-pie branch from ab890e0 to a53961f Compare April 9, 2021 08:04
@krizzu krizzu force-pushed the fix/next-storage-migration-pie branch from 2e31f97 to 890799d Compare April 21, 2021 09:12
@krizzu krizzu requested a review from tido64 April 22, 2021 07:25
@krizzu
Copy link
Member Author

krizzu commented Apr 22, 2021

@tido64 thanks, ready for re-review 🙏

Copy link
Member

@tido64 tido64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@krizzu krizzu merged commit c2aa400 into master Apr 23, 2021
@krizzu krizzu deleted the fix/next-storage-migration-pie branch April 23, 2021 12:10
@krizzu
Copy link
Member Author

krizzu commented Apr 23, 2021

🎉 This PR is included in version 1.15.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

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