Simplify the migration handover protocol

The three-way hand-off has a problem: there's no way to arrange for the
state of the migration to be unambiguous in case of failure.  If the
final "disconnect" message is lost (as in, the destination never
receives it whether it is sent by the sender or not), the destination
has no option but to quit with an error status and let a human sort it
out.  However, at that point we can either arrange to have a .INCOMPLETE
file still on disc or not - and it doesn't matter which we choose, we
can still end up with dataloss by picking a specific calamity to have
befallen the sender.

Given this, it makes sense to fall back to a simpler protocol: just send
all the data, then send a "disconnect" message.  This has the same
downside that we need a human to sort out specific failure cases, but
combined with --unlink before sending "disconnect" (see next patch) it
will always be possible for a human to disambiguate, whether the
destination quit with an error status or not.
This commit is contained in:
Alex Young
2012-07-23 10:22:25 +01:00
parent f6f4266fd6
commit fd935ce4c9
16 changed files with 54 additions and 212 deletions

View File

@@ -72,13 +72,14 @@ class TestHappyPath < Test::Unit::TestCase
@env.listen2
@env.nbd1.can_die
@env.nbd2.can_die(0)
stdout, stderr = @env.mirror12
@env.nbd1.join
@env.nbd2.join
assert_equal(@env.file1.read_original( 0, @env.blocksize ),
@env.file2.read( 0, @env.blocksize ) )
assert @env.status2['has_control'], "destination didn't take control"
end