Merge lp:~percona-toolkit-dev/percona-toolkit/pt-deadlock-logger-logs-incorrect-ts-1295667 into lp:~percona-toolkit-dev/percona-toolkit/release-2.2.8

Proposed by Daniel Nichter on 2014-05-30
Status: Merged
Approved by: Daniel Nichter on 2014-05-30
Approved revision: 601
Merged at revision: 604
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/pt-deadlock-logger-logs-incorrect-ts-1295667
Merge into: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.8
Diff against target: 40 lines (+16/-1)
1 file modified
bin/pt-deadlock-logger (+16/-1)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/pt-deadlock-logger-logs-incorrect-ts-1295667
Reviewer Review Type Date Requested Status
Daniel Nichter Approve on 2014-05-30
Review via email: mp+221474@code.launchpad.net
To post a comment you must log in.
600. By Daniel Nichter on 2014-05-30

Add DEFAULT CURRENT_TIMESTAMP to deadlocks table to prevent ON UPDATE DEFAULT CURRENT_TIMESTAMP.

601. By Daniel Nichter on 2014-05-30

Add trailing comma.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pt-deadlock-logger'
2--- bin/pt-deadlock-logger 2014-02-20 08:10:16 +0000
3+++ bin/pt-deadlock-logger 2014-05-30 00:44:48 +0000
4@@ -4440,12 +4440,27 @@
5
6 my $dst;
7 if ( my $dst_dsn = $o->get('dest') ) {
8+
9+ # set time_zone = SYSTEM , addresses https://bugs.launchpad.net/percona-toolkit/+bug/1295667
10+ my $set_tz = sub {
11+ my ($dbh) = @_;
12+ my $sql = "SET time_zone=SYSTEM /* pt-deadlock-logger */";
13+ eval {
14+ PTDEBUG && _d($dbh, $sql);
15+ $dbh->do($sql);
16+ };
17+ if ( $EVAL_ERROR ) {
18+ die "Failed to $sql: $EVAL_ERROR\n";
19+ }
20+ };
21+
22 $dst = Cxn->new(
23 dsn => $dst_dsn,
24 prev_dsn => ($src ? $src->dsn : undef),
25 parent => $o->get('daemonize'),
26 DSNParser => $dp,
27 OptionParser => $o,
28+ set => $set_tz,
29 );
30 }
31
32@@ -5199,7 +5214,7 @@
33
34 CREATE TABLE deadlocks (
35 server char(20) NOT NULL,
36- ts datetime NOT NULL,
37+ ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
38 thread int unsigned NOT NULL,
39 txn_id bigint unsigned NOT NULL,
40 txn_time smallint unsigned NOT NULL,

Subscribers

People subscribed via source and target branches

to all changes: