does sqlite online backup require fsync?

24 Views Asked by At

I'm using the sqlite online backup api in python

    target = sqlite3.connect(backup_file)
    with contextlib.closing(target): 
        with self._connection() as source:   # source db connection
            source.backup(target)

This works fine most of the time, but occasionally when the power is shut off very soon afterwards the "backup_file" ends up as zero length, which is typical of data not being synced. Should sqlite be doing this fsync/fdatasync of the backup database, or does it need to be handled explicly, e.g., with os.sync() ? (because there is no fd to fsync)

Extra context:
sqlite version 2.6.0 (upgrading not an option at this time)
Running on linux 4.14,0, filesystem is ubifs.

0

There are 0 best solutions below