Compare commits

...

38 Commits

Author SHA1 Message Date
Sveta Smirnova
d9b0219d9e Changed replica_parallel_workers in configuration for 8.0 and 8.4 to o, because wiat_for_replicas is buggy for multi-threaded slaves 2024-12-14 20:19:03 +03:00
Sveta Smirnova
1d3a44c5da RESET test for t/pt-table-checksum/pt-1616.t 2024-12-14 14:04:19 +03:00
Sveta Smirnova
a6a3199a3c Setting SQL Delay back to 0 explicitly 2024-12-13 17:28:39 +03:00
Sveta Smirnova
fadf758cb4 Removed extra ->wait_for_replicas();
from t/pt-table-checksum/pt-1616.t
2024-12-12 20:49:07 +03:00
Sveta Smirnova
25ba843cdd better cleaning in t/pt-table-sync/safety_checks.t 2024-12-12 13:41:22 +03:00
Sveta Smirnova
4906b6a348 Test in t/pt-table-checksum/chunk_size.t 2024-12-10 16:47:40 +03:00
Sveta Smirnova
18dba10c60 Test in t/pt-table-checksum/chunk_size.t 2024-12-10 15:59:19 +03:00
Sveta Smirnova
5039621d29 Diagnostic added to t/pt-table-checksum/chunk_size.t, t/pt-table-checksum/resume.t 2024-12-10 15:30:33 +03:00
Sveta Smirnova
c30baedf41 Merge branch 'release-v3.7.0' into release-v3.7.0-test 2024-12-10 15:25:56 +03:00
Sveta Smirnova
06359e5d1a Merge branch '3.x' into release-v3.7.0 2024-12-06 19:48:33 +03:00
Sveta Smirnova
44a2819055 PT-2340 - Support MySQL 8.4
- Added wait_for_replicas call into t/pt-table-checksum/pt-1616.t
- Added diagnostic output into t/pt-upgrade/run_time.t, t/pt-table-sync/issue_627.t
2024-12-03 16:25:58 +03:00
Sveta Smirnova
3ef8ca77ff Merge branch '3.x' into release-v3.7.0 2024-12-03 16:20:16 +03:00
Sveta Smirnova
19b0927001 Added wait_for_replicas call into t/pt-table-checksum/pt-1616.t 2024-12-03 16:00:53 +03:00
Sveta Smirnova
9ccecb2d50 Added wait_for_replicas call into t/pt-table-sync/char_chunking.t 2024-12-02 17:43:47 +03:00
Sveta Smirnova
2de6e9ba9e Better diagnostic output in t/pt-upgrade/run_time.t 2024-12-02 17:40:37 +03:00
Sveta Smirnova
f8e3ece9ee Added diagnostic code into t/pt-table-sync/issue_627.t 2024-12-02 17:38:37 +03:00
Sveta Smirnova
5f79b34dfc Added wait_for_replicas call into t/pt-table-sync/issue_218.t 2024-12-02 17:37:16 +03:00
Sveta Smirnova
e038b275ef PT-2340 - Support MySQL 8.4
- Added Lmo submodules into pt-visual-explain
2024-12-02 17:32:32 +03:00
Sveta Smirnova
2eccd39129 Removed some waitpid test 2024-12-02 17:31:05 +03:00
Sveta Smirnova
ef04237618 Test waitpid in t/pt-table-sync/pt-1194.t 2024-11-29 07:08:48 +03:00
Sveta Smirnova
df2cc0c9ca Test waitpid in t/pt-table-sync/pt-1194.t 2024-11-29 01:51:12 +03:00
Sveta Smirnova
6aacdda0e6 Lmo submodules in pt-visual-explain 2024-11-29 01:28:42 +03:00
Sveta Smirnova
b2dd791512 Lmo in pt-visual-explain, fixed syntax error 2024-11-29 01:05:56 +03:00
Sveta Smirnova
e7580f2519 Lmo in pt-visual-explain 2024-11-28 23:08:00 +03:00
Sveta Smirnova
22208f01a2 Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 13 2024-11-27 23:40:37 +03:00
Sveta Smirnova
f85d8b0194 Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 12 2024-11-27 23:22:09 +03:00
Sveta Smirnova
8b67b26f7e Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 11 2024-11-27 23:06:55 +03:00
Sveta Smirnova
0e4df890c4 Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 10 2024-11-27 22:47:48 +03:00
Sveta Smirnova
0fd43b871d Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 9 2024-11-27 22:23:26 +03:00
Sveta Smirnova
8c731e52c0 Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 8 2024-11-27 21:59:24 +03:00
Sveta Smirnova
95e95f95d6 Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 7 2024-11-27 21:50:40 +03:00
Sveta Smirnova
e84d985e3f Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 7 2024-11-27 21:39:33 +03:00
Sveta Smirnova
0869d14d19 Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 6 2024-11-27 16:53:15 +03:00
Sveta Smirnova
8231dae4c0 Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 5 2024-11-27 16:43:01 +03:00
Sveta Smirnova
aad0a26789 Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 4 2024-11-27 16:31:21 +03:00
Sveta Smirnova
8d03f3c8b8 Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 3 2024-11-27 16:18:59 +03:00
Sveta Smirnova
eafbaca786 Release 3.7.0: testing ncat issue on Percona Jenkins machines, try 2 2024-11-27 16:12:03 +03:00
Sveta Smirnova
5da16d53f4 Release 3.7.0: testing ncat issue on Percona Jenkins machines 2024-11-27 16:02:18 +03:00
18 changed files with 715 additions and 13 deletions

