On Apr 3, 2010, at 5:47 PM, Ragnar Sundblad wrote:
> On 2 apr 2010, at 22.47, Neil Perrin wrote:
> 
>>> Suppose there is an application which sometimes does sync writes, and
>>> sometimes async writes.  In fact, to make it easier, suppose two processes
>>> open two files, one of which always writes asynchronously, and one of which
>>> always writes synchronously.  Suppose the ZIL is disabled.  Is it possible
>>> for writes to be committed to disk out-of-order?  Meaning, can a large block
>>> async write be put into a TXG and committed to disk before a small sync
>>> write to a different file is committed to disk, even though the small sync
>>> write was issued by the application before the large async write?  Remember,
>>> the point is:  ZIL is disabled.  Question is whether the async could
>>> possibly be committed to disk before the sync.
>>> 
>>> 
>> 
>> Threads can be pre-empted in the OS at any time. So even though thread A 
>> issued
>> W1 before thread B issued W2, the order is not guaranteed to arrive at ZFS 
>> as W1, W2.
>> Multi-threaded applications have to handle this.
>> 
>> If this was a single thread issuing W1 then W2 then yes the order is 
>> guaranteed
>> regardless of whether W1 or W2 are synchronous or asynchronous.
>> Of course if the system crashes then the async operations might not be there.
> 
> Could you please clarify this last paragraph a little:
> Do you mean that this is in the case that you have ZIL enabled
> and the txg for W1 and W2 hasn't been commited, so that upon reboot
> the ZIL is replayed, and therefore only the sync writes are
> eventually there?

yes. The ZIL needs to be replayed on import after an unclean shutdown.

> If, lets say, W1 is an async small write, W2 is a sync small write,
> W1 arrives to zfs before W2, and W2 arrives before the txg is
> commited, will both writes always be in the txg on disk?

yes

> If so, it would mean that zfs itself never buffer up async writes to
> larger blurbs to write at a later txg, correct?

correct

> I take it that ZIL enabled or not does not make any difference here
> (we pretend the system did _not_ crash), correct?

For import following a clean shutdown, there are no transactions in 
the ZIL to apply.

For async-only workloads, there are no transactions in the ZIL to apply.

Do not assume that power outages are the only cause of unclean shutdowns.
 -- richard

ZFS storage and performance consulting at http://www.RichardElling.com
ZFS training on deduplication, NexentaStor, and NAS performance
Las Vegas, April 29-30, 2010 http://nexenta-vegas.eventbrite.com 

_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to