We now use wsrep_node_incoming_address as a more reliable way to detect cluster node duplicates - 1217466

This commit is contained in:
Frank Cizmich
2014-10-23 15:32:34 -02:00
parent 658700e27a
commit f237f4a0df
10 changed files with 324 additions and 73 deletions

View File

@@ -144,54 +144,89 @@ is(
"Node3 not changed"
);
for my $args (
["using recusion-method=dsn", '--recursion-method', "dsn=$node1_dsn,D=dsns,t=dsns"],
["using recursion-method=cluster", '--recursion-method', 'cluster']
)
{
my $test = shift @$args;
sub test_recursion_methods {
my $same_ids = shift;
$output = output(
sub { pt_table_checksum::main(@args,
@$args)
},
stderr => 1,
);
my ($orig_id_1, $orig_id_2, $orig_id_3);
is(
PerconaTest::count_checksum_results($output, 'errors'),
0,
"1 diff: no errors ($test)"
);
if ($same_ids) {
# save original values
my $sql = 'SELECT @@server_id';
($orig_id_1) = $node1->selectrow_array($sql);
($orig_id_2) = $node2->selectrow_array($sql);
($orig_id_3) = $node3->selectrow_array($sql);
# set server_id value to 1 on all nodes
$sql = 'SET GLOBAL server_id = 1';
$node1->do($sql);
$node2->do($sql);
$node3->do($sql);
}
is(
PerconaTest::count_checksum_results($output, 'skipped'),
0,
"1 diff: no skips ($test)"
);
for my $args (
["using recusion-method=dsn", '--recursion-method', "dsn=$node1_dsn,D=dsns,t=dsns"],
["using recursion-method=cluster", '--recursion-method', 'cluster']
)
{
my $test = shift @$args;
$test = $same_ids ? $test.' - Nodes with different ids' : $test.' - Nodes with same ids';
is(
PerconaTest::count_checksum_results($output, 'diffs'),
1,
"1 diff: 1 diff ($test)"
) or diag($output);
$output = output(
sub { pt_table_checksum::main(@args,
@$args)
},
stderr => 1,
);
is(
PerconaTest::count_checksum_results($output, 'errors'),
0,
"1 diff: no errors ($test)"
);
is(
PerconaTest::count_checksum_results($output, 'skipped'),
0,
"1 diff: no skips ($test)"
);
is(
PerconaTest::count_checksum_results($output, 'diffs'),
1,
"1 diff: 1 diff ($test)"
) or diag($output);
# 11-17T13:02:54 0 1 26 1 0 0.021 test.t
like(
$output,
qr/^\S+\s+ # ts
0\s+ # errors
1\s+ # diffs
26\s+ # rows
\d+\s+ # chunks
0\s+ # skipped
\S+\s+ # time
test.t$ # table
/xm,
"1 diff: it's in test.t ($test)"
);
}
if ($same_ids) {
# reset server_id's to original values
$node1->do("SET GLOBAL server_id = $orig_id_1");
$node2->do("SET GLOBAL server_id = $orig_id_2");
$node3->do("SET GLOBAL server_id = $orig_id_3");
}
# 11-17T13:02:54 0 1 26 1 0 0.021 test.t
like(
$output,
qr/^\S+\s+ # ts
0\s+ # errors
1\s+ # diffs
26\s+ # rows
\d+\s+ # chunks
0\s+ # skipped
\S+\s+ # time
test.t$ # table
/xm,
"1 diff: it's in test.t ($test)"
);
}
# test recursion methods
test_recursion_methods(0);
# test recursion methods when all nodes have the same id
test_recursion_methods(1);
# #############################################################################
# cluster, node1 -> slave, run on node1
# #############################################################################
@@ -232,7 +267,7 @@ for my $args (
# Wait for the slave to apply the binlogs from node1 (its master).
# Then change it so it's not consistent.
PerconaTest::wait_for_table($slave_dbh, 'test.t');
$sb->wait_for_slaves('cslave1');
$sb->wait_for_slaves(master=> 'node1', slave => 'cslave1');
$slave_dbh->do("update test.t set c='zebra' where c='z'");
$output = output(