mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 10:36:28 +00:00
PT-1570 pt-archiver fails to detect columns with the word GENERATED as part of the comment
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
Changelog for Percona Toolkit
|
Changelog for Percona Toolkit
|
||||||
|
|
||||||
|
* Fixed bug PT-1570 : pt-archiver fails to detect columns with the word GENERATED as part of the comment
|
||||||
* Fixed bug PT-1563 : Fixed pt-show-grants for MySQL 5.6
|
* Fixed bug PT-1563 : Fixed pt-show-grants for MySQL 5.6
|
||||||
* Improvement PT-1562 : pt-mysql-summary: Fix mysqld command for Travis
|
* Improvement PT-1562 : pt-mysql-summary: Fix mysqld command for Travis
|
||||||
* Improvement PT-242 : (pt-stalk) Include SHOW SLAVE STATUS on 5.7 (Thanks Marcelo Altmann)
|
* Improvement PT-242 : (pt-stalk) Include SHOW SLAVE STATUS on 5.7 (Thanks Marcelo Altmann)
|
||||||
|
@@ -6240,6 +6240,11 @@ sub main {
|
|||||||
. "$src->{db_tbl} does not have a PRIMARY KEY";
|
. "$src->{db_tbl} does not have a PRIMARY KEY";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
warn "====================================================================================================";
|
||||||
|
warn Data::Dumper::Dumper($src);
|
||||||
|
warn "====================================================================================================";
|
||||||
|
warn Data::Dumper::Dumper($dst);
|
||||||
|
warn "====================================================================================================";
|
||||||
if ( $dst && $o->get('check-columns') ) {
|
if ( $dst && $o->get('check-columns') ) {
|
||||||
my @not_in_src = grep {
|
my @not_in_src = grep {
|
||||||
!$src->{info}->{is_col}->{$_}
|
!$src->{info}->{is_col}->{$_}
|
||||||
|
@@ -220,7 +220,7 @@ sub remove_quoted_text {
|
|||||||
my ($string) = @_;
|
my ($string) = @_;
|
||||||
$string =~ s/[^\\]`[^`]*[^\\]`//g;
|
$string =~ s/[^\\]`[^`]*[^\\]`//g;
|
||||||
$string =~ s/[^\\]"[^"]*[^\\]"//g;
|
$string =~ s/[^\\]"[^"]*[^\\]"//g;
|
||||||
$string =~ s/[^\\]"[^"]*[^\\]"//g;
|
$string =~ s/[^\\]'[^']*[^\\]'//g;
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1188,6 +1188,85 @@ SKIP: {
|
|||||||
) or die Data::Dumper::Dumper($tbl);
|
) or die Data::Dumper::Dumper($tbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Test that the GENERATED word in a column comment doesn't make that column
|
||||||
|
# to be detected as a MySQL 5.7+ generated column.
|
||||||
|
$tbl = $tp->parse( load_file('t/lib/samples/generated_cols_comments.sql') );
|
||||||
|
is_deeply(
|
||||||
|
$tbl,
|
||||||
|
{
|
||||||
|
charset => 'latin1',
|
||||||
|
clustered_key => 'PRIMARY',
|
||||||
|
col_posn => {
|
||||||
|
id => 0,
|
||||||
|
source => 1,
|
||||||
|
tso_id => 2
|
||||||
|
},
|
||||||
|
cols => [
|
||||||
|
'id',
|
||||||
|
'source',
|
||||||
|
'tso_id'
|
||||||
|
],
|
||||||
|
defs => {
|
||||||
|
id => ' `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT \'The unique id of the audit record.\'',
|
||||||
|
source => ' `source` enum(\'val1\',\'val2\') NOT NULL COMMENT \'Transaction originator\'',
|
||||||
|
tso_id => ' `tso_id` int(11) unsigned NOT NULL DEFAULT \'0\' COMMENT \'An internally generated transaction.\''
|
||||||
|
},
|
||||||
|
engine => 'InnoDB',
|
||||||
|
is_autoinc => {
|
||||||
|
id => 1,
|
||||||
|
source => 0,
|
||||||
|
tso_id => 0
|
||||||
|
},
|
||||||
|
is_col => {
|
||||||
|
id => 1,
|
||||||
|
source => 1,
|
||||||
|
tso_id => 1
|
||||||
|
},
|
||||||
|
is_generated => {},
|
||||||
|
is_nullable => {},
|
||||||
|
is_numeric => {
|
||||||
|
id => 1,
|
||||||
|
tso_id => 1
|
||||||
|
},
|
||||||
|
keys => {
|
||||||
|
PRIMARY => {
|
||||||
|
col_prefixes => [
|
||||||
|
undef
|
||||||
|
],
|
||||||
|
colnames => '`id`',
|
||||||
|
cols => [
|
||||||
|
'id'
|
||||||
|
],
|
||||||
|
ddl => 'PRIMARY KEY (`id`),',
|
||||||
|
is_col => {
|
||||||
|
id => 1
|
||||||
|
},
|
||||||
|
is_nullable => 0,
|
||||||
|
is_unique => 1,
|
||||||
|
name => 'PRIMARY',
|
||||||
|
type => 'BTREE'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name => 't1',
|
||||||
|
non_generated_cols => [
|
||||||
|
'id',
|
||||||
|
'source',
|
||||||
|
'tso_id'
|
||||||
|
],
|
||||||
|
null_cols => [],
|
||||||
|
numeric_cols => [
|
||||||
|
'id',
|
||||||
|
'tso_id'
|
||||||
|
],
|
||||||
|
type_for => {
|
||||||
|
id => 'int',
|
||||||
|
source => 'enum',
|
||||||
|
tso_id => 'int'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'Column having the word "generated" as part of the comment is OK',
|
||||||
|
) or diag Data::Dumper::Dumper($tbl);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
6
t/lib/samples/generated_cols_comments.sql
Normal file
6
t/lib/samples/generated_cols_comments.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
CREATE TABLE `t1` (
|
||||||
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'The unique id of the audit record.',
|
||||||
|
`source` enum('val1','val2') NOT NULL COMMENT 'Transaction originator',
|
||||||
|
`tso_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'An internally generated transaction.',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='some comment here generated'
|
Reference in New Issue
Block a user