On Thu, Jan 16, 2014 at 2:43 PM, Ward Willats <sqlite-us...@wardco.com>wrote:

> Hello Experts:
>
> We are compiling our own amalgamation into our multi-threaded iOS app.
>
> Just saw a busy error where one thread is in sqlite doing an fsync()
> (unix_sync(), full_fsync()) and the the thread that gets the error is
> trying to start a transaction.
>
> So it looks like fsync() is taking more than the 5 second timeout I've set.
>
> What do you think? Should I make the timeout longer, or #define
> SQLITE_NO_SYNC, or?
>

Do not compile with SQLITE_NO_SYNC.

If you want to turn of fsync(), using "PRAGMA synchronous=OFF".

But even doing that is not recommended, since if you turn of fsync() and
you loss power in the middle of writing a transaction, your database will
likely go corrupt.  SQLite uses fsync() like a write-barrier primitive that
ensures that all writes that occur prior to the fsync complete before any
writes that occur afterwards.  If writes occur out-of-order, and some of
the earlier writes never occur, then the database file can go corrupt.
Hence, it is best to leave fsync() turned on.


>
> Thanks, as always,
>
> -- Ward
>
> _______________________________________________
> 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