qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [PATCH qemu 4/4] iotests: add test for bitmap mirror
Date: Tue, 13 Oct 2020 16:31:47 +0200	[thread overview]
Message-ID: <d3e65efe-caac-fffb-f846-a5467f8c9462@redhat.com> (raw)
In-Reply-To: <1601624180.56wvsjysei.astroid@nora.none>


[-- Attachment #1.1: Type: text/plain, Size: 6879 bytes --]

On 02.10.20 10:23, Fabian Grünbichler wrote:
> On October 1, 2020 7:31 pm, Max Reitz wrote:
>> On 22.09.20 11:14, Fabian Grünbichler wrote:
>>> heavily based on/practically forked off iotest 257 for bitmap backups,
>>> but:
>>>
>>> - no writes to filter node 'mirror-top' between completion and
>>> finalization, as those seem to deadlock?
>>> - no inclusion of not-yet-available full/top sync modes in combination
>>> with bitmaps
>>> - extra set of reference/test mirrors to verify that writes in parallel
>>> with active mirror work
>>>
>>> intentionally keeping copyright and ownership of original test case to
>>> honor provenance.
>>>
>>> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
>>> ---
>>>  tests/qemu-iotests/306     |  546 +++++++
>>>  tests/qemu-iotests/306.out | 2846 ++++++++++++++++++++++++++++++++++++
>>>  tests/qemu-iotests/group   |    1 +
>>>  3 files changed, 3393 insertions(+)
>>>  create mode 100755 tests/qemu-iotests/306
>>>  create mode 100644 tests/qemu-iotests/306.out
>>>
>>> diff --git a/tests/qemu-iotests/306 b/tests/qemu-iotests/306
>>> new file mode 100755
>>> index 0000000000..1bb8bd4138
>>> --- /dev/null
>>> +++ b/tests/qemu-iotests/306
>>
>> [...]
>>
>>> +def test_bitmap_sync(bsync_mode, msync_mode='bitmap', failure=None):
>>> +    """
>>> +    Test bitmap mirror routines.
>>> +
>>> +    :param bsync_mode: Is the Bitmap Sync mode, and can be any of:
>>> +        - on-success: This is the "incremental" style mode. Bitmaps are
>>> +                      synchronized to what was copied out only on success.
>>> +                      (Partial images must be discarded.)
>>> +        - never:      This is the "differential" style mode.
>>> +                      Bitmaps are never synchronized.
>>> +        - always:     This is a "best effort" style mode.
>>> +                      Bitmaps are always synchronized, regardless of failure.
>>> +                      (Partial images must be kept.)
>>> +
>>> +    :param msync_mode: The mirror sync mode to use for the first mirror.
>>> +                       Can be any one of:
>>> +        - bitmap: mirrors based on bitmap manifest.
>>> +        - full:   Full mirrors.
>>> +        - top:    Full mirrors of the top layer only.
>>> +
>>> +    :param failure: Is the (optional) failure mode, and can be any of:
>>> +        - None:         No failure. Test the normative path. Default.
>>> +        - simulated:    Cancel the job right before it completes.
>>> +                        This also tests writes "during" the job.
>>> +        - intermediate: This tests a job that fails mid-process and produces
>>> +                        an incomplete mirror. Testing limitations prevent
>>> +                        testing competing writes.
>>> +    """
>>> +    with iotests.FilePath('img', 'bsync1', 'bsync2', 'bsync3',
>>> +                            'fmirror0', 'fmirror1', 'fmirror2', 'fmirror3') as \
>>
>> The indentation is off now.
>>
>>> +                            (img_path, bsync1, bsync2, bsync3,
>>> +                             fmirror0, fmirror1, fmirror2, fmirror3), \
>>> +         iotests.VM() as vm:
>> Hm.  On tmpfs, this test fails for me:
>>
>> ($ TEST_DIR=/tmp/iotest ./check -qcow2 306)
>>
>> @@ -170,7 +170,7 @@
>>      "drive0": [
>>        {
>>          "busy": false,
>> -        "count": 262144,
>> +        "count": 458752,
>>          "granularity": 65536,
>>          "persistent": false,
>>          "recording": true,
>> @@ -464,7 +464,7 @@
>>      "drive0": [
>>        {
>>          "busy": false,
>> -        "count": 262144,
>> +        "count": 458752,
>>          "granularity": 65536,
>>          "persistent": false,
>>          "recording": true,
>> @@ -760,7 +760,7 @@
>>      "drive0": [
>>        {
>>          "busy": false,
>> -        "count": 262144,
>> +        "count": 393216,
>>          "granularity": 65536,
>>          "persistent": false,
>>          "recording": true,
>> @@ -1056,7 +1056,7 @@
>>      "drive0": [
>>        {
>>          "busy": false,
>> -        "count": 262144,
>> +        "count": 458752,
>>          "granularity": 65536,
>>          "persistent": false,
>>          "recording": true,
>> @@ -1350,7 +1350,7 @@
>>      "drive0": [
>>        {
>>          "busy": false,
>> -        "count": 262144,
>> +        "count": 458752,
>>          "granularity": 65536,
>>          "persistent": false,
>>          "recording": true,
>> @@ -2236,7 +2236,7 @@
>>      "drive0": [
>>        {
>>          "busy": false,
>> -        "count": 262144,
>> +        "count": 458752,
>>          "granularity": 65536,
>>          "persistent": false,
>>          "recording": true,
>>
>> Can you see the same?
> 
> yes, but also only on tmpfs. ext4, xfs, ZFS all work fine.. the numbers 
> for tmpfs vary between runs, each wrong count is sometimes 393216 (256k 
> expected + 128k extra), sometimes 458752 (+192k). it's always the dirty 
> bitmap used by the mirror job which is 'wrong', not the passed-in sync 
> bitmap which verifies correctly. the final mirror results also seem 
> correct.
> 
> for the first diff hunk (bitmap + never + simulated), we did
> 
> - reference mirror #0
> - add sync bitmap 'bitmap0'
> - do writes to dirty 6 sectors (393216)
> - reference mirror #1
> - test mirror #1
> - bitmap0 still has count 393216
> - reference mirror #2
> - test mirror #2
> -- while that is not yet completed, do 4 more writes
> -- bitmap0 now has count 393216 + 262144 655360
> -- dirty bitmap 'should have' count 262144, but has 458752 or 393216
> 
> this is not what actually interests us at this point: how far the mirror 
> has progressed does not matter, we just want to see that the writes we 
> did while it was ongoing have been reflected in the sync bitmap.

I see.  The active bitmap the backup job adds isn’t cleared when
progress is made (it’s only used to capture dirtying writes while the
job runs, so the initial bitmap stays constant), in contrast to the one
that mirror adds.  Backup doesn’t clear any bitmap, because it doesn’t
need to – a single iteration is sufficient to catch everything that was
dirty at the beginning of the job.

So, yes, we should hide dirty_bitmap, as it can be in an arbitrary state
while the mirror job is running, and it doesn’t give us useful information.

> unless there is some hunch that this difference in mirroring 'speed' 
> between the file systems is something that we need to take a look at, 
> I'd say we just dump bitmap0 after the writes have been performed, 
> instead of all bitmaps (in line 230f).

Looks like there is never any other bitmap bit bitmap0 and the mirror’s
dirty_bitmap, so this sounds like a good idea.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2020-10-13 14:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22  9:14 [PATCH qemu 0/4] mirror: implement incremental and bitmap modes Fabian Grünbichler
2020-09-22  9:14 ` [PATCH qemu 1/4] drive-mirror: add support for sync=bitmap mode=never Fabian Grünbichler
2020-10-01 14:18   ` Max Reitz
2020-10-02  7:06   ` Markus Armbruster
2020-10-02  8:45     ` Fabian Grünbichler
2020-10-02 12:07       ` Markus Armbruster
2020-09-22  9:14 ` [PATCH qemu 2/4] drive-mirror: add support for conditional and always bitmap sync modes Fabian Grünbichler
2020-10-01 17:01   ` Max Reitz
2020-10-02  8:23     ` Fabian Grünbichler
2020-09-22  9:14 ` [PATCH qemu 3/4] mirror: move some checks to qmp Fabian Grünbichler
2020-10-01 17:16   ` Max Reitz
2020-09-22  9:14 ` [PATCH qemu 4/4] iotests: add test for bitmap mirror Fabian Grünbichler
2020-10-01 17:31   ` Max Reitz
2020-10-02  8:23     ` Fabian Grünbichler
2020-10-13 14:31       ` Max Reitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3e65efe-caac-fffb-f846-a5467f8c9462@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=f.gruenbichler@proxmox.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).