mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 02:34:19 +00:00
unique-id function for cluster nodes. added pxc5.6 config. modified pxc test
This commit is contained in:
@@ -2393,9 +2393,37 @@ sub name {
|
||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
||||
}
|
||||
|
||||
sub get_id {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
|
||||
my $unique_id;
|
||||
if ($cxn->is_cluster_node()) { # for cluster we concatenate various variables to maximize id 'uniqueness' across versions
|
||||
my $sql = q{SHOW STATUS LIKE 'wsrep\_local\_index'};
|
||||
my (undef, $wsrep_local_index) = $cxn->dbh->selectrow_array($sql);
|
||||
PTDEBUG && _d("Got cluster wsrep_local_index: ",$wsrep_local_index);
|
||||
$unique_id = $wsrep_local_index."|";
|
||||
foreach my $val ('server\_id', 'wsrep\_sst\_receive\_address', 'wsrep\_node\_name', 'wsrep\_node\_address') {
|
||||
my $sql = "SHOW VARIABLES LIKE '$val'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my (undef, $val) = $cxn->dbh->selectrow_array($sql);
|
||||
$unique_id .= "|$val";
|
||||
}
|
||||
} else {
|
||||
my $sql = 'SELECT @@SERVER_ID';
|
||||
PTDEBUG && _d($sql);
|
||||
$unique_id = $cxn->dbh->selectrow_array($sql);
|
||||
}
|
||||
PTDEBUG && _d("Generated unique id for cluster:", $unique_id);
|
||||
return $unique_id;
|
||||
}
|
||||
|
||||
|
||||
sub is_cluster_node {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
||||
@@ -2412,11 +2440,8 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
|
@@ -2737,9 +2737,37 @@ sub name {
|
||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
||||
}
|
||||
|
||||
sub get_id {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
|
||||
my $unique_id;
|
||||
if ($cxn->is_cluster_node()) { # for cluster we concatenate various variables to maximize id 'uniqueness' across versions
|
||||
my $sql = q{SHOW STATUS LIKE 'wsrep\_local\_index'};
|
||||
my (undef, $wsrep_local_index) = $cxn->dbh->selectrow_array($sql);
|
||||
PTDEBUG && _d("Got cluster wsrep_local_index: ",$wsrep_local_index);
|
||||
$unique_id = $wsrep_local_index."|";
|
||||
foreach my $val ('server\_id', 'wsrep\_sst\_receive\_address', 'wsrep\_node\_name', 'wsrep\_node\_address') {
|
||||
my $sql = "SHOW VARIABLES LIKE '$val'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my (undef, $val) = $cxn->dbh->selectrow_array($sql);
|
||||
$unique_id .= "|$val";
|
||||
}
|
||||
} else {
|
||||
my $sql = 'SELECT @@SERVER_ID';
|
||||
PTDEBUG && _d($sql);
|
||||
$unique_id = $cxn->dbh->selectrow_array($sql);
|
||||
}
|
||||
PTDEBUG && _d("Generated unique id for cluster:", $unique_id);
|
||||
return $unique_id;
|
||||
}
|
||||
|
||||
|
||||
sub is_cluster_node {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
||||
@@ -2756,11 +2784,8 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
|
@@ -1889,9 +1889,37 @@ sub name {
|
||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
||||
}
|
||||
|
||||
sub get_id {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
|
||||
my $unique_id;
|
||||
if ($cxn->is_cluster_node()) { # for cluster we concatenate various variables to maximize id 'uniqueness' across versions
|
||||
my $sql = q{SHOW STATUS LIKE 'wsrep\_local\_index'};
|
||||
my (undef, $wsrep_local_index) = $cxn->dbh->selectrow_array($sql);
|
||||
PTDEBUG && _d("Got cluster wsrep_local_index: ",$wsrep_local_index);
|
||||
$unique_id = $wsrep_local_index."|";
|
||||
foreach my $val ('server\_id', 'wsrep\_sst\_receive\_address', 'wsrep\_node\_name', 'wsrep\_node\_address') {
|
||||
my $sql = "SHOW VARIABLES LIKE '$val'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my (undef, $val) = $cxn->dbh->selectrow_array($sql);
|
||||
$unique_id .= "|$val";
|
||||
}
|
||||
} else {
|
||||
my $sql = 'SELECT @@SERVER_ID';
|
||||
PTDEBUG && _d($sql);
|
||||
$unique_id = $cxn->dbh->selectrow_array($sql);
|
||||
}
|
||||
PTDEBUG && _d("Generated unique id for cluster:", $unique_id);
|
||||
return $unique_id;
|
||||
}
|
||||
|
||||
|
||||
sub is_cluster_node {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
||||
@@ -1908,11 +1936,8 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
|
33
bin/pt-kill
33
bin/pt-kill
@@ -5256,9 +5256,37 @@ sub name {
|
||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
||||
}
|
||||
|
||||
sub get_id {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
|
||||
my $unique_id;
|
||||
if ($cxn->is_cluster_node()) { # for cluster we concatenate various variables to maximize id 'uniqueness' across versions
|
||||
my $sql = q{SHOW STATUS LIKE 'wsrep\_local\_index'};
|
||||
my (undef, $wsrep_local_index) = $cxn->dbh->selectrow_array($sql);
|
||||
PTDEBUG && _d("Got cluster wsrep_local_index: ",$wsrep_local_index);
|
||||
$unique_id = $wsrep_local_index."|";
|
||||
foreach my $val ('server\_id', 'wsrep\_sst\_receive\_address', 'wsrep\_node\_name', 'wsrep\_node\_address') {
|
||||
my $sql = "SHOW VARIABLES LIKE '$val'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my (undef, $val) = $cxn->dbh->selectrow_array($sql);
|
||||
$unique_id .= "|$val";
|
||||
}
|
||||
} else {
|
||||
my $sql = 'SELECT @@SERVER_ID';
|
||||
PTDEBUG && _d($sql);
|
||||
$unique_id = $cxn->dbh->selectrow_array($sql);
|
||||
}
|
||||
PTDEBUG && _d("Generated unique id for cluster:", $unique_id);
|
||||
return $unique_id;
|
||||
}
|
||||
|
||||
|
||||
sub is_cluster_node {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
||||
@@ -5275,11 +5303,8 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
|
@@ -3853,9 +3853,37 @@ sub name {
|
||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
||||
}
|
||||
|
||||
sub get_id {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
|
||||
my $unique_id;
|
||||
if ($cxn->is_cluster_node()) { # for cluster we concatenate various variables to maximize id 'uniqueness' across versions
|
||||
my $sql = q{SHOW STATUS LIKE 'wsrep\_local\_index'};
|
||||
my (undef, $wsrep_local_index) = $cxn->dbh->selectrow_array($sql);
|
||||
PTDEBUG && _d("Got cluster wsrep_local_index: ",$wsrep_local_index);
|
||||
$unique_id = $wsrep_local_index."|";
|
||||
foreach my $val ('server\_id', 'wsrep\_sst\_receive\_address', 'wsrep\_node\_name', 'wsrep\_node\_address') {
|
||||
my $sql = "SHOW VARIABLES LIKE '$val'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my (undef, $val) = $cxn->dbh->selectrow_array($sql);
|
||||
$unique_id .= "|$val";
|
||||
}
|
||||
} else {
|
||||
my $sql = 'SELECT @@SERVER_ID';
|
||||
PTDEBUG && _d($sql);
|
||||
$unique_id = $cxn->dbh->selectrow_array($sql);
|
||||
}
|
||||
PTDEBUG && _d("Generated unique id for cluster:", $unique_id);
|
||||
return $unique_id;
|
||||
}
|
||||
|
||||
|
||||
sub is_cluster_node {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
||||
@@ -3872,11 +3900,8 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
@@ -7662,10 +7687,7 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
|
@@ -3631,9 +3631,37 @@ sub name {
|
||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
||||
}
|
||||
|
||||
sub get_id {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
|
||||
my $unique_id;
|
||||
if ($cxn->is_cluster_node()) { # for cluster we concatenate various variables to maximize id 'uniqueness' across versions
|
||||
my $sql = q{SHOW STATUS LIKE 'wsrep\_local\_index'};
|
||||
my (undef, $wsrep_local_index) = $cxn->dbh->selectrow_array($sql);
|
||||
PTDEBUG && _d("Got cluster wsrep_local_index: ",$wsrep_local_index);
|
||||
$unique_id = $wsrep_local_index."|";
|
||||
foreach my $val ('server\_id', 'wsrep\_sst\_receive\_address', 'wsrep\_node\_name', 'wsrep\_node\_address') {
|
||||
my $sql = "SHOW VARIABLES LIKE '$val'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my (undef, $val) = $cxn->dbh->selectrow_array($sql);
|
||||
$unique_id .= "|$val";
|
||||
}
|
||||
} else {
|
||||
my $sql = 'SELECT @@SERVER_ID';
|
||||
PTDEBUG && _d($sql);
|
||||
$unique_id = $cxn->dbh->selectrow_array($sql);
|
||||
}
|
||||
PTDEBUG && _d("Generated unique id for cluster:", $unique_id);
|
||||
return $unique_id;
|
||||
}
|
||||
|
||||
|
||||
sub is_cluster_node {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
||||
@@ -3650,11 +3678,8 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
@@ -3812,10 +3837,7 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
@@ -9323,10 +9345,8 @@ sub main {
|
||||
my %seen_ids;
|
||||
for my $cxn ($master_cxn, @$slaves) {
|
||||
my $dbh = $cxn->dbh();
|
||||
# if it's a cluster node we use its incoming address as id ( see https://bugs.launchpad.net/percona-toolkit/+bug/1217466 )
|
||||
my $sql = $cluster->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($cxn, $dbh, $sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
# get server/node unique id ( https://bugs.launchpad.net/percona-toolkit/+bug/1217466 )
|
||||
my $id = $cxn->get_id();
|
||||
$seen_ids{$id}++;
|
||||
}
|
||||
|
||||
|
@@ -2562,9 +2562,37 @@ sub name {
|
||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
||||
}
|
||||
|
||||
sub get_id {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
|
||||
my $unique_id;
|
||||
if ($cxn->is_cluster_node()) { # for cluster we concatenate various variables to maximize id 'uniqueness' across versions
|
||||
my $sql = q{SHOW STATUS LIKE 'wsrep\_local\_index'};
|
||||
my (undef, $wsrep_local_index) = $cxn->dbh->selectrow_array($sql);
|
||||
PTDEBUG && _d("Got cluster wsrep_local_index: ",$wsrep_local_index);
|
||||
$unique_id = $wsrep_local_index."|";
|
||||
foreach my $val ('server\_id', 'wsrep\_sst\_receive\_address', 'wsrep\_node\_name', 'wsrep\_node\_address') {
|
||||
my $sql = "SHOW VARIABLES LIKE '$val'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my (undef, $val) = $cxn->dbh->selectrow_array($sql);
|
||||
$unique_id .= "|$val";
|
||||
}
|
||||
} else {
|
||||
my $sql = 'SELECT @@SERVER_ID';
|
||||
PTDEBUG && _d($sql);
|
||||
$unique_id = $cxn->dbh->selectrow_array($sql);
|
||||
}
|
||||
PTDEBUG && _d("Generated unique id for cluster:", $unique_id);
|
||||
return $unique_id;
|
||||
}
|
||||
|
||||
|
||||
sub is_cluster_node {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
||||
@@ -2581,11 +2609,8 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
|
39
lib/Cxn.pm
39
lib/Cxn.pm
@@ -226,11 +226,42 @@ sub name {
|
||||
return $self->{hostname} || $self->{dsn_name} || 'unknown host';
|
||||
}
|
||||
|
||||
# This returns the server_id.
|
||||
# For cluster nodes, since server_id is unreliable, we use a combination of
|
||||
# variables to create an id string that is unique.
|
||||
sub get_id {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
|
||||
my $unique_id;
|
||||
if ($cxn->is_cluster_node()) { # for cluster we concatenate various variables to maximize id 'uniqueness' across versions
|
||||
my $sql = q{SHOW STATUS LIKE 'wsrep\_local\_index'};
|
||||
my (undef, $wsrep_local_index) = $cxn->dbh->selectrow_array($sql);
|
||||
PTDEBUG && _d("Got cluster wsrep_local_index: ",$wsrep_local_index);
|
||||
$unique_id = $wsrep_local_index."|";
|
||||
foreach my $val ('server\_id', 'wsrep\_sst\_receive\_address', 'wsrep\_node\_name', 'wsrep\_node\_address') {
|
||||
my $sql = "SHOW VARIABLES LIKE '$val'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my (undef, $val) = $cxn->dbh->selectrow_array($sql);
|
||||
$unique_id .= "|$val";
|
||||
}
|
||||
} else {
|
||||
my $sql = 'SELECT @@SERVER_ID';
|
||||
PTDEBUG && _d($sql);
|
||||
$unique_id = $cxn->dbh->selectrow_array($sql);
|
||||
}
|
||||
PTDEBUG && _d("Generated unique id for cluster:", $unique_id);
|
||||
return $unique_id;
|
||||
}
|
||||
|
||||
|
||||
# This is used to help remove_duplicate_cxns detect cluster nodes
|
||||
# (which often have unreliable server_id's)
|
||||
sub is_cluster_node {
|
||||
my ($self, $cxn) = @_;
|
||||
|
||||
$cxn ||= $self;
|
||||
my $sql = "SHOW VARIABLES LIKE 'wsrep\_on'";
|
||||
PTDEBUG && _d($cxn->name, $sql);
|
||||
my $row = $cxn->dbh->selectrow_arrayref($sql);
|
||||
@@ -257,14 +288,8 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
|
||||
# Very often cluster nodes are configured with matching server_id's
|
||||
# So in that case we'll use its incoming address as its unique identifier
|
||||
# Note: this relies on "seen_ids" being populated using the same strategy
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
|
@@ -137,13 +137,7 @@ sub remove_duplicate_cxns {
|
||||
my @trimmed_cxns;
|
||||
|
||||
for my $cxn ( @cxns ) {
|
||||
my $dbh = $cxn->dbh();
|
||||
# Very often cluster nodes are configured with matching server_id's
|
||||
# So in that case we'll use its incoming address as its unique identifier
|
||||
# Note: This relies on "seen_ids" being populated using the same strategy
|
||||
my $sql = $self->is_cluster_node($cxn) ? q{SELECT @@wsrep_node_incoming_address} : q{SELECT @@server_id};
|
||||
PTDEBUG && _d($sql);
|
||||
my ($id) = $dbh->selectrow_array($sql);
|
||||
my $id = $cxn->get_id();
|
||||
PTDEBUG && _d('Server ID for ', $cxn->name, ': ', $id);
|
||||
|
||||
if ( ! $seen_ids->{$id}++ ) {
|
||||
|
42
sandbox/servers/pxc/5.6/my.sandbox.cnf
Normal file
42
sandbox/servers/pxc/5.6/my.sandbox.cnf
Normal file
@@ -0,0 +1,42 @@
|
||||
[client]
|
||||
user = msandbox
|
||||
password = msandbox
|
||||
port = PORT
|
||||
socket = /tmp/PORT/mysql_sandboxPORT.sock
|
||||
|
||||
[mysqld]
|
||||
port = PORT
|
||||
socket = /tmp/PORT/mysql_sandboxPORT.sock
|
||||
pid-file = /tmp/PORT/data/mysql_sandboxPORT.pid
|
||||
basedir = PERCONA_TOOLKIT_SANDBOX
|
||||
datadir = /tmp/PORT/data
|
||||
key_buffer_size = 16M
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_data_home_dir = /tmp/PORT/data
|
||||
innodb_log_group_home_dir = /tmp/PORT/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_file_size = 5M
|
||||
log-bin = mysql-bin
|
||||
relay_log = mysql-relay-bin
|
||||
log_slave_updates
|
||||
server-id = PORT
|
||||
report-host = 127.0.0.1
|
||||
report-port = PORT
|
||||
log-error = /tmp/PORT/data/mysqld.log
|
||||
innodb_lock_wait_timeout = 3
|
||||
general_log
|
||||
general_log_file = genlog
|
||||
|
||||
binlog_format = ROW
|
||||
wsrep_provider = LIBGALERA
|
||||
wsrep_cluster_address = CLUSTER_AD
|
||||
wsrep_sst_receive_address = ADDR:RECEIVE_PRT
|
||||
wsrep_node_incoming_address= ADDR:PORT
|
||||
wsrep_slave_threads = 2
|
||||
wsrep_cluster_name = CLUSTER_NAME
|
||||
wsrep_provider_options = "gmcast.listen_addr=tcp://ADDR:LISTEN_PRT;"
|
||||
wsrep_sst_method = rsync
|
||||
wsrep_node_name = PORT
|
||||
innodb_locks_unsafe_for_binlog = 1
|
||||
innodb_autoinc_lock_mode = 2
|
||||
wsrep-replicate-myisam
|
@@ -88,8 +88,8 @@ like(
|
||||
);
|
||||
|
||||
ok (
|
||||
$output =~ qr/WARNING/i && !$exit_status,
|
||||
"Warns but doesn't die if --recursion-method=none - issue #1373937"
|
||||
$output !~ qr/no other nodes or regular replicas were found/i && !$exit_status,
|
||||
"checksums even if --recursion-method=none - issue 1373937"
|
||||
);
|
||||
|
||||
for my $args (
|
||||
@@ -159,6 +159,7 @@ sub test_recursion_methods {
|
||||
my $same_ids = shift;
|
||||
|
||||
my ($orig_id_1, $orig_id_2, $orig_id_3);
|
||||
my ($orig_ia_1, $orig_ia_2, $orig_ia_3);
|
||||
|
||||
if ($same_ids) {
|
||||
# save original values
|
||||
@@ -171,6 +172,19 @@ sub test_recursion_methods {
|
||||
$node1->do($sql);
|
||||
$node2->do($sql);
|
||||
$node3->do($sql);
|
||||
|
||||
# since we're testing server id issues, set wsrep_node_incoming_address=AUTO ( https://bugs.launchpad.net/percona-toolkit/+bug/1399789 )
|
||||
# save original values
|
||||
$sql = 'SELECT @@wsrep_node_incoming_address';
|
||||
($orig_ia_1) = $node1->selectrow_array($sql);
|
||||
($orig_ia_2) = $node2->selectrow_array($sql);
|
||||
($orig_ia_3) = $node3->selectrow_array($sql);
|
||||
# set wsrep_node_incoming_address value to AUTO on all nodes
|
||||
$sql = 'SET GLOBAL wsrep_node_incoming_address = AUTO';
|
||||
$node1->do($sql);
|
||||
$node2->do($sql);
|
||||
$node3->do($sql);
|
||||
|
||||
}
|
||||
|
||||
for my $args (
|
||||
@@ -227,6 +241,10 @@ sub test_recursion_methods {
|
||||
$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");
|
||||
# reset node wsrep_node_incoming_address to original values
|
||||
$node1->do("SET GLOBAL wsrep_node_incoming_address = $orig_ia_1");
|
||||
$node2->do("SET GLOBAL wsrep_node_incoming_address = $orig_ia_2");
|
||||
$node3->do("SET GLOBAL wsrep_node_incoming_address = $orig_ia_3");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user