On 1/19/16, Meinlschmidt Stefan <Stefan.Meinlschmidt at esolutions.de> wrote:
>
> Shutting down power right after a successfully committed
> transaction rolls back that transaction on next startup.

As you observe, this is a file-system dependent thing, and probably
only happens on the QNX filesystem.  I will see if we can add a
compile-time option to the next release that will allow you to force a
directory sync after the rollback journal commits.  But this won't be
on by default because it would do nothing but slow down commits on the
overwhelming majority of SQLite users.

Meanwhile, a good work-around for you might be to use either

     PRAGMA journal_mode=TRUNCATE;
     PRAGMA journal_mode=PERSIST;

Both of which sync the rollback-journal upon commit.  Or, use:

     PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL;

which causes the write-ahead log to be synced following every commit.
Note that the default behavior for WAL mode is that the WAL is not
synced, and hence committed transactions might rollback following a
power loss.  This is the behavior most people desire (not that their
transactions roll back but rather they are willing to endure that in
exchange for fewer fsyncs.)  You must set "PRAGMA synchronous=FULL" to
cause the WAL to be synced after each transaction.

-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to