On Thu, Sep 25, 2014 at 5:53 AM, Deon Brewis <deon...@spamex.com> wrote:

> In the majority of my application, I'm fine running in WAL/NORMAL and lose
> some committed transactions if the application crashes. (Which actually
> just
> happened to me on iOS - I thought that can only happen on a full O/S crash
> -
> not just app. But oh well).
>
> However, every now and again I need to communicate state with an external
> entity and to do that, I need to ensure local durability before that.
>
> Is there any way to force a single manual fsync? (Or is it really just a
> matter of calling the underlying O/S API?)
>
> I know I can checkpoint, but I:
>
> 1) Don't need a full checkpoint - syncing to the WAL is fine.
> 2) Can't tell for sure whether doing a checkpoint while in WAL/NORMAL mode
> will perform a sync before returning.
>

There are maybe a couple of ways to handle this:

(1) Temporarily set "PRAGMA synchronous=FULL;" and do a small transaction.
The transaction might be as simple as "PRAGMA user_version=123;".  The WAL
file is synced after each transaction in synchronous=FULL mode.

(2) Run a checkpoint.  SQLite just fsync the WAL file prior to writing back
content into the database.




>
>
>
>
>
> --
> View this message in context:
> http://sqlite.1065341.n5.nabble.com/Forcing-a-manual-fsync-in-WAL-NORMAL-mode-tp78260.html
> Sent from the SQLite mailing list archive at Nabble.com.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to