Hallvard Breien Furuseth wrote:
On 02/08/14 22:31, Howard Chu wrote:
Hallvard Breien Furuseth wrote:
So to explain my previous message a bit: A cacheflush() which flushes a metapage and its datapages all in one chunk makes me nervous. If that's necessary (rather than just flushing the meta at that point), I imagine that just before the flush, it's possible for something to see the metapage before its datapages.
Not possible. The cacheflush is atomic.
Fine, but it's the situation before the flush which worries me, when the cache can be incoherent.
Note that this is invalidating an on-chip data cache which is typically only 32KB or so. It has nothing to do with flushing the buffer cache. ("flush" is a misnomer, but that's what the syscall is called.)
OK, but apparently it's still a cache which can include data from both metapages and datapages.
The thing is, it will only include *old* data from the meta pages or data pages. Because nothing that was updated by write() will be visible to the chip (thru the mmap) until the on-chip data cache is invalidated. And all of that old data will be self-consistent because until the metapage update is visible, nobody will go looking for any of the new datapages.
Or is this only relevant for the same thread, and not other threads/processes (read-only txns starting before the flush)? In that case it would be safe.
It has nothing to do with threads or processes.