On Aug 14, 2015, at 10:13 AM, Simon Slavin <slavins at bigfraud.org> wrote:
> On 14 Aug 2015, at 5:16pm, Random Coder <random.coder at gmail.com> wrote:
>> I've run into other issues
>> that lead me to believe the OS is caching file writes until the app
>> exits in some situations regardless of various sync calls, but I never
>> did have time to track down if I was just fooling myself, or if the OS
>> was indeed doing things to "help" me out.
> 
> The hardware in iDevices varies (obviously) between the many devices which 
> have been produced over the years.  But I believe that you're right in that 
> it's not possible for the OS to tell when data has /really/ been written to 
> permanent storage.  Such writing takes a lot of power and it makes sense that 
> a device would want to do it infrequently.

If the device runs out of power normally, your writes are guaranteed. However, 
your app will get no notice. It's equivalent to getting jetsamed during 
low-memory conditions.

That said, it's possible to corrupt a database by forcing the device to power 
off (by holding the power and home buttons) while SQLite's writes are in 
flight. This is equivalent to the conditions of a kernel panic.

Using the system-provided SQLite helps, the unix VFS is modified to be 
(somewhat) more robust on Apple's platforms.

Reply via email to