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

Intermittent Data Incompleteness Issue When Copying SQLite Database File for Backup #1088

Open
lumingyuan opened this issue Feb 26, 2024 · 1 comment

Comments

@lumingyuan
Copy link

I have encountered an issue where, when backing up data by simply copying the SQLite database file, there is a very small probability of incomplete data on some devices. Even after closing and reopening the app, the issue persists. However, upon reinstalling the app and calling database.close() before copying the database file for backup, the problem seems to be resolved. I am unsure whether this is due to the reinstallation process or the database closure.

Could anyone shed light on the possible reasons behind this? How can I reliably copy the entire dataset for backup purposes?

Thank you for your assistance!

@JamesMcIntosh
Copy link

Are you flushing the writes? i.e.

final File dbFile = File("my.db");
dbFile.writeAsBytesSync(
    data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes),
    flush: true,
);

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

No branches or pull requests

2 participants