Merge latest 2.2 with Lmo.

This commit is contained in:
Daniel Nichter
2013-02-11 18:57:07 -07:00
353 changed files with 19342 additions and 15099 deletions

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 82;
use Test::More;
use QueryRewriter;
use EventAggregator;
@@ -431,7 +431,7 @@ foreach my $event (@$events) {
is_deeply( $ea->results, $result, 'user aggregation' );
is($ea->type_for('Query_time'), 'num', 'Query_time is numeric');
$ea->calculate_statistical_metrics(apdex_t => 1);
$ea->calculate_statistical_metrics();
is_deeply(
$ea->metrics(
where => 'bob',
@@ -446,8 +446,6 @@ is_deeply(
median => '0.000682',
stddev => 0,
pct_95 => '0.000682',
apdex_t => 1,
apdex => '1.00',
},
'Got simple hash of metrics from metrics()',
);
@@ -466,8 +464,6 @@ is_deeply(
median => 0,
stddev => 0,
pct_95 => 0,
apdex_t => undef,
apdex => undef,
},
'It does not crash on metrics()',
);
@@ -1816,59 +1812,6 @@ is_deeply(
"Merge results"
);
# #############################################################################
# Apdex
# #############################################################################
my $samples = {
280 => 10, # 0.81623354758492 satisfy
281 => 10, # 0.85704522496417 satisfy
282 => 10, # 0.89989748621238 satisfy
283 => 50, # 0.94489236052300 satisfy
284 => 50, # 0.99213697854915 satisfy
285 => 10, # 1.04174382747661 tolerate
290 => 10, # 1.32955843985657 tolerate
313 => 1, # 4.08377033290049 frustrated
};
my $apdex = $ea->calculate_apdex(
t => 1,
samples => $samples,
);
is(
$apdex,
'0.93',
"Apdex score"
);
$samples = {
0 => 150,
};
$apdex = $ea->calculate_apdex(
t => 1,
samples => $samples,
);
is(
$apdex,
'1.00',
"Apdex score 1.00"
);
$samples = {
400 => 150,
};
$apdex = $ea->calculate_apdex(
t => 1,
samples => $samples,
);
is(
$apdex,
'0.00',
"Apdex score 0.00"
);
# #############################################################################
# Special-case attribs called *_crc for mqd --variations.
# #############################################################################
@@ -1953,4 +1896,5 @@ like(
qr/Complete test coverage/,
'_d() works'
);
done_testing;
exit;

View File

@@ -425,149 +425,6 @@ is_deeply(
],
'Got saved usage for 0xdeadbeef');
# #############################################################################
# Issue 1141: Add "spark charts" to mk-query-digest profile
# #############################################################################
is(
$exa->sparkline(explain =>
[
{ id => 1,
select_type => 'PRIMARY',
table => 'foo',
type => 'eq_ref',
possible_keys => ['idx'],
key => ['idx'],
key_len => [10],
ref => [],
rows => 100,
Extra => {
'Using index' => 1,
'Using where' => 1,
},
},
],
),
"E",
"sparkline: basic 1 table eq_ref"
);
is(
$exa->sparkline(explain =>
[
{ id => 1,
select_type => 'PRIMARY',
table => 'foo',
type => 'eq_ref',
possible_keys => ['idx'],
key => ['idx'],
key_len => [10],
ref => [],
rows => 100,
Extra => {
'Using index' => 1,
'Using where' => 1,
'Using filesort' => 1,
},
},
{ id => 2,
select_type => 'PRIMARY',
table => 'bar',
type => 'ref',
possible_keys => ['idx'],
key => ['idx'],
key_len => [10],
ref => ['foo.col'],
rows => 100,
Extra => {
},
},
],
),
"F>Er",
"sparkline: 2 table with filesort at start"
);
is(
$exa->sparkline(explain =>
[
{ id => 1,
select_type => 'PRIMARY',
table => 'foo',
type => 'range',
possible_keys => ['idx'],
key => ['idx'],
key_len => [10],
ref => [],
rows => 100,
Extra => {
},
},
{ id => 2,
select_type => 'PRIMARY',
table => 'bar',
type => 'ref',
possible_keys => ['idx'],
key => ['idx'],
key_len => [10],
ref => ['foo.col'],
rows => 100,
Extra => {
'Using temporary' => 1,
'Using filesort' => 1,
},
},
],
),
"nr>TF",
"sparkline: 2 table with temp and filesort at end"
);
is(
$exa->sparkline(explain =>
[
{ id => 1,
select_type => 'PRIMARY',
table => undef,
type => undef,
possible_keys => [],
key => [],
key_len => [],
ref => [],
rows => undef,
Extra => {
'No tables used' => 1,
},
},
{ id => 1,
select_type => 'UNION',
table => 'a',
type => 'index',
possible_keys => [],
key => ['PRIMARY'],
key_len => [2],
ref => [],
rows => 200,
Extra => {
'Using index' => 1,
},
},
{ id => undef,
select_type => 'UNION RESULT',
table => '<union1,2>',
type => 'ALL',
possible_keys => [],
key => [],
key_len => [],
ref => [],
rows => undef,
Extra => {},
},
],
),
"-Ia",
"sparkline: 3 tables, using index"
);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -1,4 +1,4 @@
package Bar;
use Mo;
use Lmo;
extends 'Foo';
1;

View File

@@ -1,5 +1,5 @@
package Boo;
use Mo;
use Lmo;
has 'buff';

View File

@@ -1,5 +1,5 @@
package Foo;
use Mo;
use Lmo;
has 'stuff';

View File

@@ -14,31 +14,31 @@ use Test::More;
$main::count = 1;
package Foo;
use Mo 'build';
use Lmo 'build';
has 'foo' => (is => 'rw');
sub BUILD {
my $self = shift;
::is_deeply(\@_, [qw(stuff 1)], "Foo's BUILD doesn't get the class name");
::is_deeply([sort @_], [sort qw(stuff 1)], "Foo's BUILD doesn't get the class name");
$self->foo($main::count++);
}
package Bar;
use Mo;
use Lmo;
extends 'Foo';
has 'bar' => (is => 'rw');
package Baz;
use Mo;
use Lmo;
extends 'Bar';
has 'baz' => (is => 'rw');
sub BUILD {
my $self = shift;
::is_deeply(\@_, [qw(stuff 1)], "Baz's BUILD doesn't get the class name");
::is_deeply([sort @_], [sort qw(stuff 1)], "Baz's BUILD doesn't get the class name");
$self->baz($main::count++);
}
package Gorch;
use Mo;
use Lmo;
extends 'Baz';
has 'gorch' => (is => 'rw');

View File