View File

@@ -18,6 +18,11 @@ BEGIN {
OptionParser
DSNParser
Daemon
Lmo::Utils
Lmo::Meta
Lmo::Object
Lmo::Types
Lmo
VersionParser
));
}
@@ -2527,6 +2532,655 @@ sub _d {
# End Daemon package
# ###########################################################################
# ###########################################################################
# Lmo::Utils package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the GitHub repository at,
# lib/Lmo/Utils.pm
# t/lib/Lmo/Utils.t
# See https://github.com/percona/percona-toolkit for more information.
# ###########################################################################
{
package Lmo::Utils;
use strict;
use warnings qw( FATAL all );
require Exporter;
our (@ISA, @EXPORT, @EXPORT_OK);
BEGIN {
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(
_install_coderef
_unimport_coderefs
_glob_for
_stash_for
);
}
{
no strict 'refs';
sub _glob_for {
return \*{shift()}
}
sub _stash_for {
return \%{ shift() . "::" };
}
}
sub _install_coderef {
my ($to, $code) = @_;
return *{ _glob_for $to } = $code;
}
sub _unimport_coderefs {
my ($target, @names) = @_;
return unless @names;
my $stash = _stash_for($target);
foreach my $name (@names) {
if ($stash->{$name} and defined(&{$stash->{$name}})) {
delete $stash->{$name};
}
}
}
1;
}
# ###########################################################################
# End Lmo::Utils package
# ###########################################################################
# ###########################################################################
# Lmo::Meta package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the GitHub repository at,
# lib/Lmo/Meta.pm
# t/lib/Lmo/Meta.t
# See https://github.com/percona/percona-toolkit for more information.
# ###########################################################################
{
package Lmo::Meta;
use strict;
use warnings qw( FATAL all );
my %metadata_for;
sub new {
my $class = shift;
return bless { @_ }, $class
}
sub metadata_for {
my $self = shift;
my ($class) = @_;
return $metadata_for{$class} ||= {};
}
sub class { shift->{class} }
sub attributes {
my $self = shift;
return keys %{$self->metadata_for($self->class)}
}
sub attributes_for_new {
my $self = shift;
my @attributes;
my $class_metadata = $self->metadata_for($self->class);
while ( my ($attr, $meta) = each %$class_metadata ) {
if ( exists $meta->{init_arg} ) {
push @attributes, $meta->{init_arg}
if defined $meta->{init_arg};
}
else {
push @attributes, $attr;
}
}
return @attributes;
}
1;
}
# ###########################################################################
# End Lmo::Meta package
# ###########################################################################
# ###########################################################################
# Lmo::Object package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the GitHub repository at,
# lib/Lmo/Object.pm
# t/lib/Lmo/Object.t
# See https://github.com/percona/percona-toolkit for more information.
# ###########################################################################
{
package Lmo::Object;
use strict;
use warnings qw( FATAL all );
use Carp ();
use Scalar::Util qw(blessed);
use Lmo::Meta;
use Lmo::Utils qw(_glob_for);
sub new {
my $class = shift;
my $args = $class->BUILDARGS(@_);
my $class_metadata = Lmo::Meta->metadata_for($class);
my @args_to_delete;
while ( my ($attr, $meta) = each %$class_metadata ) {
next unless exists $meta->{init_arg};
my $init_arg = $meta->{init_arg};
if ( defined $init_arg ) {
$args->{$attr} = delete $args->{$init_arg};
}
else {
push @args_to_delete, $attr;
}
}
delete $args->{$_} for @args_to_delete;
for my $attribute ( keys %$args ) {
if ( my $coerce = $class_metadata->{$attribute}{coerce} ) {
$args->{$attribute} = $coerce->($args->{$attribute});
}
if ( my $isa_check = $class_metadata->{$attribute}{isa} ) {
my ($check_name, $check_sub) = @$isa_check;
$check_sub->($args->{$attribute});
}
}
while ( my ($attribute, $meta) = each %$class_metadata ) {
next unless $meta->{required};
Carp::confess("Attribute ($attribute) is required for $class")
if ! exists $args->{$attribute}
}
my $self = bless $args, $class;
my @build_subs;
my $linearized_isa = mro::get_linear_isa($class);
for my $isa_class ( @$linearized_isa ) {
unshift @build_subs, *{ _glob_for "${isa_class}::BUILD" }{CODE};
}
my @args = %$args;
for my $sub (grep { defined($_) && exists &$_ } @build_subs) {
$sub->( $self, @args);
}
return $self;
}
sub BUILDARGS {
shift; # No need for the classname
if ( @_ == 1 && ref($_[0]) ) {
Carp::confess("Single parameters to new() must be a HASH ref, not $_[0]")
unless ref($_[0]) eq ref({});
return {%{$_[0]}} # We want a new reference, always
}
else {
return { @_ };
}
}
sub meta {
my $class = shift;
$class = Scalar::Util::blessed($class) || $class;
return Lmo::Meta->new(class => $class);
}
1;
}
# ###########################################################################
# End Lmo::Object package
# ###########################################################################
# ###########################################################################
# Lmo::Types package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the GitHub repository at,
# lib/Lmo/Types.pm
# t/lib/Lmo/Types.t
# See https://github.com/percona/percona-toolkit for more information.
# ###########################################################################
{
package Lmo::Types;
use strict;
use warnings qw( FATAL all );
use Carp ();
use Scalar::Util qw(looks_like_number blessed);
our %TYPES = (
Bool => sub { !$_[0] || (defined $_[0] && looks_like_number($_[0]) && $_[0] == 1) },
Num => sub { defined $_[0] && looks_like_number($_[0]) },
Int => sub { defined $_[0] && looks_like_number($_[0]) && $_[0] == int($_[0]) },
Str => sub { defined $_[0] },
Object => sub { defined $_[0] && blessed($_[0]) },
FileHandle => sub { local $@; require IO::Handle; fileno($_[0]) && $_[0]->opened },
map {
my $type = /R/ ? $_ : uc $_;
$_ . "Ref" => sub { ref $_[0] eq $type }
} qw(Array Code Hash Regexp Glob Scalar)
);
sub check_type_constraints {
my ($attribute, $type_check, $check_name, $val) = @_;
( ref($type_check) eq 'CODE'
? $type_check->($val)
: (ref $val eq $type_check
|| ($val && $val eq $type_check)
|| (exists $TYPES{$type_check} && $TYPES{$type_check}->($val)))
)
|| Carp::confess(
qq<Attribute ($attribute) does not pass the type constraint because: >
. qq<Validation failed for '$check_name' with value >
. (defined $val ? Lmo::Dumper($val) : 'undef') )
}
sub _nested_constraints {
my ($attribute, $aggregate_type, $type) = @_;
my $inner_types;
if ( $type =~ /\A(ArrayRef|Maybe)\[(.*)\]\z/ ) {
$inner_types = _nested_constraints($1, $2);
}
else {
$inner_types = $TYPES{$type};
}
if ( $aggregate_type eq 'ArrayRef' ) {
return sub {
my ($val) = @_;
return unless ref($val) eq ref([]);
if ($inner_types) {
for my $value ( @{$val} ) {
return unless $inner_types->($value)
}
}
else {
for my $value ( @{$val} ) {
return unless $value && ($value eq $type
|| (Scalar::Util::blessed($value) && $value->isa($type)));
}
}
return 1;
};
}
elsif ( $aggregate_type eq 'Maybe' ) {
return sub {
my ($value) = @_;
return 1 if ! defined($value);
if ($inner_types) {
return unless $inner_types->($value)
}
else {
return unless $value eq $type
|| (Scalar::Util::blessed($value) && $value->isa($type));
}
return 1;
}
}
else {
Carp::confess("Nested aggregate types are only implemented for ArrayRefs and Maybe");
}
}
1;
}
# ###########################################################################
# End Lmo::Types package
# ###########################################################################
# ###########################################################################
# Lmo package
# This package is a copy without comments from the original. The original
# with comments and its test file can be found in the GitHub repository at,
# lib/Lmo.pm
# t/lib/Lmo.t
# See https://github.com/percona/percona-toolkit for more information.
# ###########################################################################
{
BEGIN {
$INC{"Lmo.pm"} = __FILE__;
package Lmo;
our $VERSION = '0.30_Percona'; # Forked from 0.30 of Mo.
use strict;
use warnings qw( FATAL all );
use Carp ();
use Scalar::Util qw(looks_like_number blessed);
use Lmo::Meta;
use Lmo::Object;
use Lmo::Types;
use Lmo::Utils;
my %export_for;
sub import {
warnings->import(qw(FATAL all));
strict->import();
my $caller = scalar caller(); # Caller's package
my %exports = (
extends => \&extends,
has => \&has,
with => \&with,
override => \&override,
confess => \&Carp::confess,
);
$export_for{$caller} = \%exports;
for my $keyword ( keys %exports ) {
_install_coderef "${caller}::$keyword" => $exports{$keyword};
}
if ( !@{ *{ _glob_for "${caller}::ISA" }{ARRAY} || [] } ) {
@_ = "Lmo::Object";
goto *{ _glob_for "${caller}::extends" }{CODE};
}
}
sub extends {
my $caller = scalar caller();
for my $class ( @_ ) {
_load_module($class);
}
_set_package_isa($caller, @_);
_set_inherited_metadata($caller);
}
sub _load_module {
my ($class) = @_;
(my $file = $class) =~ s{::|'}{/}g;
$file .= '.pm';
{ local $@; eval { require "$file" } } # or warn $@;
return;
}
sub with {
my $package = scalar caller();
require Role::Tiny;
for my $role ( @_ ) {
_load_module($role);
_role_attribute_metadata($package, $role);
}
Role::Tiny->apply_roles_to_package($package, @_);
}
sub _role_attribute_metadata {
my ($package, $role) = @_;
my $package_meta = Lmo::Meta->metadata_for($package);
my $role_meta = Lmo::Meta->metadata_for($role);
%$package_meta = (%$role_meta, %$package_meta);
}
sub has {
my $names = shift;
my $caller = scalar caller();
my $class_metadata = Lmo::Meta->metadata_for($caller);
for my $attribute ( ref $names ? @$names : $names ) {
my %args = @_;
my $method = ($args{is} || '') eq 'ro'
? sub {
Carp::confess("Cannot assign a value to a read-only accessor at reader ${caller}::${attribute}")
if $#_;
return $_[0]{$attribute};
}
: sub {
return $#_
? $_[0]{$attribute} = $_[1]
: $_[0]{$attribute};
};
$class_metadata->{$attribute} = ();
if ( my $type_check = $args{isa} ) {
my $check_name = $type_check;
if ( my ($aggregate_type, $inner_type) = $type_check =~ /\A(ArrayRef|Maybe)\[(.*)\]\z/ ) {
$type_check = Lmo::Types::_nested_constraints($attribute, $aggregate_type, $inner_type);
}
my $check_sub = sub {
my ($new_val) = @_;
Lmo::Types::check_type_constraints($attribute, $type_check, $check_name, $new_val);
};
$class_metadata->{$attribute}{isa} = [$check_name, $check_sub];
my $orig_method = $method;
$method = sub {
$check_sub->($_[1]) if $#_;
goto &$orig_method;
};
}
if ( my $builder = $args{builder} ) {
my $original_method = $method;
$method = sub {
$#_
? goto &$original_method
: ! exists $_[0]{$attribute}
? $_[0]{$attribute} = $_[0]->$builder
: goto &$original_method
};
}
if ( my $code = $args{default} ) {
Carp::confess("${caller}::${attribute}'s default is $code, but should be a coderef")
unless ref($code) eq 'CODE';
my $original_method = $method;
$method = sub {
$#_
? goto &$original_method
: ! exists $_[0]{$attribute}
? $_[0]{$attribute} = $_[0]->$code
: goto &$original_method
};
}
if ( my $role = $args{does} ) {
my $original_method = $method;
$method = sub {
if ( $#_ ) {
Carp::confess(qq<Attribute ($attribute) doesn't consume a '$role' role">)
unless Scalar::Util::blessed($_[1]) && eval { $_[1]->does($role) }
}
goto &$original_method
};
}
if ( my $coercion = $args{coerce} ) {
$class_metadata->{$attribute}{coerce} = $coercion;
my $original_method = $method;
$method = sub {
if ( $#_ ) {
return $original_method->($_[0], $coercion->($_[1]))
}
goto &$original_method;
}
}
_install_coderef "${caller}::$attribute" => $method;
if ( $args{required} ) {
$class_metadata->{$attribute}{required} = 1;
}
if ($args{clearer}) {
_install_coderef "${caller}::$args{clearer}"
=> sub { delete shift->{$attribute} }
}
if ($args{predicate}) {
_install_coderef "${caller}::$args{predicate}"
=> sub { exists shift->{$attribute} }
}
if ($args{handles}) {
_has_handles($caller, $attribute, \%args);
}
if (exists $args{init_arg}) {
$class_metadata->{$attribute}{init_arg} = $args{init_arg};
}
}
}
sub _has_handles {
my ($caller, $attribute, $args) = @_;
my $handles = $args->{handles};
my $ref = ref $handles;
my $kv;
if ( $ref eq ref [] ) {
$kv = { map { $_,$_ } @{$handles} };
}
elsif ( $ref eq ref {} ) {
$kv = $handles;
}
elsif ( $ref eq ref qr// ) {
Carp::confess("Cannot delegate methods based on a Regexp without a type constraint (isa)")
unless $args->{isa};
my $target_class = $args->{isa};
$kv = {
map { $_, $_ }
grep { $_ =~ $handles }
grep { !exists $Lmo::Object::{$_} && $target_class->can($_) }
grep { !$export_for{$target_class}->{$_} }
keys %{ _stash_for $target_class }
};
}
else {
Carp::confess("handles for $ref not yet implemented");
}
while ( my ($method, $target) = each %{$kv} ) {
my $name = _glob_for "${caller}::$method";
Carp::confess("You cannot overwrite a locally defined method ($method) with a delegation")
if defined &$name;
my ($target, @curried_args) = ref($target) ? @$target : $target;
*$name = sub {
my $self = shift;
my $delegate_to = $self->$attribute();
my $error = "Cannot delegate $method to $target because the value of $attribute";
Carp::confess("$error is not defined") unless $delegate_to;
Carp::confess("$error is not an object (got '$delegate_to')")
unless Scalar::Util::blessed($delegate_to) || (!ref($delegate_to) && $delegate_to->can($target));
return $delegate_to->$target(@curried_args, @_);
}
}
}
sub _set_package_isa {
my ($package, @new_isa) = @_;
my $package_isa = \*{ _glob_for "${package}::ISA" };
@{*$package_isa} = @new_isa;
}
sub _set_inherited_metadata {
my $class = shift;
my $class_metadata = Lmo::Meta->metadata_for($class);
my $linearized_isa = mro::get_linear_isa($class);
my %new_metadata;
for my $isa_class (reverse @$linearized_isa) {
my $isa_metadata = Lmo::Meta->metadata_for($isa_class);
%new_metadata = (
%new_metadata,
%$isa_metadata,
);
}
%$class_metadata = %new_metadata;
}
sub unimport {
my $caller = scalar caller();
my $target = caller;
_unimport_coderefs($target, keys %{$export_for{$caller}});
}
sub Dumper {
require Data::Dumper;
local $Data::Dumper::Indent = 0;
local $Data::Dumper::Sortkeys = 0;
local $Data::Dumper::Quotekeys = 0;
local $Data::Dumper::Terse = 1;
Data::Dumper::Dumper(@_)
}
BEGIN {
if ($] >= 5.010) {
{ local $@; require mro; }
}
else {
local $@;
eval {
require MRO::Compat;
} or do {
*mro::get_linear_isa = *mro::get_linear_isa_dfs = sub {
no strict 'refs';
my $classname = shift;
my @lin = ($classname);
my %stored;
foreach my $parent (@{"$classname\::ISA"}) {
my $plin = mro::get_linear_isa_dfs($parent);
foreach (@$plin) {
next if exists $stored{$_};
push(@lin, $_);
$stored{$_} = 1;
}
}
return \@lin;
};
}
}
}
sub override {
my ($methods, $code) = @_;
my $caller = scalar caller;
for my $method ( ref($methods) ? @$methods : $methods ) {
my $full_method = "${caller}::${method}";
*{_glob_for $full_method} = $code;
}
}
}
1;
}
# ###########################################################################
# End Lmo package
# ###########################################################################
# ###########################################################################
# VersionParser package
# This package is a copy without comments from the original. The original

View File

@@ -465,6 +465,7 @@ sub is_cluster_node {
sub can_load_data {
my ($self, $server) = @_;
my $output = $self->use($server, q{-e "SELECT * FROM percona_test.load_data"});
#die(0 =~ /1/);
return ($output || '') =~ /1/;
}

View File

@@ -40,3 +40,6 @@ binlog_format = STATEMENT
#performance-schema-instrument='wait/lock/metadata/sql/mdl=ON'
#performance-schema-instrument='transaction=ON'
secure-file-priv =
# wait_for_replica buggy on multi-threaded replica
slave-parallel-workers=0

View File

@@ -40,3 +40,6 @@ binlog_format = STATEMENT
#performance-schema-instrument='wait/lock/metadata/sql/mdl=ON'
#performance-schema-instrument='transaction=ON'
secure-file-priv =
# wait_for_replica buggy on multi-threaded replica
replica-parallel-workers=0

View File

@@ -251,6 +251,7 @@ like(
# Done.
# #############################################################################
$replica1_dbh->do("STOP ${replica_name}");
$replica1_dbh->do("CHANGE ${source_change} TO ${source_name}_DELAY=0");
$source_dbh->do("RESET ${source_reset}");
$replica1_dbh->do("RESET ${replica_name}");
$replica1_dbh->do("START ${replica_name}");

View File

@@ -398,6 +398,7 @@ $replica_dbh2 = $sb->get_dbh_for('replica2');
diag("Setting replica delay to 0 seconds");
$replica_dbh1->do("STOP ${replica_name}");
$replica_dbh2->do("STOP ${replica_name}");
$replica_dbh1->do("CHANGE ${source_change} TO ${source_name}_DELAY=0");
$source_dbh->do("RESET ${source_reset}");
$replica_dbh1->do("RESET ${source_reset}");
$replica_dbh1->do("RESET ${replica_name}");

View File

@@ -162,6 +162,7 @@ $replica_dbh2 = $sb->get_dbh_for('replica2');
diag("Setting replica delay to 0 seconds");
$replica_dbh1->do("STOP ${replica_name}");
$replica_dbh2->do("STOP ${replica_name}");
$replica_dbh1->do("CHANGE ${source_change} TO ${source_name}_DELAY=0");
$source_dbh->do("RESET ${source_reset}");
$replica_dbh1->do("RESET ${replica_name}");
$replica_dbh2->do("RESET ${replica_name}");

View File

@@ -328,6 +328,7 @@ $replica_dbh2 = $sb->get_dbh_for('replica2');
diag("Setting replica delay to 0 seconds");
$replica_dbh1->do("STOP ${replica_name}");
$replica_dbh2->do("STOP ${replica_name}");
$replica_dbh1->do("CHANGE ${source_change} TO ${source_name}_DELAY=0");
$source_dbh->do("RESET ${source_reset}");
$replica_dbh1->do("RESET ${replica_name}");
$replica_dbh2->do("RESET ${replica_name}");

View File

@@ -98,6 +98,8 @@ unlike(
diag("Setting replica delay to 0 seconds");
$replica1_dbh->do("STOP ${replica_name}");
$replica2_dbh->do("STOP ${replica_name}");
$replica1_dbh->do("CHANGE ${source_change} TO ${source_name}_DELAY=0");
$replica2_dbh->do("CHANGE ${source_change} TO ${source_name}_DELAY=0");
$source_dbh->do("RESET ${source_reset}");
$replica1_dbh->do("RESET ${replica_name}");
$replica1_dbh->do("START ${replica_name}");

View File

@@ -354,6 +354,7 @@ $sb->do_as_root("source", q/FLUSH TABLES/);
diag("Setting replica delay to 0 seconds");
$replica_dbh->do("STOP ${replica_name}");
$replica_dbh->do("CHANGE ${source_change} TO ${source_name}_DELAY=0");
$source_dbh->do("RESET ${source_reset}");
$replica_dbh->do("RESET ${replica_name}");
$replica_dbh->do("START ${replica_name}");

View File

@@ -104,7 +104,7 @@ unlike(
$output,
qr/Cannot checksum table/,
"Very small --chunk-time doesn't cause zero --chunk-size"
);
) or diag($output);
}
# #############################################################################
# Bug 921700: pt-table-checksum doesn't add --where to chunk-oversize test

View File

@@ -12,7 +12,7 @@ use English qw(-no_match_vars);
use Test::More;
#if ( !$ENV{SLOW_TESTS} ) {
# plan skip_all => "pt-table-checksum/replication_filters.t is one of the top slowest files; set SLOW_TESTS=1 to enable it.";
# plan skip_all => "pt-table-checksum/pt-1616.t is one of the top slowest files; set SLOW_TESTS=1 to enable it.";
#}
use PerconaTest;
@@ -23,6 +23,8 @@ require "$trunk/bin/pt-table-checksum";
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('source');
my $replica1_dbh = $sb->get_dbh_for('replica1');
my $replica2_dbh = $sb->get_dbh_for('replica2');
if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox source';
@@ -104,6 +106,18 @@ unlike(
# #############################################################################
# Done.
# #############################################################################
diag("Resetting replicas, because this test sporadically fails");
$replica1_dbh->do("STOP ${replica_name}");
$replica2_dbh->do("STOP ${replica_name}");
$dbh->do("RESET ${source_reset}");
$replica1_dbh->do("RESET ${replica_name}");
$replica1_dbh->do("START ${replica_name}");
$replica2_dbh->do("RESET ${replica_name}");
$replica2_dbh->do("START ${replica_name}");
diag("Replicas reset, syncing");
$sb->wait_for_replicas();
diag("Cleaning up");
$sb->wipe_clean($dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
exit;

View File

@@ -127,7 +127,7 @@ is_deeply(
[qw( sakila city )],
],
"Checksum results for 1/4 of sakila singles"
);
) or diag(Dumper($row));
$output = output(
sub { pt_table_checksum::main(@args, qw(-d sakila --resume --chunk-size 10000)) },

View File

@@ -49,7 +49,7 @@ like(
$output,
qr/#\s+0\s+4\s+0\s+0\s+Chunk\s+/,
"Chunks char col"
);
) or diag($output);
like(
$output,
qr/FORCE INDEX \(`c`\)/,

View File

@@ -61,7 +61,7 @@ is(
REPLACE INTO `issue_375`.`t`(`id`, `updated_at`, `foo`) VALUES ('100', '2009-09-06 15:01:23', 'cv');
",
'Simple --replicate'
);
) or diag($output);
# Note how the columns are out of order (tbl order is: id, updated_at, foo).
# This is issue http://code.google.com/p/maatkit/issues/detail?id=371

View File

@@ -10,6 +10,7 @@ use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use POSIX ":sys_wait_h";
use PerconaTest;
use Sandbox;
@@ -38,26 +39,36 @@ else {
plan tests => 3;
}
diag("OK\n");
$sb->load_file('source', "t/pt-table-sync/samples/pt-1205.sql");
diag("OK 2\n");
$sb->wait_for_replicas();
diag("OK 3\n");
# Setting up tunnels
my $pid1 = fork();
if ( !$pid1 ) {
setpgrp;
system('ncat -k -l localhost 3333 --sh-exec "ncat 127.0.0.1 12345"');
system('ncat -k -l localhost 33333 --sh-exec "ncat 127.0.0.1 12345"');
diag("OK 4\n");
exit;
}
diag("OK 5\n");
my $pid2 = fork();
if ( !$pid2 ) {
setpgrp;
system('ncat -k -l localhost 3334 --sh-exec "ncat 127.0.0.1 12346"');
system('ncat -k -l localhost 33334 --sh-exec "ncat 127.0.0.1 12346"');
diag("OK 6\n");
exit;
}
diag("OK 7\n");
my $o = new OptionParser();
my $q = new Quoter();
my $ms = new MasterSlave(
@@ -67,28 +78,35 @@ my $ms = new MasterSlave(
);
my $ss = $ms->get_replica_status($replica1_dbh);
diag("OK 8\n");
$replica1_dbh->do("STOP ${replica_name}");
$replica1_dbh->do("CHANGE ${source_change} TO ${source_name}_PORT=3333, ${source_name}_LOG_POS=" . $ss->{"exec_${source_name}_log_pos"});
$replica1_dbh->do("CHANGE ${source_change} TO ${source_name}_PORT=33333, ${source_name}_LOG_POS=" . $ss->{"exec_${source_name}_log_pos"});
$replica1_dbh->do("START ${replica_name}");
my $output = `$trunk/bin/pt-table-sync h=127.0.0.1,P=3334,u=msandbox,p=msandbox --database=test --table=t1 --sync-to-source --execute --verbose 2>&1`;
diag("OK 9\n");
my $output = `$trunk/bin/pt-table-sync h=127.0.0.1,P=33334,u=msandbox,p=msandbox --database=test --table=t1 --sync-to-source --execute --verbose 2>&1`;
diag("OK 10\n");
unlike(
$output,
qr/The replica is connected to \d+ but the source's port is/,
'No error for redirected replica'
) or diag($output);
diag("OK 11\n");
kill -1, getpgrp($pid1);
kill -1, getpgrp($pid2);
diag("OK 12\n");
$replica1_dbh->do("STOP ${replica_name}");
$ss = $ms->get_replica_status($replica1_dbh);
$replica1_dbh->do("CHANGE ${source_change} TO ${source_name}_PORT=12347, ${source_name}_LOG_POS=" . $ss->{"exec_${source_name}_log_pos"});
$replica1_dbh->do("START ${replica_name} SQL_THREAD");
diag("OK 13\n");
$output = `$trunk/bin/pt-table-sync h=127.0.0.1,P=12346,u=msandbox,p=msandbox --database=test --table=t1 --sync-to-source --execute --verbose 2>&1`;
diag("OK 14\n");
like(
$output,
qr/The server specified as a source has no connected replicas/,
@@ -98,9 +116,12 @@ like(
$replica1_dbh->do("STOP ${replica_name}");
$replica1_dbh->do("CHANGE ${source_change} TO ${source_name}_PORT=12345, ${source_name}_LOG_POS=" . $ss->{"exec_${source_name}_log_pos"});
$replica1_dbh->do("START ${replica_name}");
diag("OK 15\n");
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($source_dbh);
diag("OK 16\n");
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
diag("OK 17\n");
exit;

View File

@@ -146,9 +146,8 @@ like(
$replica1_dbh->do("STOP ${replica_name}");
$replica1_dbh->do("CHANGE ${source_change} TO ${source_name}_port=12345, ${source_name}_user='msandbox'");
$replica1_dbh->do("START ${replica_name}");
$replica1_dbh->do("STOP ${replica_name}");
$replica1_dbh->do("CHANGE ${source_change} TO ${source_name}_port=12345, ${source_name}_user='msandbox'");
$source_dbh->do("RESET ${source_reset}");
$replica1_dbh->do("RESET ${replica_name}");
$replica1_dbh->do("START ${replica_name}");
# #############################################################################

View File

@@ -60,7 +60,7 @@ my $t = time - $t0;
ok(
$t >= 3 && $t <= ($ENV{PERCONA_SLOW_BOX} ? 8 : 6),
"Exec queries: ran for roughly --run-time seconds"
"Exec queries: ran for roughly 3 seconds"
) or diag($output, 'Actual run time:', $t);
# Exit status 8 = --run-time expired (an no other errors/problems)