Am 18.09.2014 15:56, schrieb Stefan Hajnoczi:
There is the issue of request ordering (using write cache flushes).  The
secondary probably needs to perform requests in the same order and
interleave cache flushes in the same way as the primary.  Otherwise a
power failure on the secondary could leave the disk in an invalid state
that is impossible on the primary.  So I'm just pointing out that cache
flush operations matter, not just read/write.


To be honest, my thought was that drive-mirror handles all block device specific problems especially the cache flush requests for write ordering. So my naive approach was to use an existing functionality as a kind of black box transport mechanism and build on top of it. But that seems to be not possible for the subtle tricky part of the game.

This means the "block filter" on the secondary must ensure the commit semantics. But for doing that it must be able to interpret the write ordering semantic of a stream of write requests.


The second, and bigger, point is that if disk commit holds back
checkpoint commit it could be a significant performance problem due to
the slow nature of disks.
You are completely right. This would raise the latency for the primary. This can be done by changing the proposed protocol to write directly at the primary and asynchronously applying updates to the secondary.

There are fancier solutions using either a journal or snapshots that
provide data integrity without posing a performance bottleneck during
the commit phase.

The trick is to apply write requests as they come off the wire on the
secondary but use a journal or snapshot mechanism to enforce commit
semantics.  That way the commit doesn't have to wait for writing out all
the data to disk.

Wouldn't that mean to send a kind of protocol information with the modified Blocks, a barrier or somthing like that?
Can you please explain a little more what you meant?

The details depend on the code and I don't remember everything well
enough.  Anyway, my mental model is:

1. The dirty bit is set *after* the primary has completed the write.
    See bdrv_aligned_pwritev().  Therefore you cannot use the dirty
    bitmap to query in-flight requests, instead you have to look at
    bs->tracked_requests.

2. The mirror block job periodically scans the dirty bitmap (when there
    is no rate-limit set it does this with no artifical delays) and
    writes the dirty blocks.

Given that cache flush requests probably need to be tracked too, maybe
you need MC-specific block driver on the primary to monitor and control
I/O requests.

But I haven't thought this through and it's non-trivial so we need to
break this down more.


As drive-mirror lacks this functionality a way (without changing the drive-mirror code) might be a MC-specific mechanism on the primary. This mechanism must respect write ordering requests (like forced cache flush, and Force Unit Access request) and send corresponding information for a stream of blocks to the secondary.

From what I have learned i'm assuming most guest OS filesystem/block layer follows an ordering interface based on SCSI???? As those kind of requests must be flaged in an I/O request by the guest operating system this should be possible. Do we have the chance to access those information in a guest request?

If this is possible does this information survives the journey through the nbd-server or must there be another communication channel like the QEMUFile approach of “block-migration.c”?

Walid

Reply via email to