Saturday 15 August 2015

linux - SQLite: Fsyncing with journal_mode = wal and synchronous = normal -


I have an interesting issue using SQLite 3.7.13 on Debian 7.

I am using SQLite with a "Python journal_mod = wall" and "Prague synchronous = normal" to try and avoid fsyncs in the main event loop of a Python program. As suggested by the document, I have disabled automatic checkpoint and from time to time, running "pragma wall_checkpoint" in a " different thread to sync the most recent data on the disk.

It is working I have found that after joining the campaign after a checkpoint in the first main program thread , only one lock for the wall file FSIIN Call is Calling Anyone else The inclusive operation is not the reason for any FSIIN.I have verified it using the Stress.

This is seeing the SQLite docs:

The wall file header is synchronized When a watch file is reused after checkpoint

I'm looking for a way to stop any fsyncs that occur in a main thread, but it still lets me To make periodic checkpoint from other thread Can anything else be done in the check point thread to avoid FSIIC in the main thread?

I have seen "synchronous = off", even though blocking FSINCC for checkpoint is. / P>

Note: I have a separate connection for each database of two threads (in case it is relevant)

And note: The documentation seems elsewhere that it should not be a Be FSIIN, but the behavior seen clearly is different:

Note that with Purgatory Synchronous Set, the normal, checkpoint I / O barrier or sync operation (fsync () Unix or flush file buffers ( ) On windows) if an app Ikeshn making runs checkpoint in separate thread or process, then the main thread or process database queries and updates, but will not block the synchronization operation.

Thanks

To move that FSIIN to another thread For that, make the first operation that changes the database of that thread. You can use harmless things like PRAGMA user_version = 42 (assuming you do not use it).


No comments:

Post a Comment