@@ -15,13 +15,13 @@ $main::count = 0;
{
package Nothing;
use Mo;
use Lmo;
has nothing_special => ( is => 'rw' );
}
ok(Nothing->can("BUILDARGS"), "Every class automatically gets buildargs");
package Foo;
use Mo;
use Lmo;
has 'foo' => (is => 'rw');
sub BUILDARGS {
my $class = shift;
@@ -30,12 +30,12 @@ sub BUILDARGS {
}
package Bar;
use Mo;
use Lmo;
extends 'Foo';
has 'bar' => (is => 'rw');
package Baz;
use Mo;
use Lmo;
extends 'Bar';
has 'baz' => (is => 'rw');
sub BUILDARGS {
@@ -45,7 +45,7 @@ sub BUILDARGS {
}
package Gorch;
use Mo;
use Lmo;
extends 'Baz';
has 'gorch' => (is => 'rw');
@@ -53,7 +53,7 @@ package main;
$main::count = 0;
my $g = Foo->new;
is $main::count, 1, "A class with no explicit parent inherits SUPER::BUILDARGS from Mo::Object";
is $main::count, 1, "A class with no explicit parent inherits SUPER::BUILDARGS from Lmo::Object";
$main::count = 0;
$g = Gorch->new;

View File

@@ -12,7 +12,7 @@ use English qw(-no_match_vars);
use Test::More;
package Foo::coerce;
use Mo;
use Lmo;
has 'stuff' => (coerce => sub { uc $_[0] });

View File

@@ -11,7 +11,7 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use lib "$ENV{PERCONA_TOOLKIT_BRANCH}/t/lib/Mo";
use lib "$ENV{PERCONA_TOOLKIT_BRANCH}/t/lib/Lmo";
use Bar;
my $b = Bar->new;

View File

@@ -21,14 +21,14 @@ use Test::More;
{
package Foo;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
has 'bar' => (is => 'rw', default => sub { 10 });
sub baz { 42 }
package Bar;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
has 'foo' => (
is => 'rw',
@@ -99,13 +99,13 @@ is($bar->foo_bar, 20, '... correctly curried a single argument');
{
package Engine;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
sub go { 'Engine::go' }
sub stop { 'Engine::stop' }
package Car;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
has 'engine' => (
is => 'rw',
@@ -137,14 +137,14 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
{
package Baz;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
sub foo { 'Baz::foo' }
sub bar { 'Baz::bar' }
sub boo { 'Baz::boo' }
package Baz::Proxy1;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
has 'baz' => (
is => 'ro',
@@ -154,7 +154,7 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
);
package Baz::Proxy2;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
has 'baz' => (
is => 'ro',
@@ -164,7 +164,7 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
);
package Baz::Proxy3;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
has 'baz' => (
is => 'ro',
@@ -228,14 +228,14 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
requires 'bar';
package Foo::Baz;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
sub foo { 'Foo::Baz::FOO' }
sub bar { 'Foo::Baz::BAR' }
sub baz { 'Foo::Baz::BAZ' }
package Foo::Thing;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
has 'thing' => (
is => 'rw',
@@ -244,7 +244,7 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
);
package Foo::OtherThing;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
use Moose::Util::TypeConstraints;
has 'other_thing' => (
@@ -288,7 +288,7 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
{
package Foo::Autoloaded;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
sub AUTOLOAD {
my $self = shift;
@@ -304,7 +304,7 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
}
package Bar::Autoloaded;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
has 'foo' => (
is => 'rw',
@@ -313,7 +313,7 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
);
package Baz::Autoloaded;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
has 'foo' => (
is => 'rw',
@@ -322,7 +322,7 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
);
package Goorch::Autoloaded;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
eval {
has 'foo' => (
@@ -447,7 +447,7 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
{
package Delegator;
use Mo qw(is required handles default builder);
use Lmo qw(is required handles default builder);
sub full { 1 }
sub stub;

View File

@@ -15,7 +15,7 @@ use Test::More;
{
package Foo;
use Mo qw( is init_arg );
use Lmo qw( is init_arg );
eval {
has 'foo' => (
@@ -64,7 +64,7 @@ use Test::More;
{
package Foo2;
use Mo qw( is init_arg clearer default );
use Lmo qw( is init_arg clearer default );
my $counter;
eval {

View File

@@ -12,7 +12,7 @@ use English qw(-no_match_vars);
use Test::More;
package Foo::is;
use Mo qw(is);
use Lmo qw(is);
has 'stuff' => (is => 'ro');

View File

@@ -29,7 +29,7 @@ sub lives_ok (&;$) {
}
package Foo::isa;
use Mo qw(isa);
use Lmo qw(isa);
my @types = qw(Bool Num Int Str ArrayRef CodeRef HashRef RegexpRef);
my @refs = ([], sub { }, {}, qr( ));
@@ -191,11 +191,11 @@ my $thisperl = $^X;
if ($^O ne 'VMS')
{$thisperl .= $Config{_exe} unless $thisperl =~ m/$Config{_exe}$/i;}
my $pm_test = "$PerconaTest::trunk/t/lib/Mo/isa_subtest.pm";
my $pm_test = "$PerconaTest::trunk/t/lib/Lmo/isa_subtest.pm";
ok(
scalar(IPC::Cmd::run(command => [$thisperl, $pm_test])),
"Mo types work with Scalar::Util::PP",
"Lmo types work with Scalar::Util::PP",
);
done_testing;

View File

@@ -16,7 +16,7 @@ use warnings;
{
package isa_subtest;
use Mo;
use Lmo;
has attr => (
is => 'rw',

83
t/lib/Lmo/meta.t Normal file
View File

@@ -0,0 +1,83 @@
#!/usr/bin/perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
sub throws_ok (&;$) {
my ( $code, $pat, $msg ) = @_;
eval { $code->(); };
like ( $EVAL_ERROR, $pat, $msg );
}
{
package Metatest;
use Lmo;
has stuff => ( is => 'rw', required => 1 );
has init_stuff1 => ( is => 'rw', init_arg => undef );
has init_stuff2 => ( is => 'rw', init_arg => 'fancy_name' );
}
{
package Metatest::child;
use Lmo;
extends 'Metatest';
has more_stuff => ( is => 'rw' );
}
my $obj = Metatest->new( stuff => 100 );
can_ok($obj, 'meta');
my $meta = $obj->meta();
is_deeply(
[ sort $meta->attributes ],
[ sort qw(stuff init_stuff1 init_stuff2) ],
"->attributes works"
);
is_deeply(
[ sort $meta->attributes_for_new ],
[ sort qw(stuff fancy_name) ],
"->attributes_for_new works"
);
# Do these BEFORE initializing ::extends
my $meta2 = Metatest::child->meta();
is_deeply(
[ sort $meta2->attributes ],
[ sort qw(stuff init_stuff1 init_stuff2 more_stuff) ],
"->attributes works on a child class"
);
is_deeply(
[ sort $meta2->attributes_for_new ],
[ sort qw(stuff fancy_name more_stuff) ],
"->attributes_for_new works in a child class"
);
my $meta3 = Metatest::child->new(stuff => 10)->meta();
is_deeply(
[ sort $meta3->attributes ],
[ sort qw(stuff init_stuff1 init_stuff2 more_stuff) ],
"->attributes works on an initialized child class"
);
is_deeply(
[ sort $meta3->attributes_for_new ],
[ sort qw(stuff fancy_name more_stuff) ],
"->attributes_for_new works in an initialized child class"
);
throws_ok { Metatest::child->new() } qr/\QAttribute (stuff) is required for Metatest::child/;
done_testing;

83
t/lib/Lmo/meta.t.moved Normal file
View File

@@ -0,0 +1,83 @@
#!/usr/bin/perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
sub throws_ok (&;$) {
my ( $code, $pat, $msg ) = @_;
eval { $code->(); };
like ( $EVAL_ERROR, $pat, $msg );
}
{
package Metatest;
use Lmo;
has stuff => ( is => 'rw', required => 1 );
has init_stuff1 => ( is => 'rw', init_arg => undef );
has init_stuff2 => ( is => 'rw', init_arg => 'fancy_name' );
}
{
package Metatest::child;
use Lmo;
extends 'Metatest';
has more_stuff => ( is => 'rw' );
}
my $obj = Metatest->new( stuff => 100 );
can_ok($obj, 'meta');
my $meta = $obj->meta();
is_deeply(
[ sort $meta->attributes ],
[ sort qw(stuff init_stuff1 init_stuff2) ],
"->attributes works"
);
is_deeply(
[ sort $meta->attributes_for_new ],
[ sort qw(stuff fancy_name) ],
"->attributes_for_new works"
);
# Do these BEFORE initializing ::extends
my $meta2 = Metatest::child->meta();
is_deeply(
[ sort $meta2->attributes ],
[ sort qw(stuff init_stuff1 init_stuff2 more_stuff) ],
"->attributes works on a child class"
);
is_deeply(
[ sort $meta2->attributes_for_new ],
[ sort qw(stuff fancy_name more_stuff) ],
"->attributes_for_new works in a child class"
);
my $meta3 = Metatest::child->new(stuff => 10)->meta();
is_deeply(
[ sort $meta3->attributes ],
[ sort qw(stuff init_stuff1 init_stuff2 more_stuff) ],
"->attributes works on an initialized child class"
);
is_deeply(
[ sort $meta3->attributes_for_new ],
[ sort qw(stuff fancy_name more_stuff) ],
"->attributes_for_new works in an initialized child class"
);
throws_ok { Metatest::child->new() } qr/\QAttribute (stuff) is required for Metatest::child/;
done_testing;

View File

@@ -10,7 +10,7 @@ use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use lib "$ENV{PERCONA_TOOLKIT_BRANCH}/t/lib/Mo";
use lib "$ENV{PERCONA_TOOLKIT_BRANCH}/t/lib/Lmo";
{ package Clean; use Foo; }

View File

@@ -13,14 +13,14 @@ use Test::More;
#============
package Foo::required;
use Mo qw(required);
use Lmo qw(required);
has 'stuff' => (required => 1);
has 'stuff2' => (required => 1);
has 'foo' => ();
#============
package Foo::required_is;
use Mo qw(required);
use Lmo qw(required);
has 'stuff' => (required => 1, is => 'ro');
#============
@@ -28,7 +28,7 @@ has 'stuff' => (required => 1, is => 'ro');
package main;
my $f0 = eval { Foo::required->new(stuff2 => 'foobar') };
like $@, qr/^\QAttribute (stuff) is required/, 'Mo dies when a required value is not provided';
like $@, qr/^\QAttribute (stuff) is required/, 'Lmo dies when a required value is not provided';
my $f = Foo::required->new(stuff => 'fubar', stuff2 => 'foobar');
is $f->stuff, 'fubar', 'Object is correctly initialized when required values are provided';

72
t/lib/Lmo/role.t Normal file
View File

@@ -0,0 +1,72 @@
#!/usr/bin/perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
BEGIN {
my $have_roles = eval { require Role::Tiny };
plan skip_all => "Can't load Role::Tiny, not testing Roles"
unless $have_roles;
}
{
package One::P1; use Lmo::Role;
has two => (is => 'ro', default => sub { 'two' });
no Lmo::Role;
package One::P2; use Lmo::Role;
has three => (is => 'ro', default => sub { 'three' });
no Lmo::Role;
package One::P3; use Lmo::Role;
has four => (is => 'ro', default => sub { 'four' });
no Lmo::Role;
package One; use Lmo;
with qw( One::P1 One::P2 );
has one => (is => 'ro', default => sub { 'one' });
}
my $combined = One->new();
ok $combined->does($_), "Does $_" for qw(One::P1 One::P2);
ok !$combined->does($_), "Doesn't $_" for qw(One::P3 One::P4);
is $combined->one, "one", "attr default set from class";
is $combined->two, "two", "attr default set from role";
is $combined->three, "three", "attr default set from role";
# Testing unimport
{
package Two::P1; use Lmo::Role;
has two => (is => 'ro', default => sub { 'two' });
no Lmo::Role;
package Two; use Lmo;
with qw(Two::P1);
has three => ( is => 'ro', default => sub { 'three' } );
no Lmo;
}
my $two = Two->new();
is
$two->two(),
'two',
"unimporting in a role doesn't remove new attributes";
for my $class ( qw( Two::P1 Two ) ) {
ok !$class->can($_), "...but does remove $_ from $class" for qw(has with extends requires);
}
done_testing;

72
t/lib/Lmo/role.t.moved Normal file
View File

@@ -0,0 +1,72 @@
#!/usr/bin/perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
BEGIN {
my $have_roles = eval { require Role::Tiny };
plan skip_all => "Can't load Role::Tiny, not testing Roles"
unless $have_roles;
}
{
package One::P1; use Lmo::Role;
has two => (is => 'ro', default => sub { 'two' });
no Lmo::Role;
package One::P2; use Lmo::Role;
has three => (is => 'ro', default => sub { 'three' });
no Lmo::Role;
package One::P3; use Lmo::Role;
has four => (is => 'ro', default => sub { 'four' });
no Lmo::Role;
package One; use Lmo;
with qw( One::P1 One::P2 );
has one => (is => 'ro', default => sub { 'one' });
}
my $combined = One->new();
ok $combined->does($_), "Does $_" for qw(One::P1 One::P2);
ok !$combined->does($_), "Doesn't $_" for qw(One::P3 One::P4);
is $combined->one, "one", "attr default set from class";
is $combined->two, "two", "attr default set from role";
is $combined->three, "three", "attr default set from role";
# Testing unimport
{
package Two::P1; use Lmo::Role;
has two => (is => 'ro', default => sub { 'two' });
no Lmo::Role;
package Two; use Lmo;
with qw(Two::P1);
has three => ( is => 'ro', default => sub { 'three' } );
no Lmo;
}
my $two = Two->new();
is
$two->two(),
'two',
"unimporting in a role doesn't remove new attributes";
for my $class ( qw( Two::P1 Two ) ) {
ok !$class->can($_), "...but does remove $_ from $class" for qw(has with extends requires);
}
done_testing;

View File

@@ -11,9 +11,9 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
eval 'package Foo; use Mo; $x = 1';
eval 'package Foo; use Lmo; $x = 1';
like $@, qr/Global symbol "\$x" requires explicit package name/,
'Mo is strict';
'Lmo is strict';
done_testing;

View File

@@ -13,18 +13,18 @@ use Test::More;
#============
package Foo;
use Mo;
use Lmo;
has 'this';
#============
package main;
ok defined(&Foo::has), 'Mo exports has';
ok defined(&Foo::extends), 'Mo exports extends';
ok not(defined(&Foo::new)), 'Mo does not export new';
ok 'Foo'->isa('Mo::Object'), 'Foo isa Mo::Object';
is "@Foo::ISA", "Mo::Object", '@Foo::ISA is Mo::Object';
ok defined(&Foo::has), 'Lmo exports has';
ok defined(&Foo::extends), 'Lmo exports extends';
ok not(defined(&Foo::new)), 'Lmo does not export new';
ok 'Foo'->isa('Lmo::Object'), 'Foo isa Lmo::Object';
is "@Foo::ISA", "Lmo::Object", '@Foo::ISA is Lmo::Object';
ok 'Foo'->can('new'), 'Foo can new';
ok 'Foo'->can('this'), 'Foo can this';
@@ -50,7 +50,7 @@ ok not(defined($f->{this})), '{this} is not defined';
#============
package Bar;
use Mo 'builder', 'default';
use Lmo 'builder', 'default';
extends 'Foo';
has 'that';
@@ -70,7 +70,7 @@ has guess => (
#============
package main;
ok 'Bar'->isa('Mo::Object'), 'Bar isa Mo::Object';
ok 'Bar'->isa('Lmo::Object'), 'Bar isa Lmo::Object';
ok 'Bar'->isa('Foo'), 'Bar isa Foo';
is "@Bar::ISA", 'Foo', '@Bar::ISA is Foo';
ok 'Bar'->can('new'), 'Bar can new';
@@ -85,7 +85,7 @@ my $b = Bar->new(
is ref($b), 'Bar', 'Object created';
ok $b->isa('Foo'), 'Inheritance works';
ok $b->isa('Mo::Object'), 'Bar isa Mo::Object since Foo isa Mo::Object';
ok $b->isa('Lmo::Object'), 'Bar isa Lmo::Object since Foo isa Lmo::Object';
is $b->this, 'thing', 'Read works in parent class';
is $b->that, 'thong', 'Read works in current class';
is ref($b->them), 'ARRAY', 'default works';
@@ -103,7 +103,7 @@ is $b->guess, 'me me me', 'default trumps builder';
#============
package Baz;
use Mo 'build';
use Lmo 'build';
has 'foo';
@@ -114,7 +114,7 @@ sub BUILD {
#============
package Maz;
use Mo;
use Lmo;
extends 'Baz';
has 'bar';

28
t/lib/Lmo/unimport.t Normal file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
{
package One; use Lmo;
has one => (is => 'ro', default => sub { 'one' });
no Lmo;
}
my $unimported = One->new();
is
$unimported->one(),
'one',
"after unimporting, ->one still works";
ok !$unimported->can($_), "after unimpoirt, can't $_" for qw(has with extends);
done_testing;

View File

@@ -0,0 +1,28 @@
#!/usr/bin/perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
{
package One; use Lmo;
has one => (is => 'ro', default => sub { 'one' });
no Lmo;
}
my $unimported = One->new();
is
$unimported->one(),
'one',
"after unimporting, ->one still works";
ok !$unimported->can($_), "after unimpoirt, can't $_" for qw(has with extends);
done_testing;

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 72;
use Test::More;
use MySQLProtocolParser;
use TcpdumpParser;
@@ -38,7 +38,6 @@ test_protocol_parser(
pos_in_log => 0,
bytes => length('select "hello world" as greeting'),
cmd => 'Query',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -66,7 +65,6 @@ test_protocol_parser(
pos_in_log => 1470,
bytes => length('administrator command: Connect'),
cmd => 'Admin',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -84,7 +82,6 @@ test_protocol_parser(
pos_in_log => 2449,
ts => '090412 11:00:13.118643',
user => 'msandbox',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -102,7 +99,6 @@ test_protocol_parser(
pos_in_log => 3298,
ts => '090412 11:00:13.119079',
user => 'msandbox',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -120,7 +116,6 @@ test_protocol_parser(
pos_in_log => '4186',
ts => '090412 11:00:13.119487',
user => 'msandbox',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -177,7 +172,7 @@ test_protocol_parser(
pos_in_log => 0,
bytes => length('select 5 from foo'),
cmd => 'Query',
Error_no => "#1046",
Error_no => "1046",
Error_msg => 'No database selected',
Rows_affected => 0,
Warning_count => 0,
@@ -194,7 +189,7 @@ test_protocol_parser(
protocol => $protocol,
file => "$sample/tcpdump005.txt",
result => [
{ Error_no => 'none',
{
Rows_affected => 1,
Query_time => '0.000435',
Thread_id => 4294967296,
@@ -212,7 +207,7 @@ test_protocol_parser(
No_good_index_used => 'No',
No_index_used => 'No',
},
{ Error_no => 'none',
{
Rows_affected => 2,
Query_time => '0.000565',
Thread_id => 4294967296,
@@ -252,7 +247,6 @@ test_protocol_parser(
pos_in_log => 0,
bytes => length('select * from t'),
cmd => 'Query',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -280,7 +274,6 @@ test_protocol_parser(
pos_in_log => 0,
bytes => length('insert into t values(current_date)'),
cmd => 'Query',
Error_no => 'none',
Rows_affected => 1,
Warning_count => 1,
No_good_index_used => 'No',
@@ -412,7 +405,6 @@ test_protocol_parser(
pos_in_log => 0,
bytes => length('select "hello world" as greeting'),
cmd => 'Query',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -434,7 +426,7 @@ test_protocol_parser(
file => "$sample/tcpdump013.txt",
desc => 'old password and compression',
result => [
{ Error_no => 'none',
{
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.034355',
@@ -466,7 +458,6 @@ test_protocol_parser(
desc => 'in-stream compression detection',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.001375',
@@ -503,7 +494,6 @@ SKIP: {
desc => 'compressed data',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.006415',
@@ -522,7 +512,6 @@ SKIP: {
user => 'msandbox',
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'Yes',
Query_time => '0.002884',
@@ -541,7 +530,6 @@ SKIP: {
user => 'msandbox',
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000000',
@@ -574,7 +562,6 @@ test_protocol_parser(
desc => 'TCP retransmission',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.001000',
@@ -607,7 +594,6 @@ test_protocol_parser(
desc => 'Multiple servers',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000206',
@@ -626,7 +612,6 @@ test_protocol_parser(
user => undef,
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000203',
@@ -656,7 +641,6 @@ test_protocol_parser(
desc => 'Multiple servers but watch only one',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000206',
@@ -713,7 +697,6 @@ test_protocol_parser(
desc => 'prepared statements, simple, no NULL',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000286',
@@ -733,7 +716,6 @@ test_protocol_parser(
Statement_id => 2,
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'Yes',
Query_time => '0.000281',
@@ -753,7 +735,6 @@ test_protocol_parser(
Statement_id => 2,
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000000',
@@ -782,7 +763,6 @@ test_protocol_parser(
desc => 'prepared statements, NULL value',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000303',
@@ -802,7 +782,6 @@ test_protocol_parser(
Statement_id => 2,
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000186',
@@ -832,7 +811,6 @@ test_protocol_parser(
desc => 'prepared statements, string, char and float',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000315',
@@ -852,7 +830,6 @@ test_protocol_parser(
Statement_id => 2,
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000249',
@@ -882,7 +859,6 @@ test_protocol_parser(
desc => 'prepared statements, all NULL',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000278',
@@ -902,7 +878,6 @@ test_protocol_parser(
Statement_id => 2,
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000159',
@@ -932,7 +907,6 @@ test_protocol_parser(
desc => 'prepared statements, no params',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000268',
@@ -952,7 +926,6 @@ test_protocol_parser(
Statement_id => 2,
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'Yes',
Query_time => '0.000234',
@@ -982,7 +955,6 @@ test_protocol_parser(
desc => 'prepared statements, close statement',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000000',
@@ -1011,7 +983,6 @@ test_protocol_parser(
desc => 'prepared statements, reset statement',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000023',
@@ -1041,7 +1012,6 @@ test_protocol_parser(
desc => 'prepared statements, multiple exec, new param',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000292',
@@ -1061,7 +1031,6 @@ test_protocol_parser(
user => undef
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'Yes',
Query_time => '0.000254',
@@ -1081,7 +1050,6 @@ test_protocol_parser(
user => undef
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'Yes',
Query_time => '0.000190',
@@ -1101,7 +1069,6 @@ test_protocol_parser(
user => undef
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'Yes',
Query_time => '0.000166',
@@ -1131,7 +1098,6 @@ test_protocol_parser(
desc => 'prepared statements, real param types',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000221',
@@ -1151,7 +1117,6 @@ test_protocol_parser(
user => undef
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000203',
@@ -1171,7 +1136,6 @@ test_protocol_parser(
user => undef
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000000',
@@ -1190,7 +1154,6 @@ test_protocol_parser(
user => undef
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000000',
@@ -1219,7 +1182,6 @@ test_protocol_parser(
desc => 'prepared statements, ok response to execute',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000046',
@@ -1239,7 +1201,6 @@ test_protocol_parser(
user => undef
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000024',
@@ -1269,7 +1230,6 @@ test_protocol_parser(
desc => 'prepared statements, NULL bitmap',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000288',
@@ -1289,7 +1249,6 @@ test_protocol_parser(
user => undef
},
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000322',
@@ -1322,7 +1281,6 @@ test_protocol_parser(
desc => 'issue 761',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000431',
@@ -1354,7 +1312,6 @@ test_protocol_parser(
desc => 'issue 760',
result => [
{
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000430',
@@ -1397,7 +1354,6 @@ test_protocol_parser(
pos_in_log => 1470,
bytes => length('administrator command: Connect'),
cmd => 'Admin',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -1415,7 +1371,6 @@ test_protocol_parser(
pos_in_log => 2449,
ts => '090412 11:00:13.119079',
user => 'msandbox',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -1433,7 +1388,6 @@ test_protocol_parser(
pos_in_log => 3337,
ts => '090412 11:00:13.119487',
user => 'msandbox',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -1441,7 +1395,6 @@ test_protocol_parser(
},
# port reused...
{ ts => '090412 12:00:00.800000',
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.700000',
@@ -1459,7 +1412,6 @@ test_protocol_parser(
user => 'msandbox',
},
{ ts => '090412 12:00:01.000000',
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.100000',
@@ -1477,7 +1429,6 @@ test_protocol_parser(
user => 'msandbox',
},
{ ts => '090412 12:00:01.100000',
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000000',
@@ -1516,7 +1467,6 @@ test_protocol_parser(
pos_in_log => 1470,
bytes => length('administrator command: Connect'),
cmd => 'Admin',
Error_no => 'none',
Rows_affected => 0,
Warning_count => 0,
No_good_index_used => 'No',
@@ -1524,7 +1474,6 @@ test_protocol_parser(
},
# port reused...
{ ts => '090412 12:00:00.800000',
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.700000',
@@ -1542,7 +1491,6 @@ test_protocol_parser(
user => 'msandbox',
},
{ ts => '090412 12:00:01.000000',
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.100000',
@@ -1560,7 +1508,6 @@ test_protocol_parser(
user => 'msandbox',
},
{ ts => '090412 12:00:01.100000',
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000000',
@@ -1588,7 +1535,6 @@ test_protocol_parser(
desc => 'no server ok (issue 794)',
result => [
{ ts => '090412 12:00:01.000000',
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000000',
@@ -1606,7 +1552,6 @@ test_protocol_parser(
user => undef
},
{ ts => '090412 12:00:03.000000',
Error_no => 'none',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '1.000000',
@@ -1659,7 +1604,7 @@ test_protocol_parser(
[
{
Error_msg => "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1",
Error_no => '#1064',
Error_no => '1064',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000316',
@@ -1679,7 +1624,7 @@ test_protocol_parser(
},
{
Error_msg => 'Unknown system variable \'nono\'',
Error_no => '#1193',
Error_no => '1193',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000329',
@@ -1700,7 +1645,107 @@ test_protocol_parser(
],
);
# #############################################################################
# Bug 1103045: pt-query-digest fails to parse non-SQL errors
# https://bugs.launchpad.net/percona-toolkit/+bug/1103045
# #############################################################################
$protocol = new MySQLProtocolParser(
server => '127.0.0.1',
port => '12345',
);
test_protocol_parser(
parser => $tcpdump,
protocol => $protocol,
file => "$sample/tcpdump043.txt",
desc => 'Bad connection',
result =>
[
{
Error_msg => 'Got packets out of order',
Error_no => 1156,
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '3.536306',
Rows_affected => 0,
Thread_id => 27,
Warning_count => 0,
arg => 'administrator command: Connect',
bytes => 30,
cmd => 'Admin',
db => undef,
host => '127.0.0.1',
ip => '127.0.0.1',
port => '62160',
pos_in_log => undef,
ts => '130124 13:03:28.672987',
user => undef,
}
],
);
test_protocol_parser(
parser => $tcpdump,
protocol => $protocol,
file => "$sample/tcpdump042.txt",
desc => 'Client went away during handshake',
result => [
{
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '9.998411',
Rows_affected => 0,
Thread_id => 24,
Warning_count => 0,
arg => 'administrator command: Connect',
bytes => 30,
cmd => 'Admin',
db => undef,
host => '127.0.0.1',
ip => '127.0.0.1',
port => '62133',
pos_in_log => undef,
ts => '130124 12:55:48.274417',
user => undef,
Error_msg => 'Client closed connection during handshake',
}
],
);
$protocol = new MySQLProtocolParser(
server => '100.0.0.1',
);
test_protocol_parser(
parser => $tcpdump,
protocol => $protocol,
file => "$sample/tcpdump044.txt",
desc => 'Client aborted connection (bug 1103045)',
result => [
{
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '3.819507',
Rows_affected => 0,
Thread_id => 13,
Warning_count => 0,
arg => 'administrator command: Connect',
bytes => 30,
cmd => 'Admin',
db => undef,
host => '100.0.0.2',
ip => '100.0.0.2',
port => '44432',
pos_in_log => undef,
ts => '130122 09:55:57.793375',
user => undef,
Error_msg => 'Client closed connection during handshake',
},
],
);
# #############################################################################
# Done.
# #############################################################################
exit;
done_testing;

View File

@@ -261,7 +261,7 @@ $pipeline->add(
);
$output = output(
sub { $pipeline->execute(%args) },
sub {$pipeline->execute(%args); },
stderr => 1,
);

View File

@@ -43,7 +43,6 @@ my $o = new OptionParser(description=>'qrf');
my $ex = new ExplainAnalyzer(QueryRewriter => $qr, QueryParser => $qp);
$o->get_specs("$trunk/bin/pt-query-digest");
my $qrf = new QueryReportFormatter(
OptionParser => $o,
QueryRewriter => $qr,
@@ -885,6 +884,13 @@ ok(
# Test show_all.
@ARGV = qw(--show-all host);
$o->get_opts();
$qrf = new QueryReportFormatter(
OptionParser => $o,
QueryRewriter => $qr,
QueryParser => $qp,
Quoter => $q,
ExplainAnalyzer => $ex,
);
$result = $qrf->event_report(
ea => $ea,
select => [ qw(Query_time host) ],
@@ -971,7 +977,13 @@ $ea->calculate_statistical_metrics(apdex_t=>1);
# Reset opts in case anything above left something set.
@ARGV = qw();
$o->get_opts();
$qrf = new QueryReportFormatter(
OptionParser => $o,
QueryRewriter => $qr,
QueryParser => $qp,
Quoter => $q,
ExplainAnalyzer => $ex,
);
# Normally, the report subs will make their own ReportFormatter but
# that package isn't visible to QueryReportFormatter right now so we
# make ReportFormatters and pass them in. Since ReporFormatters can't
@@ -980,7 +992,7 @@ $o->get_opts();
# profile subreport. And the line width is 82 because that's the new
# default to accommodate the EXPLAIN sparkline (issue 1141).
my $report = new ReportFormatter(line_width=>82);
$qrf->set_report_formatter(report=>'profile', formatter=>$report);
$qrf->{formatter} = $report;
ok(
no_diff(
sub { $qrf->print_reports(
@@ -997,8 +1009,6 @@ ok(
"print_reports(header, query_report, profile)"
);
$report = new ReportFormatter(line_width=>82);
$qrf->set_report_formatter(report=>'profile', formatter=>$report);
ok(
no_diff(
sub { $qrf->print_reports(
@@ -1051,11 +1061,6 @@ foreach my $event ( @$events ) {
$ea->aggregate($event);
}
$ea->calculate_statistical_metrics();
$report = new ReportFormatter(
line_width => 82,
extend_right => 1,
);
$qrf->set_report_formatter(report=>'prepared', formatter=>$report);
ok(
no_diff(
sub {
@@ -1094,11 +1099,6 @@ foreach my $event ( @$events ) {
$ea->aggregate($event);
}
$ea->calculate_statistical_metrics();
$report = new ReportFormatter(
line_width => 82,
extend_right => 1,
);
$qrf->set_report_formatter(report=>'profile', formatter=>$report);
ok(
no_diff(
sub {
@@ -1130,7 +1130,13 @@ SKIP: {
@ARGV = qw(--explain F=/tmp/12345/my.sandbox.cnf);
$o->get_opts();
$qrf = new QueryReportFormatter(
OptionParser => $o,
QueryRewriter => $qr,
QueryParser => $qp,
Quoter => $q,
ExplainAnalyzer => $ex,
);
my $qrf = new QueryReportFormatter(
OptionParser => $o,
QueryRewriter => $qr,
@@ -1151,70 +1157,6 @@ SKIP: {
"explain_report()"
);
my $arg = "select t1.i from t as t1 join t as t2 where t1.i < t2.i and t1.v is not null order by t1.i";
my $fingerprint = $qr->fingerprint($arg);
$events = [
{
Query_time => '0.000286',
arg => $arg,
fingerprint => $fingerprint,
bytes => length $arg,
cmd => 'Query',
db => 'qrf',
pos_in_log => 0,
ts => '091208 09:23:49.637394',
},
];
$ea = new EventAggregator(
groupby => 'fingerprint',
worst => 'Query_time',
);
foreach my $event ( @$events ) {
$ea->aggregate($event);
}
$ea->calculate_statistical_metrics();
# Make sure that explain_sparkline() does USE db like explain_report()
# does because by mqd defaults expalin_sparline() is called by profile()
# so if it doesn't USE db then the EXPLAIN will fail. Here we reset
# the db to something else because we already called explain_report()
# above which did USE qrf.
#
# 5.6 really is that different: ia vs. TF>aI. It's smarter.
$dbh->do("USE mysql");
my $explain_sparkline = $qrf->explain_sparkline($arg, 'qrf');
is(
$explain_sparkline,
$sandbox_version eq '5.6' ? "ia" : "TF>aI",
"explain_sparkling() uses db"
);
$report = new ReportFormatter(
line_width => 82,
extend_right => 1,
);
$qrf->set_report_formatter(report=>'profile', formatter=>$report);
$dbh->do("USE mysql"); # same reason as above ^; force use db from event
ok(
no_diff(
sub {
$qrf->print_reports(
reports => ['profile', 'query_report'],
ea => $ea,
worst => [ [$fingerprint, 'top', 1], ],
other => [ [$fingerprint, 'misc', 2], ],
orderby => 'Query_time',
groupby => 'fingerprint',
);
},
( $sandbox_version eq '5.6' ? "t/lib/samples/QueryReportFormatter/report032.txt"
: $sandbox_version ge '5.1' ? "t/lib/samples/QueryReportFormatter/report027.txt"
: "t/lib/samples/QueryReportFormatter/report029.txt"),
),
"EXPLAIN sparkline (issue 1141)"
);
$sb->wipe_clean($dbh);
$dbh->disconnect();
}
@@ -1265,7 +1207,6 @@ foreach my $event ( @$events ) {
$ea->calculate_statistical_metrics();
@ARGV = qw();
$o->get_opts();
$report = new ReportFormatter(line_width=>82);
$qrf = new QueryReportFormatter(
OptionParser => $o,
QueryRewriter => $qr,
@@ -1273,7 +1214,6 @@ $qrf = new QueryReportFormatter(
Quoter => $q,
ExplainAnalyzer => $ex,
);
$qrf->set_report_formatter(report=>'profile', formatter=>$report);
my $output = output(
sub { $qrf->print_reports(
reports => [qw(rusage date files header query_report profile)],
@@ -1337,11 +1277,6 @@ foreach my $event ( @$events ) {
$ea->aggregate($event);
}
$ea->calculate_statistical_metrics();
$report = new ReportFormatter(
line_width => 82,
extend_right => 1,
);
$qrf->set_report_formatter(report=>'profile', formatter=>$report);
ok(
no_diff(
sub {
@@ -1360,181 +1295,6 @@ ok(
"Variance-to-mean ration (issue 1124)"
);
# #############################################################################
# Issue 1141: Add "spark charts" to mk-query-digest profile
# #############################################################################
sub proc_events {
my ( %args ) = @_;
my ($arg, $attrib, $vals) = @args{qw(arg attrib vals)};
my $bytes = length $arg;
my $fingerprint = $qr->fingerprint($arg);
$events = [];
foreach my $val ( @$vals ) {
push @$events, {
bytes => $bytes,
arg => $arg,
fingerprint => $fingerprint,
$attrib => $val,
}
}
$ea = new EventAggregator(
groupby => 'fingerprint',
worst => 'Query_time',
);
foreach my $event (@$events) {
$ea->aggregate($event);
}
$ea->calculate_statistical_metrics(apdex_t=>1);
# Seeing the full chart helps determine what the
# sparkline should look like.
if ( $args{chart} ) {
$result = $qrf->chart_distro(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
print $result;
}
return;
};
# Test sparklines in isolation.
proc_events(
arg => 'select c from t',
attrib => 'Query_time',
vals => [qw(0 0 0)],
);
$result = $qrf->distro_sparkline(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
is(
$result,
" ",
"Sparkchart line - all zeros"
);
# 1us
# 10us
# 100us ################################################
# 1ms ################################
# 10ms ################################
# 100ms ################################################################
# 1s ################
# 10s+
proc_events(
arg => 'select c from t',
attrib => 'Query_time',
vals => [qw(0.100000 0.500000 0.000600 0.008000 0.990000 1.000000 0.400000 0.003000 0.000200 0.000100 0.010000 0.020000)],
);
$result = $qrf->distro_sparkline(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
is(
$result,
" -..^_ ",
"Sparkchart line 1"
);
# 1us
# 10us
# 100us
# 1ms
# 10ms ################################
# 100ms ################################################################
# 1s ########
# 10s+
proc_events(
arg => 'select c from t',
attrib => 'Query_time',
vals => [qw(0.01 0.03 0.08 0.09 0.3 0.5 0.5 0.6 0.7 0.5 0.5 0.9 1.0)],
);
$result = $qrf->distro_sparkline(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
is(
$result,
" .^_ ",
"Sparkchart line 2"
);
# 1us ################################################################
# 10us ################################################################
# 100us ################################################################
# 1ms ################################################################
# 10ms ################################################################
# 100ms ################################################################
# 1s ################################################################
# 10s+
proc_events(
arg => 'select c from t',
attrib => 'Query_time',
vals => [qw(0.000003 0.000030 0.000300 0.003000 0.030000 0.300000 3)],
);
$result = $qrf->distro_sparkline(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
is(
$result,
"^^^^^^^ ",
"Sparkchart line - vals in all ranges except 10s+"
);
# 1us ################################################################
# 10us ################################################################
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+ ################################################################
proc_events(
arg => 'select c from t',
attrib => 'Query_time',
vals => [qw(0.000003 0.000030 0.000003 0.000030 3 3 30 30)],
);
$result = $qrf->distro_sparkline(
ea => $ea,
item => 'select c from t',
attrib => 'Query_time',
);
is(
$result,
"^^ ^^",
"Sparkchart line - twin peaks"
);
# Test that that ^ sparkchart appears in the event header properly.
$result = $qrf->event_report(
ea => $ea,
select => [ qw(Query_time) ],
item => 'select c from t',
rank => 1,
orderby => 'Query_time',
reason => 'top',
);
ok(
no_diff(
$result,
"t/lib/samples/QueryReportFormatter/report028.txt",
cmd_output => 1,
),
'Sparkchart in event header'
);
# ############################################################################
# Bug 887688: Prepared statements crash pt-query-digest
# ############################################################################
@@ -1565,11 +1325,6 @@ foreach my $event ( @$events ) {
$ea->aggregate($event);
}
$ea->calculate_statistical_metrics();
$report = new ReportFormatter(
line_width => 82,
extend_right => 1,
);
$qrf->set_report_formatter(report=>'prepared', formatter=>$report);
ok(
no_diff(
sub {

View File

@@ -161,7 +161,6 @@ my $hist_struct = $tp->parse(
$qv->set_history_options(
table => 'test.query_review_history',
dbh => $dbh,
quoter => $q,
tbl_struct => $hist_struct,
col_pat => qr/^(.*?)_($pat)$/,
@@ -257,7 +256,6 @@ $hist_struct = $tp->parse(
$tp->get_create_table($dbh, 'test', 'query_review_history'));
$qv->set_history_options(
table => 'test.query_review_history',
dbh => $dbh,
quoter => $q,
tbl_struct => $hist_struct,
col_pat => qr/^(.*?)_($pat)$/,

View File

@@ -88,7 +88,7 @@ is(
# Basic report.
# #############################################################################
$rf = new ReportFormatter();
$rf->set_title('Checksum differences');
$rf->title('Checksum differences');
$rf->set_columns(
{
name => 'Query ID',
@@ -216,7 +216,7 @@ is(
# Respect line width.
# #############################################################################
$rf = new ReportFormatter();
$rf->set_title('Respect line width');
$rf->title('Respect line width');
$rf->set_columns(
{ name => 'col1' },
{ name => 'col2' },
@@ -248,7 +248,7 @@ is(
# extend_right
# #############################################################################
$rf = new ReportFormatter(extend_right=>1);
$rf->set_title('extend_right');
$rf->title('extend_right');
$rf->set_columns(
{ name => 'col1' },
{ name => 'col2' },
@@ -280,7 +280,7 @@ is(
# Relvative column widths.
# #############################################################################
$rf = new ReportFormatter();
$rf->set_title('Relative col widths');
$rf->title('Relative col widths');
$rf->set_columns(
{ name => 'col1', width_pct=>'20', },
{ name => 'col2', width_pct=>'40', },
@@ -309,7 +309,7 @@ is(
);
$rf = new ReportFormatter();
$rf->set_title('Relative col widths');
$rf->title('Relative col widths');
$rf->set_columns(
{ name => 'col1', width_pct=>'20', },
{ name => 'col2', width_pct=>'40', },
@@ -344,7 +344,7 @@ is(
);
$rf = new ReportFormatter();
$rf->set_title('Relative col widths');
$rf->title('Relative col widths');
$rf->set_columns(
{ name => 'col1', width =>'25', },
{ name => 'col2', width_pct=>'33', },
@@ -380,7 +380,7 @@ is(
$rf = new ReportFormatter();
$rf->set_title('Short cols');
$rf->title('Short cols');
$rf->set_columns(
{ name => 'I am column1', },
{ name => 'I am column2', },
@@ -403,7 +403,7 @@ is(
);
$rf = new ReportFormatter();
$rf->set_title('Short cols');
$rf->title('Short cols');
$rf->set_columns(
{ name => 'I am column1', },
{ name => 'I am column2', },
@@ -422,7 +422,7 @@ is(
);
$rf = new ReportFormatter();
$rf->set_title('Short cols');
$rf->title('Short cols');
$rf->set_columns(
{ name => 'I am column1', },
{ name => 'I am column2', },

View File

@@ -1,42 +0,0 @@
#!/usr/bin/perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 1;
use TimeSeriesTrender;
use PerconaTest;
my $result;
my $tst = new TimeSeriesTrender(
callback => sub { $result = $_[0]; },
);
$tst->set_time('5');
map { $tst->add_number($_) }
qw(1 2 1 2 12 23 2 2 3 3 21 3 3 1 1 2 3 1 2 12 2
3 1 3 2 22 2 2 2 2 3 1 1);
$tst->set_time('6');
is_deeply($result,
{
ts => 5,
stdev => 6.09038140334414,
avg => 4.42424242424242,
min => 1,
max => 23,
cnt => 33,
sum => 146,
},
'Simple stats test');
# #############################################################################
# Done.
# #############################################################################

View File

@@ -12,7 +12,7 @@ use English qw(-no_match_vars);
use Test::More;
use Data::Dumper;
use VersionCheck;
use Pingback;
use DSNParser;
use Sandbox;
use PerconaTest;
@@ -23,7 +23,7 @@ my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $master_dbh = $sb->get_dbh_for('master');
my $slave1_dbh = $sb->get_dbh_for('slave1');
my $vc = VersionCheck->new();
my $vc = 'Pingback';
sub test_v {
my (%args) = @_;

View File

@@ -1,17 +1,15 @@
#!/usr/bin/env bash
plan 6
source "$LIB_DIR/log_warn_die.sh"
log "Hello world!" > $TEST_PT_TMPDIR/log
log "Hello world A!" > $TEST_PT_TMPDIR/log
cmd_ok \
"grep -q 'Hello world!' $TEST_PT_TMPDIR/log" \
"grep -q 'Hello world A!' $TEST_PT_TMPDIR/log" \
"log msg"
log "Hello" "world!" > $TEST_PT_TMPDIR/log
log "Hello" "world B!" > $TEST_PT_TMPDIR/log
cmd_ok \
"grep -q 'Hello world!' $TEST_PT_TMPDIR/log" \
"grep -q 'Hello world B!' $TEST_PT_TMPDIR/log" \
"log msg msg"
is \
@@ -19,14 +17,14 @@ is \
"0" \
"Exit status 0"
warn "Hello world!" 2> $TEST_PT_TMPDIR/log
warn "Hello world C!" 2> $TEST_PT_TMPDIR/log
cmd_ok \
"grep -q 'Hello world!' $TEST_PT_TMPDIR/log" \
"grep -q 'Hello world C!' $TEST_PT_TMPDIR/log" \
"warn msg"
warn "Hello" "world!" 2> $TEST_PT_TMPDIR/log
warn "Hello" "world D!" 2> $TEST_PT_TMPDIR/log
cmd_ok \
"grep -q 'Hello world!' $TEST_PT_TMPDIR/log" \
"grep -q 'Hello world D!' $TEST_PT_TMPDIR/log" \
"warn msg msg"
is \
@@ -34,6 +32,81 @@ is \
"1" \
"Exit status 1"
OPT_VERBOSE=1
info "Hello world 1!" > $TEST_PT_TMPDIR/log
file_is_empty \
$TEST_PT_TMPDIR/log \
"verbose=1 info"
log "Hello world 2!" > $TEST_PT_TMPDIR/log
file_is_empty \
$TEST_PT_TMPDIR/log \
"verbose=1 log"
warn "Hello world 3!" > $TEST_PT_TMPDIR/log 2>&1
file_contains \
$TEST_PT_TMPDIR/log \
"Hello world 3!" \
"verbose=1 warn"
OPT_VERBOSE=2
info "Hello world 4!" > $TEST_PT_TMPDIR/log
file_is_empty \
$TEST_PT_TMPDIR/log \
"verbose=2 info"
log "Hello world 5!" > $TEST_PT_TMPDIR/log
file_contains \
$TEST_PT_TMPDIR/log \
"Hello world 5!" \
"verbose=2 log"
warn "Hello world 6!" > $TEST_PT_TMPDIR/log 2>&1
file_contains \
$TEST_PT_TMPDIR/log \
"Hello world 6!" \
"verbose=2 warn"
OPT_VERBOSE=3
info "Hello world 7!" > $TEST_PT_TMPDIR/log
file_contains \
$TEST_PT_TMPDIR/log \
"Hello world 7!" \
"verbose=3 info"
log "Hello world 8!" > $TEST_PT_TMPDIR/log
file_contains \
$TEST_PT_TMPDIR/log \
"Hello world 8!" \
"verbose=3 log"
warn "Hello world 9!" > $TEST_PT_TMPDIR/log 2>&1
file_contains \
$TEST_PT_TMPDIR/log \
"Hello world 9!" \
"verbose=3 warn"
OPT_VERBOSE=0
info "Hello world 10!" > $TEST_PT_TMPDIR/log
file_is_empty \
$TEST_PT_TMPDIR/log \
"verbose=0 info"
log "Hello world 11!" > $TEST_PT_TMPDIR/log
file_is_empty \
$TEST_PT_TMPDIR/log \
"verbose=0 log"
warn "Hello world 12!" > $TEST_PT_TMPDIR/log 2>&1
file_is_empty \
$TEST_PT_TMPDIR/log \
"verbose=0 warn"
# ###########################################################################
# Done
# ###########################################################################
done_testing

View File

@@ -7,8 +7,7 @@
# Lock time 1ms 1ms 1ms 1ms 1ms 0 1ms
# Query 1: 0 QPS, 0x concurrency, ID 0x5796997451B1FA1D at byte 123 ______
# Scores: Apdex = 1.00 [1.0]*, V/M = 0.00
# Query_time sparkline: | ^ |
# Scores: V/M = 0.00
# Time range: all events occurred at 2007-10-15 21:43:52
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
@@ -35,6 +34,6 @@
select col from tbl where id=42\G
# Profile
# Rank Query ID Response time Calls R/Call Apdx V/M Item
# ==== ================== ============= ===== ====== ==== ===== ==========
# 1 0x5796997451B1FA1D 1.0007 100.0% 1 1.0007 1.00 0.00 SELECT tbl
# Rank Query ID Response time Calls R/Call V/M Item
# ==== ================== ============= ===== ====== ===== ==========
# 1 0x5796997451B1FA1D 1.0007 100.0% 1 1.0007 0.00 SELECT tbl

View File

@@ -1,7 +1,6 @@
# Query 1: 0 QPS, 0x concurrency, ID 0x3F79759E7FA2F117 at byte 1106 _____
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# Query_time sparkline: | ^ |
# Scores: V/M = 0.00
# Time range: all events occurred at 2009-12-08 09:23:49.637892
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
@@ -31,8 +30,7 @@ EXECUTE SELECT i FROM d.t WHERE i="3"\G
SELECT i FROM d.t WHERE i="3"\G
# Query 2: 0 QPS, 0x concurrency, ID 0xAA8E9FA785927259 at byte 0 ________
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# Query_time sparkline: | ^ |
# Scores: V/M = 0.00
# Time range: all events occurred at 2009-12-08 09:23:49.637394
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,12 +1,11 @@
# Profile
# Rank Query ID Response time Calls R/Call Apdx V/M Item
# ==== ================== ============= ===== ====== ==== ===== ==========
# 1 0x5796997451B1FA1D 1.0007 100.0% 1 1.0007 1.00 0.00 SELECT tbl
# Rank Query ID Response time Calls R/Call V/M Item
# ==== ================== ============= ===== ====== ===== ==========
# 1 0x5796997451B1FA1D 1.0007 100.0% 1 1.0007 0.00 SELECT tbl
# Query 1: 0 QPS, 0x concurrency, ID 0x5796997451B1FA1D at byte 123 ______
# Scores: Apdex = 1.00 [1.0]*, V/M = 0.00
# Query_time sparkline: | ^ |
# Scores: V/M = 0.00
# Time range: all events occurred at 2007-10-15 21:43:52
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,6 +1,6 @@
# Profile
# Rank Query ID Response time Calls R/Call Apdx V/M Item
# ==== ================== ============= ===== ====== ==== ===== ==========
# 1 0xAECF4CA2310AC9E2 1.0303 97.1% 1 1.0303 NS 0.00 UPDATE foo
# MISC 0xMISC 0.0306 2.9% 2 0.0153 NS 0.0 <2 ITEMS>
# Rank Query ID Response time Calls R/Call V/M Item
# ==== ================== ============= ===== ====== ===== ==========
# 1 0xAECF4CA2310AC9E2 1.0303 97.1% 1 1.0303 0.00 UPDATE foo
# MISC 0xMISC 0.0306 2.9% 2 0.0153 0.0 <2 ITEMS>

View File

@@ -1,5 +1,5 @@
# Profile
# Rank Query ID Response time Calls R/Call Apdx V/M Item
# ==== ================== ============== ===== ====== ==== ===== ========
# 1 0xCB5621E548E5497F 17.5000 100.0% 4 4.3750 NS 2.23 SELECT t
# Rank Query ID Response time Calls R/Call V/M Item
# ==== ================== ============== ===== ====== ===== ========
# 1 0xCB5621E548E5497F 17.5000 100.0% 4 4.3750 2.23 SELECT t

View File

@@ -1,6 +1,6 @@
# Query 1: 2 QPS, 9.00x concurrency, ID 0x82860EDA9A88FCC5 at byte 1 _____
# This item is included in the report because it matches --limit.
# Scores: Apdex = 0.50 [1.0]*, V/M = 5.44
# Scores: V/M = 5.44
# Time range: 2007-10-15 21:43:52 to 21:43:53
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,6 +1,6 @@
# Query 1: 0 QPS, 0x concurrency, ID 0x5D51E5F01B88B79E at byte 0 ________
# This item is included in the report because it matches --limit.
# Scores: Apdex = 1.00 [1.0]*, V/M = 0.00
# Scores: V/M = 0.00
# Time range: all events occurred at 2009-04-12 11:00:13.118191
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,6 +1,6 @@
# Query 1: 0 QPS, 0x concurrency, ID 0x82860EDA9A88FCC5 at byte 0 ________
# This item is included in the report because it matches --limit.
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# Scores: V/M = 0.00
# Time range: all events occurred at 2007-10-15 21:43:52
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,6 +1,6 @@
# Query 1: 0.67 QPS, 1x concurrency, ID 0x82860EDA9A88FCC5 at byte 0 _____
# This item is included in the report because it matches --limit.
# Scores: Apdex = NS [0.0]*, V/M = 0.33
# Scores: V/M = 0.33
# Time range: 2007-10-15 21:43:52 to 21:43:55
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,6 +1,6 @@
# Query 1: 1 QPS, 2x concurrency, ID 0x82860EDA9A88FCC5 at byte 0 ________
# This item is included in the report because it matches --limit.
# Scores: Apdex = NS [0.0]*, V/M = 0.30
# Scores: V/M = 0.30
# Time range: 2007-10-15 21:43:52 to 21:43:55
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,5 +1,5 @@
# Item 1: 0 QPS, 0x concurrency, ID 0xEDEF654FCCC4A4D8 at byte 0 _________
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# Scores: V/M = 0.00
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 2

View File

@@ -1,5 +1,5 @@
# Item 1: 0 QPS, 0x concurrency, ID 0xEDEF654FCCC4A4D8 at byte 0 _________
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# Scores: V/M = 0.00
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 3

View File

@@ -1,6 +1,5 @@
# Item 1: 0 QPS, 0x concurrency, ID 0xEDEF654FCCC4A4D8 at byte 0 _________
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# Query_time sparkline: | ^ |
# Scores: V/M = 0.00
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 3

View File

@@ -1,6 +1,5 @@
# Item 1: 0 QPS, 0x concurrency, ID 0xEDEF654FCCC4A4D8 at byte 0 _________
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# Query_time sparkline: | ^ |
# Scores: V/M = 0.00
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 1

View File

@@ -1,5 +1,5 @@
# Query 0: 0 QPS, 0x concurrency, ID 0x82860EDA9A88FCC5 at byte 0 ________
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# Scores: V/M = 0.00
# Time range: all events occurred at 2007-10-15 21:43:52
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,58 +0,0 @@
# Profile
# Rank Query ID Response time Calls R/Call Apdx V/M EXPLAIN Item
# ==== ================== ============= ===== ====== ==== ===== ======= =========
# 1 0x46F81B022F1AD76B 0.0003 100.0% 1 0.0003 NS 0.00 TF>aI SELECT t
# MISC 0xMISC 0.0003 100.0% 1 0.0003 NS 0.0 MISC <1 ITEMS>
# Query 1: 0 QPS, 0x concurrency, ID 0x46F81B022F1AD76B at byte 0 ________
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# EXPLAIN sparkline: TF>aI
# Query_time sparkline: | ^ |
# Time range: all events occurred at 2009-12-08 09:23:49.637394
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 1
# Exec time 100 286us 286us 286us 286us 286us 0 286us
# Query size 100 90 90 90 90 90 0 90
# String:
# cmd Query
# Databases qrf
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `qrf` LIKE 't'\G
# SHOW CREATE TABLE `qrf`.`t`\G
# EXPLAIN /*!50100 PARTITIONS*/
select t1.i from t as t1 join t as t2 where t1.i < t2.i and t1.v is not null order by t1.i\G
# *************************** 1. row ***************************
# id: 1
# select_type: SIMPLE
# table: t1
# partitions: NULL
# type: ALL
# possible_keys: PRIMARY
# key: NULL
# key_len: NULL
# ref: NULL
# rows: 4
# Extra: Using where; Using temporary; Using filesort
# *************************** 2. row ***************************
# id: 1
# select_type: SIMPLE
# table: t2
# partitions: NULL
# type: index
# possible_keys: PRIMARY
# key: PRIMARY
# key_len: 4
# ref: NULL
# rows: 4
# Extra: Using where; Using index; Using join buffer

View File

@@ -1,6 +1,6 @@
# Query 1: 0 QPS, 0x concurrency, ID 0xFDE00DF974C61E9F at byte 0 ________
# This item is included in the report because it matches --limit.
# Scores: Apdex = 0.62 [1.0]*, V/M = 17.71
# Scores: V/M = 17.71
# Query_time sparkline: |^^ ^^|
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======

View File

@@ -1,56 +0,0 @@
# Profile
# Rank Query ID Response time Calls R/Call Apdx V/M EXPLAIN Item
# ==== ================== ============= ===== ====== ==== ===== ======= =========
# 1 0x46F81B022F1AD76B 0.0003 100.0% 1 0.0003 NS 0.00 TF>aI SELECT t
# MISC 0xMISC 0.0003 100.0% 1 0.0003 NS 0.0 MISC <1 ITEMS>
# Query 1: 0 QPS, 0x concurrency, ID 0x46F81B022F1AD76B at byte 0 ________
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# EXPLAIN sparkline: TF>aI
# Query_time sparkline: | ^ |
# Time range: all events occurred at 2009-12-08 09:23:49.637394
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 1
# Exec time 100 286us 286us 286us 286us 286us 0 286us
# Query size 100 90 90 90 90 90 0 90
# String:
# cmd Query
# Databases qrf
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `qrf` LIKE 't'\G
# SHOW CREATE TABLE `qrf`.`t`\G
# EXPLAIN /*!50100 PARTITIONS*/
select t1.i from t as t1 join t as t2 where t1.i < t2.i and t1.v is not null order by t1.i\G
# *************************** 1. row ***************************
# id: 1
# select_type: SIMPLE
# table: t1
# type: ALL
# possible_keys: PRIMARY
# key: NULL
# key_len: NULL
# ref: NULL
# rows: 4
# Extra: Using where; Using temporary; Using filesort
# *************************** 2. row ***************************
# id: 1
# select_type: SIMPLE
# table: t2
# type: index
# possible_keys: PRIMARY
# key: PRIMARY
# key_len: 4
# ref: NULL
# rows: 4
# Extra: Using where; Using index

View File

@@ -1,58 +0,0 @@
# Profile
# Rank Query ID Response time Calls R/Call Apdx V/M EXPLAIN Item
# ==== ================== ============= ===== ====== ==== ===== ======= =========
# 1 0x46F81B022F1AD76B 0.0003 100.0% 1 0.0003 NS 0.00 ia SELECT t
# MISC 0xMISC 0.0003 100.0% 1 0.0003 NS 0.0 MISC <1 ITEMS>
# Query 1: 0 QPS, 0x concurrency, ID 0x46F81B022F1AD76B at byte 0 ________
# Scores: Apdex = NS [0.0]*, V/M = 0.00
# EXPLAIN sparkline: ia
# Query_time sparkline: | ^ |
# Time range: all events occurred at 2009-12-08 09:23:49.637394
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 1
# Exec time 100 286us 286us 286us 286us 286us 0 286us
# Query size 100 90 90 90 90 90 0 90
# String:
# cmd Query
# Databases qrf
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `qrf` LIKE 't'\G
# SHOW CREATE TABLE `qrf`.`t`\G
# EXPLAIN /*!50100 PARTITIONS*/
select t1.i from t as t1 join t as t2 where t1.i < t2.i and t1.v is not null order by t1.i\G
# *************************** 1. row ***************************
# id: 1
# select_type: SIMPLE
# table: t1
# partitions: NULL
# type: index
# possible_keys: PRIMARY
# key: PRIMARY
# key_len: 4
# ref: NULL
# rows: 4
# Extra: Using where
# *************************** 2. row ***************************
# id: 1
# select_type: SIMPLE
# table: t2
# partitions: NULL
# type: ALL
# possible_keys: PRIMARY
# key: NULL
# key_len: NULL
# ref: NULL
# rows: 4
# Extra: Range checked for each record (index map: 0x1)

View File

@@ -0,0 +1,59 @@
2013-01-24 12:55:38.276006 IP 127.0.0.1.62133 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0040 b290 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2b5 3039 58cf 8e7c 0000 0000
0x0020: b002 ffff fe34 0000 0204 3fd8 0103 0303
0x0030: 0101 080a 0580 fe1f 0000 0000 0402 0000
2013-01-24 12:55:38.276053 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 0
0x0000: 4500 0040 65de 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2b5 1c49 dad0 58cf 8e7d
0x0020: b012 ffff fe34 0000 0204 3fd8 0103 0303
0x0030: 0101 080a 0580 fe1f 0580 fe1f 0402 0000
2013-01-24 12:55:38.276062 IP 127.0.0.1.62133 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0034 2fb2 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2b5 3039 58cf 8e7d 1c49 dad1
0x0020: 8010 ffff fe28 0000 0101 080a 0580 fe1f
0x0030: 0580 fe1f
2013-01-24 12:55:38.276071 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 0
0x0000: 4500 0034 4cba 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2b5 1c49 dad1 58cf 8e7d
0x0020: 8010 ffff fe28 0000 0101 080a 0580 fe1f
0x0030: 0580 fe1f
2013-01-24 12:55:38.278813 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 60
0x0000: 4508 0070 e5f9 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2b5 1c49 dad1 58cf 8e7d
0x0020: 8018 ffff fe64 0000 0101 080a 0580 fe1f
0x0030: 0580 fe1f 3800 0000 0a35 2e31 2e35 332d
0x0040: 6c6f 6700 1800 0000 6553 5179 332d 2925
0x0050: 00ff f708 0200 0000 0000 0000 0000 0000
0x0060: 0000 007b 6154 5f62 4d3d 274a 2269 6900
2013-01-24 12:55:38.278831 IP 127.0.0.1.62133 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0034 0cb3 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2b5 3039 58cf 8e7d 1c49 db0d
0x0020: 8010 ffff fe28 0000 0101 080a 0580 fe1f
0x0030: 0580 fe1f
2013-01-24 12:55:48.274417 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 0
0x0000: 4508 0034 5ba9 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2b5 1c49 db0d 58cf 8e7d
0x0020: 8011 ffff fe28 0000 0101 080a 0580 fe83
0x0030: 0580 fe1f
2013-01-24 12:55:48.274515 IP 127.0.0.1.62133 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0034 4493 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2b5 3039 58cf 8e7d 1c49 db0e
0x0020: 8010 ffff fe28 0000 0101 080a 0580 fe83
0x0030: 0580 fe83
2013-01-24 12:55:48.274541 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 0
0x0000: 4508 0034 cfea 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2b5 1c49 db0e 58cf 8e7d
0x0020: 8010 ffff fe28 0000 0101 080a 0580 fe83
0x0030: 0580 fe83
2013-01-24 12:55:48.274741 IP 127.0.0.1.62133 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0034 6e98 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2b5 3039 58cf 8e7d 1c49 db0e
0x0020: 8011 ffff fe28 0000 0101 080a 0580 fe83
0x0030: 0580 fe83
2013-01-24 12:55:48.274836 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 0
0x0000: 4508 0034 bcc4 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2b5 1c49 db0e 58cf 8e7e
0x0020: 8010 fffe fe28 0000 0101 080a 0580 fe83
0x0030: 0580 fe83

View File

@@ -0,0 +1,82 @@
2013-01-24 13:03:25.136681 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0040 ea0e 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2d0 3039 ad71 3d49 0000 0000
0x0020: b002 ffff fe34 0000 0204 3fd8 0103 0303
0x0030: 0101 080a 0581 1055 0000 0000 0402 0000
2013-01-24 13:03:25.136728 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
0x0000: 4500 0040 dc6f 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2d0 7d01 6881 ad71 3d4a
0x0020: b012 ffff fe34 0000 0204 3fd8 0103 0303
0x0030: 0101 080a 0581 1055 0581 1055 0402 0000
2013-01-24 13:03:25.136737 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0034 0e53 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2d0 3039 ad71 3d4a 7d01 6882
0x0020: 8010 ffff fe28 0000 0101 080a 0581 1055
0x0030: 0581 1055
2013-01-24 13:03:25.136746 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
0x0000: 4500 0034 f54e 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2d0 7d01 6882 ad71 3d4a
0x0020: 8010 ffff fe28 0000 0101 080a 0581 1055
0x0030: 0581 1055
2013-01-24 13:03:25.146062 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 60
0x0000: 4508 0070 6334 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2d0 7d01 6882 ad71 3d4a
0x0020: 8018 ffff fe64 0000 0101 080a 0581 1055
0x0030: 0581 1055 3800 0000 0a35 2e31 2e35 332d
0x0040: 6c6f 6700 1b00 0000 4d34 5946 3267 3260
0x0050: 00ff f708 0200 0000 0000 0000 0000 0000
0x0060: 0000 006c 225e 3633 3a6c 3048 5863 6800
2013-01-24 13:03:25.146080 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0034 3e79 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2d0 3039 ad71 3d4a 7d01 68be
0x0020: 8010 ffff fe28 0000 0101 080a 0581 1055
0x0030: 0581 1055
2013-01-24 13:03:28.672802 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 15
0x0000: 4510 0043 145a 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2d0 3039 ad71 3d4a 7d01 68be
0x0020: 8018 ffff fe37 0000 0101 080a 0581 1079
0x0030: 0581 1055 6865 6c6c 6f2c 2077 6f72 6c64
0x0040: 210d 0a
2013-01-24 13:03:28.672856 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
0x0000: 4508 0034 b07b 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2d0 7d01 68be ad71 3d59
0x0020: 8010 ffff fe28 0000 0101 080a 0581 1079
0x0030: 0581 1079
2013-01-24 13:03:28.672987 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 31
0x0000: 4508 0053 6336 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2d0 7d01 68be ad71 3d59
0x0020: 8018 ffff fe47 0000 0101 080a 0581 1079
0x0030: 0581 1079 1b00 0001 ff84 0447 6f74 2070
0x0040: 6163 6b65 7473 206f 7574 206f 6620 6f72
0x0050: 6465 72
2013-01-24 13:03:28.673017 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0034 fb76 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2d0 3039 ad71 3d59 7d01 68dd
0x0020: 8010 ffff fe28 0000 0101 080a 0581 1079
0x0030: 0581 1079
2013-01-24 13:03:28.673103 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
0x0000: 4508 0034 ae21 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2d0 7d01 68dd ad71 3d59
0x0020: 8011 ffff fe28 0000 0101 080a 0581 1079
0x0030: 0581 1079
2013-01-24 13:03:28.673139 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0034 d821 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2d0 3039 ad71 3d59 7d01 68de
0x0020: 8010 ffff fe28 0000 0101 080a 0581 1079
0x0030: 0581 1079
2013-01-24 13:03:28.673156 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
0x0000: 4508 0034 ab2e 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2d0 7d01 68de ad71 3d59
0x0020: 8010 ffff fe28 0000 0101 080a 0581 1079
0x0030: 0581 1079
2013-01-24 13:03:28.673444 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
0x0000: 4510 0034 e03d 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 f2d0 3039 ad71 3d59 7d01 68de
0x0020: 8011 ffff fe28 0000 0101 080a 0581 1079
0x0030: 0581 1079
2013-01-24 13:03:28.673464 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
0x0000: 4508 0034 b22d 4000 4006 0000 7f00 0001
0x0010: 7f00 0001 3039 f2d0 7d01 68de ad71 3d5a
0x0020: 8010 fffe fe28 0000 0101 080a 0581 1079
0x0030: 0581 1079

View File

@@ -0,0 +1,70 @@
2013-01-22 09:55:53.973868 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
0x0000: 4510 003c bbae 4000 4006 f033 0a1c bd48
0x0010: 0a1c bd49 ad90 0cea af89 ab81 0000 0000
0x0020: a002 16d0 f7a5 0000 0204 05b4 0402 080a
0x0030: 850b 102f 0000 0000 0103 0307
2013-01-22 09:55:53.973885 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
0x0000: 4500 003c 0000 4000 4006 abf2 0a1c bd49
0x0010: 0a1c bd48 0cea ad90 bcdd 5ddd af89 ab82
0x0020: a012 16a0 e720 0000 0204 05b4 0402 080a
0x0030: 7a96 7b52 850b 102f 0103 0307
2013-01-22 09:55:53.973886 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
0x0000: 4500 003c 0000 4000 4006 abf2 0a1c bd49
0x0010: 0a1c bd48 0cea ad90 bcdd 5ddd af89 ab82
0x0020: a012 16a0 e720 0000 0204 05b4 0402 080a
0x0030: 7a96 7b52 850b 102f 0103 0307
2013-01-22 09:55:53.973929 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
0x0000: 4510 0034 bbaf 4000 4006 f03a 0a1c bd48
0x0010: 0a1c bd49 ad90 0cea af89 ab82 bcdd 5dde
0x0020: 8010 002e 2c5f 0000 0101 080a 850b 102f
0x0030: 7a96 7b52
2013-01-22 09:55:53.974017 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 113
0x0000: 4508 00a5 268c 4000 4006 84f5 0a1c bd49
0x0010: 0a1c bd48 0cea ad90 bcdd 5dde af89 ab82
0x0020: 8018 002e 8f61 0000 0101 080a 7a96 7b52
0x0030: 850b 102f 6d00 0000 0a35 2e35 2e32 382d
0x0040: 656e 7465 7270 7269 7365 2d63 6f6d 6d65
0x0050: 7263 6961 6c2d 6164 7661 6e63 6564 2d6c
0x0060: 6f67 000d 0000 006c 706d 5338 5d4a 3c00
0x0070: fff7 0802 000f 8015 0000 0000 0000 0000
0x0080: 0000 2f72 7265 247e 7347 4565 4f3c 006d
0x0090: 7973 716c 5f6e 6174 6976 655f 7061 7373
0x00a0: 776f 7264 00
2013-01-22 09:55:53.974019 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 113
0x0000: 4508 00a5 268c 4000 4006 84f5 0a1c bd49
0x0010: 0a1c bd48 0cea ad90 bcdd 5dde af89 ab82
0x0020: 8018 002e 8f61 0000 0101 080a 7a96 7b52
0x0030: 850b 102f 6d00 0000 0a35 2e35 2e32 382d
0x0040: 656e 7465 7270 7269 7365 2d63 6f6d 6d65
0x0050: 7263 6961 6c2d 6164 7661 6e63 6564 2d6c
0x0060: 6f67 000d 0000 006c 706d 5338 5d4a 3c00
0x0070: fff7 0802 000f 8015 0000 0000 0000 0000
0x0080: 0000 2f72 7265 247e 7347 4565 4f3c 006d
0x0090: 7973 716c 5f6e 6174 6976 655f 7061 7373
0x00a0: 776f 7264 00
2013-01-22 09:55:53.974064 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
0x0000: 4510 0034 bbb0 4000 4006 f039 0a1c bd48
0x0010: 0a1c bd49 ad90 0cea af89 ab82 bcdd 5e4f
0x0020: 8010 002e 2bee 0000 0101 080a 850b 102f
0x0030: 7a96 7b52
2013-01-22 09:55:57.793375 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
0x0000: 4510 0034 bbb1 4000 4006 f038 0a1c bd48
0x0010: 0a1c bd49 ad90 0cea af89 ab82 bcdd 5e4f
0x0020: 8011 002e 1d02 0000 0101 080a 850b 1f1a
0x0030: 7a96 7b52
2013-01-22 09:55:57.793485 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
0x0000: 4508 0034 268d 4000 4006 8565 0a1c bd49
0x0010: 0a1c bd48 0cea ad90 bcdd 5e4f af89 ab83
0x0020: 8011 002e 0e16 0000 0101 080a 7a96 8a3d
0x0030: 850b 1f1a
2013-01-22 09:55:57.793489 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
0x0000: 4508 0034 268d 4000 4006 8565 0a1c bd49
0x0010: 0a1c bd48 0cea ad90 bcdd 5e4f af89 ab83
0x0020: 8011 002e 0e16 0000 0101 080a 7a96 8a3d
0x0030: 850b 1f1a
2013-01-22 09:55:57.793529 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
0x0000: 4510 0034 bbb2 4000 4006 f037 0a1c bd48
0x0010: 0a1c bd49 ad90 0cea af89 ab83 bcdd 5e50
0x0020: 8010 002e 0e15 0000 0101 080a 850b 1f1b
0x0030: 7a96 8a3d