[sqlite] fsync on iOS

2014-01-16 Thread Ward Willats
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

Re: [sqlite] fsync on iOS

2014-01-16 Thread Richard Hipp
On Thu, Jan 16, 2014 at 2:43 PM, Ward Willats sqlite-us...@wardco.comwrote: 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

Re: [sqlite] fsync on iOS

2014-01-16 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 16/01/14 11:43, Ward Willats wrote: So it looks like fsync() is taking more than the 5 second timeout I've set. This is not uncommon on mobile devices using flash based storage. There is a lot of volatility in read and write performance. I

Re: [sqlite] fsync on iOS

2014-01-16 Thread Ward Willats
On Jan 16, 2014, at 12:02 PM, Richard Hipp d...@sqlite.org wrote: Do not compile with SQLITE_NO_SYNC. Okay. Thanks. On Jan 16, 2014, at 1:29 PM, Roger Binns rog...@rogerbinns.com wrote: On 16/01/14 11:43, Ward Willats wrote: So it looks like fsync() is taking more than the 5 second

Re: [sqlite] fsync on iOS

2014-01-16 Thread Richard Hipp
FYI: If you use PRAGMA journal_mode=WAL; with PRAGMA synchronous=NORMAL;, then fsync()s will only occur during a checkpoint operation. And, you can turn off automatic checkpointing and run checkpoints from a separate thread or process, and let that separate thread or process take the fsync()

Re: [sqlite] fsync on iOS

2014-01-16 Thread Ward Willats
On Jan 16, 2014, at 1:50 PM, Richard Hipp d...@sqlite.org wrote: FYI: If you use PRAGMA journal_mode=WAL; with PRAGMA synchronous=NORMAL;, then fsync()s will only occur during a checkpoint operation. And, you can turn off automatic checkpointing and run checkpoints from a separate thread

Re: [sqlite] fsync on iOS

2014-01-16 Thread Ward Willats
On Jan 16, 2014, at 1:50 PM, Richard Hipp d...@sqlite.org wrote: FYI: If you use PRAGMA journal_mode=WAL; with PRAGMA synchronous=NORMAL;, then fsync()s will only occur during a checkpoint operation. And, you can turn off automatic checkpointing and run checkpoints from a separate thread