~percona-toolkit-dev/percona-toolkit/pt-table-sync-binlog-format-only-if-not-statement

« back to all changes in this revision

Viewing changes to t/pt-deadlock-logger/bugs.t

  • Committer: fraserb at gmail
  • Date: 2012-05-30 17:37:59 UTC
  • mfrom: (268.1.2 fix-903443)
  • Revision ID: fraserb@gmail.com-20120530173759-1203wt7lf3jnmyo2
Merged ~percona-toolkit-dev/percona-toolkit/fix-903443 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env perl
 
2
 
 
3
BEGIN {
 
4
   die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
 
5
      unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
 
6
   unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
 
7
};
 
8
 
 
9
use strict;
 
10
use warnings FATAL => 'all';
 
11
use English qw(-no_match_vars);
 
12
use Test::More tests => 1;
 
13
 
 
14
use PerconaTest;
 
15
use Sandbox;
 
16
require "$trunk/bin/pt-deadlock-logger";
 
17
 
 
18
# #############################################################################
 
19
# https://bugs.launchpad.net/percona-toolkit/+bug/903443
 
20
# pt-deadlock-logger crashes on MySQL 5.5
 
21
# #############################################################################
 
22
 
 
23
my $innodb_status_sample = load_file("t/pt-deadlock-logger/samples/bug_903443.txt");
 
24
 
 
25
is_deeply(
 
26
   pt_deadlock_logger::parse_deadlocks($innodb_status_sample),
 
27
   {
 
28
      '1' => {
 
29
          db => '',
 
30
          hostname => 'localhost',
 
31
          id => 1,
 
32
          idx => '',
 
33
          ip => '',
 
34
          lock_mode => '',
 
35
          lock_type => '',
 
36
          query => 'update a set movie_id=96 where id =2',
 
37
          server => '',
 
38
          tbl => '',
 
39
          thread => '19',
 
40
          ts => '2011-12-12T22:52:42',
 
41
          txn_id => 0,
 
42
          txn_time => '161',
 
43
          user => 'root',
 
44
          victim => 0,
 
45
          wait_hold => 'w'
 
46
      },
 
47
      '2' => {
 
48
          db => '',
 
49
          hostname => 'localhost',
 
50
          id => 2,
 
51
          idx => '',
 
52
          ip => '',
 
53
          lock_mode => '',
 
54
          lock_type => '',
 
55
          query => 'update a set movie_id=98 where id =4',
 
56
          server => '',
 
57
          tbl => '',
 
58
          thread => '18',
 
59
          ts => '2011-12-12T22:52:42',
 
60
          txn_id => 0,
 
61
          txn_time => '1026',
 
62
          user => 'root',
 
63
          victim => 1,
 
64
          wait_hold => 'w'
 
65
      }
 
66
   },
 
67
   "Bug 903443: pt-deadlock-logger parses the thread id incorrectly for MySQL 5.5",
 
68
);
 
69
 
 
70
# #############################################################################
 
71
# Done.
 
72
# #############################################################################
 
73
exit;