diff --git a/bin/pt-index-usage b/bin/pt-index-usage index 9ecbcaa8..268036ed 100755 --- a/bin/pt-index-usage +++ b/bin/pt-index-usage @@ -2845,6 +2845,7 @@ sub parse_event { && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o ) ) { PTDEBUG && _d("Got user, host, ip", $user, $host, $ip); + $host ||= $ip; # sometimes host is missing when using skip-name-resolve (LP #issue 1262456) push @properties, 'user', $user, 'host', $host, 'ip', $ip; if ( $thread_id ) { push @properties, 'Thread_id', $thread_id; @@ -2857,6 +2858,7 @@ sub parse_event { && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o ) ) { PTDEBUG && _d("Got user, host, ip", $user, $host, $ip); + $host ||= $ip; # sometimes host is missing when using skip-name-resolve (LP #issue 1262456) push @properties, 'user', $user, 'host', $host, 'ip', $ip; if ( $thread_id ) { push @properties, 'Thread_id', $thread_id; diff --git a/bin/pt-query-digest b/bin/pt-query-digest index dee71494..96b7bb8c 100755 --- a/bin/pt-query-digest +++ b/bin/pt-query-digest @@ -5039,6 +5039,7 @@ sub parse_event { && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o ) ) { PTDEBUG && _d("Got user, host, ip", $user, $host, $ip); + $host ||= $ip; # sometimes host is missing when using skip-name-resolve (LP #issue 1262456) push @properties, 'user', $user, 'host', $host, 'ip', $ip; if ( $thread_id ) { push @properties, 'Thread_id', $thread_id; @@ -5051,6 +5052,7 @@ sub parse_event { && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o ) ) { PTDEBUG && _d("Got user, host, ip", $user, $host, $ip); + $host ||= $ip; # sometimes host is missing when using skip-name-resolve (LP #issue 1262456) push @properties, 'user', $user, 'host', $host, 'ip', $ip; if ( $thread_id ) { push @properties, 'Thread_id', $thread_id; diff --git a/bin/pt-table-usage b/bin/pt-table-usage index 397424e9..f871b54c 100755 --- a/bin/pt-table-usage +++ b/bin/pt-table-usage @@ -1629,6 +1629,7 @@ sub parse_event { && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o ) ) { PTDEBUG && _d("Got user, host, ip", $user, $host, $ip); + $host ||= $ip; # sometimes host is missing when using skip-name-resolve (LP #issue 1262456) push @properties, 'user', $user, 'host', $host, 'ip', $ip; if ( $thread_id ) { push @properties, 'Thread_id', $thread_id; @@ -1641,6 +1642,7 @@ sub parse_event { && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o ) ) { PTDEBUG && _d("Got user, host, ip", $user, $host, $ip); + $host ||= $ip; # sometimes host is missing when using skip-name-resolve (LP #issue 1262456) push @properties, 'user', $user, 'host', $host, 'ip', $ip; if ( $thread_id ) { push @properties, 'Thread_id', $thread_id; diff --git a/bin/pt-upgrade b/bin/pt-upgrade index 69baf7e5..d06b503e 100755 --- a/bin/pt-upgrade +++ b/bin/pt-upgrade @@ -6610,6 +6610,7 @@ sub parse_event { && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o ) ) { PTDEBUG && _d("Got user, host, ip", $user, $host, $ip); + $host ||= $ip; # sometimes host is missing when using skip-name-resolve (LP #issue 1262456) push @properties, 'user', $user, 'host', $host, 'ip', $ip; if ( $thread_id ) { push @properties, 'Thread_id', $thread_id; @@ -6622,6 +6623,7 @@ sub parse_event { && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o ) ) { PTDEBUG && _d("Got user, host, ip", $user, $host, $ip); + $host ||= $ip; # sometimes host is missing when using skip-name-resolve (LP #issue 1262456) push @properties, 'user', $user, 'host', $host, 'ip', $ip; if ( $thread_id ) { push @properties, 'Thread_id', $thread_id; diff --git a/lib/Percona/Test.pm b/lib/Percona/Test.pm index 2d2a952d..e832cc39 100644 --- a/lib/Percona/Test.pm +++ b/lib/Percona/Test.pm @@ -541,7 +541,7 @@ sub no_diff { `cat $expected_output | sed $sed_args > /tmp/pt-test-outfile-trf`; $expected_output = "/tmp/pt-test-outfile-trf"; } - + die("entre"); # Determine cmd type and run it. if ( ref $cmd eq 'CODE' ) { output($cmd, file => $tmp_file); diff --git a/lib/SlowLogParser.pm b/lib/SlowLogParser.pm index e2317ac6..961991d6 100644 --- a/lib/SlowLogParser.pm +++ b/lib/SlowLogParser.pm @@ -162,6 +162,7 @@ sub parse_event { && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o ) ) { PTDEBUG && _d("Got user, host, ip", $user, $host, $ip); + $host ||= $ip; # sometimes host is missing when using skip-name-resolve (LP #issue 1262456) push @properties, 'user', $user, 'host', $host, 'ip', $ip; # 5.6 has the thread id on the User@Host line if ( $thread_id ) { @@ -177,6 +178,7 @@ sub parse_event { && ( my ( $user, $host, $ip, $thread_id ) = $line =~ m/$slow_log_uh_line/o ) ) { PTDEBUG && _d("Got user, host, ip", $user, $host, $ip); + $host ||= $ip; # sometimes host is missing when using skip-name-resolve (LP #issue 1262456) push @properties, 'user', $user, 'host', $host, 'ip', $ip; # 5.6 has the thread id on the User@Host line if ( $thread_id ) { diff --git a/t/lib/SlowLogParser.t b/t/lib/SlowLogParser.t index bdf8ff4b..28fdbb7e 100644 --- a/t/lib/SlowLogParser.t +++ b/t/lib/SlowLogParser.t @@ -587,7 +587,7 @@ test_log_parser( 'ip' => '1.2.3.8', 'arg' => 'administrator command: Quit', 'Thread_id' => '5', - 'host' => '', + 'host' => '1.2.3.8', 'Rows_examined' => '0', 'user' => 'meow', 'Query_time' => '0.000002', @@ -602,7 +602,7 @@ test_log_parser( 'ip' => '1.2.3.8', arg => 'SET NAMES utf8', 'Thread_id' => '6', - 'host' => '', + 'host' => '1.2.3.8', 'Rows_examined' => '0', 'user' => 'meow', 'Query_time' => '0.000899', @@ -616,7 +616,7 @@ test_log_parser( 'arg' => 'SELECT MIN(id),MAX(id) FROM tbl', 'ip' => '1.2.3.8', 'Thread_id' => '6', - 'host' => '', + 'host' => '1.2.3.8', 'Rows_examined' => '0', 'user' => 'meow', 'Query_time' => '0.018799', @@ -664,7 +664,7 @@ test_log_parser( 'arg' => 'administrator command: Quit', 'ip' => '1.2.3.8', 'Thread_id' => '5', - 'host' => '', + 'host' => '1.2.3.8', 'Rows_examined' => '0', 'user' => 'meow', 'Query_time' => '0.000002', @@ -679,7 +679,7 @@ test_log_parser( 'ip' => '1.2.3.8', arg => 'SET NAMES utf8', 'Thread_id' => '6', - 'host' => '', + 'host' => '1.2.3.8', 'Rows_examined' => '0', 'user' => 'meow', 'Query_time' => '0.000899', @@ -694,7 +694,7 @@ test_log_parser( 'arg' => 'administrator command: Quit', 'ip' => '1.2.3.8', 'Thread_id' => '7', - 'host' => '', + 'host' => '1.2.3.8', 'Rows_examined' => '0', 'user' => 'meow', 'Query_time' => '0.018799', @@ -709,7 +709,7 @@ test_log_parser( 'ip' => '1.2.3.8', arg => 'SET NAMES utf8', 'Thread_id' => '9', - 'host' => '', + 'host' => '1.2.3.8', 'Rows_examined' => '0', 'user' => 'meow', 'Query_time' => '0.000899', @@ -731,7 +731,7 @@ test_log_parser( 'arg' => 'SET autocommit=1', 'ip' => '10.1.250.19', 'Thread_id' => '39387', - 'host' => '', + 'host' => '10.1.250.19', 'Rows_examined' => '0', 'user' => 'sabapp', 'Query_time' => '0.000018', @@ -745,7 +745,7 @@ test_log_parser( 'arg' => 'SET autocommit=1', 'ip' => '10.1.250.19', 'Thread_id' => '39387', - 'host' => '', + 'host' => '10.1.250.19', 'Rows_examined' => '0', 'user' => 'sabapp', 'Query_time' => '0.000018', @@ -769,7 +769,7 @@ test_log_parser( 'arg' => 'SET autocommit=1', 'ip' => '10.1.250.19', 'Thread_id' => '39796', - 'host' => '', + 'host' => '10.1.250.19', 'pos_in_log' => '0', 'Rows_examined' => '0', 'user' => 'foo_app', @@ -785,7 +785,7 @@ test_log_parser( 'ip' => '10.1.12.201', 'ts' => '081127 8:51:20', 'Thread_id' => '39947', - 'host' => '', + 'host' => '10.1.12.201', 'pos_in_log' => '174', 'Rows_examined' => '226', 'Query_time' => '0.149435', @@ -800,7 +800,7 @@ test_log_parser( 'ip' => '10.1.12.201', 'ts' => '081127 8:51:21', 'Thread_id' => '39947', - 'host' => '', + 'host' => '10.1.12.201', 'pos_in_log' => '385', 'Rows_examined' => '0', 'Query_time' => '0.000005', @@ -815,7 +815,7 @@ test_log_parser( 'arg' => 'SET autocommit=0', 'ip' => '10.1.250.19', 'Thread_id' => '39796', - 'host' => '', + 'host' => '10.1.250.19', 'pos_in_log' => '600', 'Rows_examined' => '0', 'user' => 'foo_app', @@ -829,7 +829,7 @@ test_log_parser( 'arg' => 'commit', 'ip' => '10.1.250.19', 'Thread_id' => '39796', - 'host' => '', + 'host' => '10.1.250.19', 'pos_in_log' => '782', 'Rows_examined' => '0', 'user' => 'foo_app', @@ -965,7 +965,7 @@ test_log_parser( Thread_id => '5', arg => 'administrator command: Quit', cmd => 'Admin', - host => '', + host => '1.2.3.8', ip => '1.2.3.8', pos_in_log => '0', user => 'meow', @@ -980,7 +980,7 @@ test_log_parser( arg => 'SET NAMES utf8', cmd => 'Query', db => 'db', - host => '', + host => '1.2.3.8', ip => '1.2.3.8', pos_in_log => '221', user => 'meow', @@ -995,7 +995,7 @@ test_log_parser( arg => 'administrator command: Quit', cmd => 'Admin', db => 'db2', - host => '', + host => '1.2.3.8', ip => '1.2.3.8', pos_in_log => '435', user => 'meow', @@ -1184,7 +1184,7 @@ test_log_parser( arg => 'SELECT missing_a_schema_above from crash_me', bytes => 43, cmd => 'Query', - host => '', + host => '10.1.12.30', ip => '10.1.12.30', pos_in_log => '0', ts => '081126 13:08:25', @@ -1319,7 +1319,7 @@ test_log_parser( Last_errno => 0, Killed => 0, db => 'test_db', - host => '', + host => '127.0.0.1', Schema => 'test_db', ip => '127.0.0.1', timestamp => '1111111111', @@ -1340,7 +1340,7 @@ test_log_parser( arg => 'update t set b = b + 30 where user_id=1', bytes => 39, cmd => 'Query', - host => '', + host => '127.0.0.1', ip => '127.0.0.1', pos_in_log => 596, timestamp => '2222222222', diff --git a/t/pt-query-digest/samples/slow008_report.txt b/t/pt-query-digest/samples/slow008_report.txt index f4bb7458..f808c527 100644 --- a/t/pt-query-digest/samples/slow008_report.txt +++ b/t/pt-query-digest/samples/slow008_report.txt @@ -12,7 +12,7 @@ # Query size 43 31 31 31 31 31 0 31 # String: # Databases db2 -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us @@ -42,7 +42,7 @@ SELECT MIN(id),MAX(id) FROM tbl\G # Query size 19 14 14 14 14 14 0 14 # String: # Databases db -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us @@ -68,7 +68,7 @@ SET NAMES utf8\G # Query size 37 27 27 27 27 27 0 27 # String: # Databases db1 -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us ################################################################ diff --git a/t/pt-query-digest/samples/slow011_report.txt b/t/pt-query-digest/samples/slow011_report.txt index d624a280..559773a7 100644 --- a/t/pt-query-digest/samples/slow011_report.txt +++ b/t/pt-query-digest/samples/slow011_report.txt @@ -12,7 +12,7 @@ # Query size 65 54 27 27 27 27 0 27 # String: # Databases db1 (1/50%), db2 (1/50%) -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us ################################################################ @@ -38,7 +38,7 @@ administrator command: Quit\G # Query size 34 28 14 14 14 14 0 14 # String: # Databases db -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us diff --git a/t/pt-query-digest/samples/slow013_report.txt b/t/pt-query-digest/samples/slow013_report.txt index 3e8d479b..a715cf4d 100644 --- a/t/pt-query-digest/samples/slow013_report.txt +++ b/t/pt-query-digest/samples/slow013_report.txt @@ -13,7 +13,7 @@ # Query size 14 11 11 11 11 11 0 11 # String: # Databases test -# Hosts +# Hosts 10.1.12.201 # Users mytopuser # Query_time distribution # 1us @@ -40,7 +40,7 @@ SHOW STATUS\G # Query size 42 32 16 16 16 16 0 16 # String: # Databases abc -# Hosts +# Hosts 10.1.250.19 # Users foo_app # Query_time distribution # 1us @@ -67,7 +67,7 @@ SET autocommit=0\G # Query size 7 6 6 6 6 6 0 6 # String: # Databases abc -# Hosts +# Hosts 10.1.250.19 # Users foo_app # Query_time distribution # 1us @@ -94,7 +94,7 @@ commit\G # Query size 35 27 27 27 27 27 0 27 # String: # Databases test -# Hosts +# Hosts 10.1.12.201 # Users mytopuser # Query_time distribution # 1us ################################################################ diff --git a/t/pt-query-digest/samples/slow013_report_fingerprint_user.txt b/t/pt-query-digest/samples/slow013_report_fingerprint_user.txt index 9ba33aec..a3901b26 100644 --- a/t/pt-query-digest/samples/slow013_report_fingerprint_user.txt +++ b/t/pt-query-digest/samples/slow013_report_fingerprint_user.txt @@ -27,7 +27,7 @@ # Query size 14 11 11 11 11 11 0 11 # String: # Databases test -# Hosts +# Hosts 10.1.12.201 # Users mytopuser # Query_time distribution # 1us @@ -58,7 +58,7 @@ SHOW STATUS\G # Query size 50 38 11 27 19 27 11.31 19 # String: # Databases test -# Hosts +# Hosts 10.1.12.201 # Query_time distribution # 1us ################################################################ # 10us diff --git a/t/pt-query-digest/samples/slow013_report_limit.txt b/t/pt-query-digest/samples/slow013_report_limit.txt index d465694e..40ea090f 100644 --- a/t/pt-query-digest/samples/slow013_report_limit.txt +++ b/t/pt-query-digest/samples/slow013_report_limit.txt @@ -13,7 +13,7 @@ # Query size 14 11 11 11 11 11 0 11 # String: # Databases test -# Hosts +# Hosts 10.1.12.201 # Users mytopuser # Query_time distribution # 1us diff --git a/t/pt-query-digest/samples/slow013_report_outliers.txt b/t/pt-query-digest/samples/slow013_report_outliers.txt index 6b60ddc0..c7195603 100644 --- a/t/pt-query-digest/samples/slow013_report_outliers.txt +++ b/t/pt-query-digest/samples/slow013_report_outliers.txt @@ -17,7 +17,7 @@ # Query size 50 38 11 27 19 27 11.31 19 # String: # Databases test -# Hosts +# Hosts 10.1.12.201 # Query_time distribution # 1us ################################################################ # 10us @@ -43,7 +43,7 @@ mytopuser # Query size 50 38 6 16 12.67 15.25 4.48 15.25 # String: # Databases abc -# Hosts +# Hosts 10.1.250.19 # Query_time distribution # 1us # 10us ################################################################ diff --git a/t/pt-query-digest/samples/slow013_report_user.txt b/t/pt-query-digest/samples/slow013_report_user.txt index 1428d2c5..c4682c67 100644 --- a/t/pt-query-digest/samples/slow013_report_user.txt +++ b/t/pt-query-digest/samples/slow013_report_user.txt @@ -17,7 +17,7 @@ # Query size 50 38 11 27 19 27 11.31 19 # String: # Databases test -# Hosts +# Hosts 10.1.12.201 # Query_time distribution # 1us ################################################################ # 10us @@ -43,7 +43,7 @@ mytopuser # Query size 50 38 6 16 12.67 15.25 4.48 15.25 # String: # Databases abc -# Hosts +# Hosts 10.1.250.19 # Query_time distribution # 1us # 10us ################################################################ diff --git a/t/pt-query-digest/samples/slow019_report.txt b/t/pt-query-digest/samples/slow019_report.txt index 2ae61093..7e73764e 100644 --- a/t/pt-query-digest/samples/slow019_report.txt +++ b/t/pt-query-digest/samples/slow019_report.txt @@ -12,7 +12,7 @@ # Query size 79 54 27 27 27 27 0 27 # String: # Databases db1 (1/50%), db2 (1/50%) -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us ################################################################ @@ -38,7 +38,7 @@ administrator command: Quit\G # Query size 20 14 14 14 14 14 0 14 # String: # Databases db -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us diff --git a/t/pt-query-digest/samples/slow055.txt b/t/pt-query-digest/samples/slow055.txt index c834e436..77e09c43 100644 --- a/t/pt-query-digest/samples/slow055.txt +++ b/t/pt-query-digest/samples/slow055.txt @@ -15,7 +15,7 @@ # Rows examine 0 0 0 0 0 0 0 0 # Query size 100 72 14 31 24 30.19 6.95 26.08 # String: -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us ################################################################ diff --git a/t/pt-query-digest/samples/slow056.txt b/t/pt-query-digest/samples/slow056.txt index a265aa1f..aa48795e 100644 --- a/t/pt-query-digest/samples/slow056.txt +++ b/t/pt-query-digest/samples/slow056.txt @@ -15,7 +15,7 @@ # Query size 100 39 39 39 39 39 0 39 # String: # Databases test_db -# Hosts +# Hosts 127.0.0.1 # Last errno 0 # Users root # Query_time distribution @@ -51,7 +51,7 @@ select b = b + 30 from t where user_id=1\G # Query size 0 0 0 0 0 0 0 0 # String: # Databases test_db -# Hosts +# Hosts 127.0.0.1 # Last errno 0 # Users root # Query_time distribution diff --git a/t/pt-query-digest/samples/slow057.txt b/t/pt-query-digest/samples/slow057.txt index 0adba5e6..04b7ccba 100644 --- a/t/pt-query-digest/samples/slow057.txt +++ b/t/pt-query-digest/samples/slow057.txt @@ -15,7 +15,7 @@ # Rows examine 0 0 0 0 0 0 0 0 # Query size 100 82 14 27 20.50 26.08 6.12 26.08 # String: -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us ################################ diff --git a/t/pt-query-digest/samples/slow058.txt b/t/pt-query-digest/samples/slow058.txt index 0022c77e..2b167b55 100644 --- a/t/pt-query-digest/samples/slow058.txt +++ b/t/pt-query-digest/samples/slow058.txt @@ -12,7 +12,7 @@ # Query size 24 52 26 26 26 26 0 26 # String: # Databases db -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us @@ -41,7 +41,7 @@ insert `foo` values("bar")\G # Query size 25 54 27 27 27 27 0 27 # String: # Databases db -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us @@ -70,7 +70,7 @@ replace `foo` values("bar")\G # Query size 50 108 54 54 54 54 0 54 # String: # Databases db -# Hosts +# Hosts 1.2.3.8 # Users meow # Query_time distribution # 1us ################################################################