mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-23 04:25:43 +00:00
PT-2123 wide character in print for pt archiver (#583)
* PT-2123 pt-archiver gives error "Wide character in print at /usr/bin/pt-archiver line 6815" when using --bulk-insert while using character set alias Added check if source DSN has character set UTF specified while option --charset is not provided In this case it is safe to open bulk insert data file in utf8 mode. * PT-2123 pt-archiver gives error "Wide character in print at /usr/bin/pt-archiver line 6815" when using --bulk-insert while using character set alias Removed unrelated row in t/pt-archiver/samples/pt-2123.sql * PT-2123 pt-archiver gives error "Wide character in print at /usr/bin/pt-archiver line 6815" when using --bulk-insert while using character set alias util/update-modules for pt-archiver
This commit is contained in:
@@ -1958,7 +1958,7 @@ sub parse {
|
||||
|
||||
my $engine = $self->get_engine($ddl);
|
||||
|
||||
my @defs = $ddl =~ m/^(\s+`.*?),?$/gm;
|
||||
my @defs = $ddl =~ m/(?:(?<=,\n)|(?<=\(\n))(\s+`(?:.|\n)+?`.+?),?\n/g;
|
||||
my @cols = map { $_ =~ m/`([^`]+)`/ } @defs;
|
||||
PTDEBUG && _d('Table cols:', join(', ', map { "`$_`" } @cols));
|
||||
|
||||
@@ -2139,7 +2139,7 @@ sub get_keys {
|
||||
my $clustered_key = undef;
|
||||
|
||||
KEY:
|
||||
foreach my $key ( $ddl =~ m/^ ((?:[A-Z]+ )?KEY .*)$/gm ) {
|
||||
foreach my $key ( $ddl =~ m/^ ((?:[A-Z]+ )?KEY \(?`[\s\S]*?`\),?)$/gm ) {
|
||||
|
||||
next KEY if $key =~ m/FOREIGN/;
|
||||
|
||||
@@ -2150,7 +2150,7 @@ sub get_keys {
|
||||
$key =~ s/USING HASH/USING BTREE/;
|
||||
}
|
||||
|
||||
my ( $type, $cols ) = $key =~ m/(?:USING (\w+))? \((.+)\)/;
|
||||
my ( $type, $cols ) = $key =~ m/(?:USING (\w+))? \(([\s\S]+?)\)/;
|
||||
my ( $special ) = $key =~ m/(FULLTEXT|SPATIAL)/;
|
||||
$type = $type || $special || 'BTREE';
|
||||
my ($name) = $key =~ m/(PRIMARY|`[^`]*`)/;
|
||||
@@ -6777,6 +6777,10 @@ sub main {
|
||||
require File::Temp;
|
||||
$bulkins_file = File::Temp->new( SUFFIX => 'pt-archiver' )
|
||||
or die "Cannot open temp file: $OS_ERROR\n";
|
||||
if ( !$charset && $src->{info}->{charset}
|
||||
&& $src->{info}->{charset} =~ /utf/ ) {
|
||||
binmode($bulkins_file, ':utf8')
|
||||
}
|
||||
binmode($bulkins_file, $charset)
|
||||
or die "Cannot set $charset as an encoding for the bulk-insert "
|
||||
. "file: $OS_ERROR";
|
||||
|
Reference in New Issue
Block a user