On 2011-04-13, at 15:25, Richard Hipp wrote:

> On Wed, Apr 13, 2011 at 9:53 AM, Pavel Ivanov <paiva...@gmail.com>  
> wrote:
>
>>> The fact that one engineer installed a site, began operating the  
>>> app,
>>> then saw it become corrupt minutes later rules out power loss or  
>>> hard
>>> resets in at least that case. An operating system level problem  
>>> should
>>> have been noticed by now given it's Windows XP... And the file is
>>> locally held too.
>>
>> I don't know how Windows's disk cache works but theoretically when  
>> you
>> set synchronous to OFF (0) OS can write database pages to disk in any
>> order it likes, disregarding the order SQLite requires. So while one
>> process writes those pages, another process can read those pages and
>> because of random writing order second process can read inconsistent
>> data, meaning it sees corrupted database.
>>
>
> Pavel, please tell me you are wrong.  Surely windows maintains disk  
> cache
> coherency even in the absence of explicit FlushFileBuffers() calls?
>
> Can any windows experts comment on this?

Of course OS disk caches maintain coherency. The only exceptions to  
this is power failure and hardware malfunction.

FlushFileBuffers() may return before all pending writes have been  
written to the disk surface rendering the function useless. Some  
drives acknowledge a flush request once the data has been written to  
their internal cache instead of waiting until the data has been  
written to the disk surface. Many IDE drives are notorious for this  
problem, which is why "robust" systems used to have SCSI drives.

> [...]

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

Reply via email to