All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] RFC: incremental backups: qmp-block-dirty-bitmap-diff
@ 2016-02-10  0:48 John Snow
  2016-02-14  8:02 ` Fam Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: John Snow @ 2016-02-10  0:48 UTC (permalink / raw)
  To: Qemu-block
  Cc: Fam Zheng, qemu-devel, Vladimir Sementsov-Ogievskiy,
	Stefan Hajnoczi, Denis V. Lunev

The thought was raised that it might be useful to create a "diff"
command for bitmaps that allow us to populate a dirty bitmap based on
the difference between a currently loaded disk image and some
point-in-time stored on disk (an earlier full backup, incremental
backup, etc).

I originally voiced a desire for this command in response to how to
recover from a failed post-copy bitmap migration (Talks ongoing for if
we'll pursue that, but let's not worry about that here.)

Another usage (apart from disaster recovery where we -- for whatever
reason -- lost our bitmap or actually even lost an intermediate
differential backup) for this kind of functionality would be to *start*
a new incremental backup chain in a post-hoc fashion -- after we already
made a full backup, but neglected to create a bitmap atomically.

There are some pros and cons here; I wanted to get a general "Yes, that
sounds good" or a "No way, don't bother" before I sunk some hours into
it, at Stefan's suggestion.


Cons:
- Added maintenance burden of yet-another-blockjob that does a fairly
esoteric operation

- Catering to user carelessness. "You should have thought of that earlier!"

- Reading an entire drive could take quite a long time -- Especially if
both the source and the target are through network storage.

- Reading an entire drive to populate a bitmap with the understanding
that an incremental backup is soon to follow is inefficient if the drive
is more than just a little dirty: it may have been quicker to just
create a new full backup and bitmap.

- Not strictly unlocking new functionality in the normative case. (We do
add 'bitmap rebuilding after a freak accident', but this is not the
normative case.)


Pros:
- Since bitmaps (and persistent bitmaps) are off by default, it's nice
to allow users to enable the feature post-hoc. The chance for a
misconfiguration here seems reasonably good, especially considering the
feature hasn't really hit all of the stable distros yet.

- Increases the flexibility overall of how to begin using the
incremental backups feature.

- Allows us to sync bitmaps against images created by external tools if
needed or desired by external backup appliances.

- If the image isn't that much different from the last good backup,
reading the entire drive and writing out only a few changed blocks is
likely to be faster than creating a new full backup, considering reads
tend to be faster than writes -- reading the whole drive will be faster
than writing a new full backup in many cases.

- The fact that a diff+incremental backup may be slower in some cases
than just simply creating a new full backup isn't a good rationale for
why we can't offer this tool for the cases in which it may outperform.

- Read of the last-known-good backup can be done in the background as a
blockjob without impeding VM operation. Writes that occur during this
process can be tracked in a temporary bitmap and merged after the diff
completes.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] RFC: incremental backups: qmp-block-dirty-bitmap-diff
  2016-02-10  0:48 [Qemu-devel] RFC: incremental backups: qmp-block-dirty-bitmap-diff John Snow
@ 2016-02-14  8:02 ` Fam Zheng
  2016-02-22 22:48   ` John Snow
  0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2016-02-14  8:02 UTC (permalink / raw)
  To: John Snow
  Cc: Qemu-block, qemu-devel, Vladimir Sementsov-Ogievskiy,
	Stefan Hajnoczi, Denis V. Lunev

On Tue, 02/09 19:48, John Snow wrote:
> - Reading an entire drive to populate a bitmap with the understanding
> that an incremental backup is soon to follow is inefficient if the drive
> is more than just a little dirty: it may have been quicker to just
> create a new full backup and bitmap.

Above all I think this is a good idea. Just as an alternative, can we add
another sync mode for drive-backup?

    (QMP) drive-backup device=d0 target=target.qcow2 format=qcow2 sync=diff \
                       base=full-backup.qcow2

(the data of d0 will be compared against full-backup.qcow2 and only different
clusters will be copied to target.qcow2)

Fam

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] RFC: incremental backups: qmp-block-dirty-bitmap-diff
  2016-02-14  8:02 ` Fam Zheng
@ 2016-02-22 22:48   ` John Snow
  0 siblings, 0 replies; 3+ messages in thread
From: John Snow @ 2016-02-22 22:48 UTC (permalink / raw)
  To: Fam Zheng
  Cc: Denis V. Lunev, Vladimir Sementsov-Ogievskiy, Stefan Hajnoczi,
	qemu-devel, Qemu-block



On 02/14/2016 03:02 AM, Fam Zheng wrote:
> On Tue, 02/09 19:48, John Snow wrote:
>> - Reading an entire drive to populate a bitmap with the understanding
>> that an incremental backup is soon to follow is inefficient if the drive
>> is more than just a little dirty: it may have been quicker to just
>> create a new full backup and bitmap.
> 
> Above all I think this is a good idea. Just as an alternative, can we add
> another sync mode for drive-backup?
> 
>     (QMP) drive-backup device=d0 target=target.qcow2 format=qcow2 sync=diff \
>                        base=full-backup.qcow2
> 
> (the data of d0 will be compared against full-backup.qcow2 and only different
> clusters will be copied to target.qcow2)
> 
> Fam
> 

I like this idea too, since it has the chance to do a lot of things for
us all at once. If we allow a user to pass a bitmap that we can
synchronize to this backup, it will be one command that can do a few
things all at once.

Using the "bitmap-diff" approach [re-]establishes a bitmap, but still
requires you to make the next backup. sync=diff just combines the two
logical steps into one.


There are two phases here:
[Perform the diff] [Create a backup from that diff]


backup mode=diff as suggested above performs both,
block-dirty-bitmap-diff as suggested previously performs just the first
action, while we already have commands to perform the second.

I think arguably we'd only /need/ the bitmap-diff command, but I
wouldn't personally mind having both for flexibility reasons (which
historically don't fly too far on the qemu mailing list...)


I think I will move ahead with prototyping the QMP command and see how
far I get. If it's not too bad I'll send some code out for further debate.

--js

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-22 22:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-10  0:48 [Qemu-devel] RFC: incremental backups: qmp-block-dirty-bitmap-diff John Snow
2016-02-14  8:02 ` Fam Zheng
2016-02-22 22:48   ` John Snow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.