diff --git a/bin/pt-config-diff b/bin/pt-config-diff index a6358afd..9c619646 100755 --- a/bin/pt-config-diff +++ b/bin/pt-config-diff @@ -3701,6 +3701,10 @@ sub _normalize_value { $val = defined $val ? $val : ''; $val = $alt_val_for{$val} if exists $alt_val_for{$val}; + if ( $val =~ m/,/ && !$is_dir && !$base_path) { + $val = join(',', sort(split(',', $val))); + } + if ( $val ) { if ( $is_dir ) { $val .= '/' unless $val =~ m/\/$/; diff --git a/lib/MySQLConfigComparer.pm b/lib/MySQLConfigComparer.pm index a09aefd7..114297b1 100644 --- a/lib/MySQLConfigComparer.pm +++ b/lib/MySQLConfigComparer.pm @@ -295,6 +295,10 @@ sub _normalize_value { $val = defined $val ? $val : ''; $val = $alt_val_for{$val} if exists $alt_val_for{$val}; + if ( $val =~ m/,/ && !$is_dir && !$base_path) { + $val = join(',', sort(split(',', $val))); + } + if ( $val ) { if ( $is_dir ) { $val .= '/' unless $val =~ m/\/$/; diff --git a/t/lib/MySQLConfigComparer.t b/t/lib/MySQLConfigComparer.t index 3977fd44..5ad852f3 100644 --- a/t/lib/MySQLConfigComparer.t +++ b/t/lib/MySQLConfigComparer.t @@ -369,6 +369,30 @@ $c2 = new MySQLConfig( ) or print Dumper($diff); } +# ############################################################################ +# PS-2015 pt-config-diff doesn't diff ordered flags +# ############################################################################ +$c1 = new MySQLConfig( + result_set => [['log_slow_verbosity', 'innodb,microtime']], + format => 'show_variables', +); +$c2 = new MySQLConfig( + result_set => [['log_slow_verbosity', 'microtime,innodb']], + format => 'show_variables', +); + +{ + $diff = $cc->diff( + configs => [$c1, $c2], + ); + + is_deeply( + $diff, + undef, + "Values are same regardless of order" + ) or diag(Dumper($diff)); +} + # ############################################################################ # https://bugs.launchpad.net/percona-toolkit/+bug/889739 # pt-config-diff doesn't diff quoted strings properly