mardi 7 avril 2015

SQLite WAL : Should I checkpoint or commit?

I have two threads , one writes and other reads. Writing thread starts first and reader thread starts a moment later when a threshold entries have been written to the database.


The reader thread opens the database connection and never closes it. The writer thread opens the database connection, checkpoints/commits and closes connection once all entries have been made and then copies the DB file as a backup into flash memory.


Now I have following two doubts:


1)Since reader never closes the connection, the -wal and -shm files always remain there. So I need to delete these files manually when this entire process is started again.


In this scenario, for writer thread before closing the comnnection, what should I use - begin-commit-transaction or simply checkpoint?


2) Do I really need to delete old -wal and -shm files manually or sqlite automatically takes care of that, provided they won't be deleted automatically as reader would never close the connection?


Aucun commentaire:

Enregistrer un commentaire