LOAD DATA LOCAL INFILE: The hopefully final fix.

This introduces a L option to the DSNs of pt-upgrade and pt-archiver,
which turns on mysql_local_infile.
This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-10-17 19:19:44 -03:00
parent a433fa7d1c
commit 9e832790f8
11 changed files with 91 additions and 23 deletions

View File

@@ -38,7 +38,7 @@ $dbh->do('INSERT INTO `test`.`table_5_copy` SELECT * FROM `test`.`table_5`');
$output = output(
sub { pt_archiver::main(qw(--no-ascend --limit 50 --bulk-insert),
qw(--bulk-delete --where 1=1 --statistics),
'--source', "D=test,t=table_5,F=$cnf",
'--source', "L=1,D=test,t=table_5,F=$cnf",
'--dest', "t=table_5_dest") },
);
like($output, qr/SELECT 105/, 'Fetched 105 rows');
@@ -63,7 +63,7 @@ $output = output(
sub { pt_archiver::main(
'--where', "id < 8", qw(--limit 100000 --txn-size 1000),
qw(--why-quit --statistics --bulk-insert),
'--source', "D=bri,t=t,F=$cnf",
'--source', "L=1,D=bri,t=t,F=$cnf",
'--dest', "t=t_arch") },
);
$rows = $dbh->selectall_arrayref('select id from bri.t order by id');

View File

@@ -36,7 +36,7 @@ $sb->load_file('master', "t/pt-archiver/samples/bulk_regular_insert.sql");
$dbh->do('use bri');
output(
sub { pt_archiver::main("--source", "F=$cnf,D=bri,t=t", qw(--dest t=t_arch --where 1=1 --bulk-insert --limit 3)) },
sub { pt_archiver::main("--source", "F=$cnf,D=bri,t=t,L=1", qw(--dest t=t_arch --where 1=1 --bulk-insert --limit 3)) },
);
my $t_rows = $dbh->selectall_arrayref('select * from t order by id');
@@ -70,7 +70,7 @@ is_deeply(
$sb->load_file('master', "t/pt-archiver/samples/bulk_regular_insert.sql");
$dbh->do('use bri');
`$cmd --source F=$cnf,D=bri,t=t --dest t=t_arch,m=bulk_regular_insert --where "1=1" --bulk-insert --limit 3`;
`$cmd --source F=$cnf,D=bri,t=t,L=1 --dest t=t_arch,m=bulk_regular_insert --where "1=1" --bulk-insert --limit 3`;
my $bri_t_rows = $dbh->selectall_arrayref('select * from t order by id');
my $bri_t_arch_rows = $dbh->selectall_arrayref('select * from t_arch order by id');

View File

@@ -30,7 +30,7 @@ elsif ( !$dbh2 ) {
plan skip_all => 'Cannot connect to second sandbox master';
}
my @host_args = ('h=127.1,P=12345', 'P=12348');
my @host_args = ('h=127.1,P=12345,L=1', 'P=12348');
my @op_args = (qw(-u msandbox -p msandbox),
'--compare', 'results,warnings',
'--zero-query-times',
@@ -104,9 +104,6 @@ $sb->wipe_clean($dbh2);
# Issue 951: mk-upgrade "I need a db argument" error with
# compare-results-method=rows
# #############################################################################
SKIP: {
skip "LOAD DATA LOCAL INFILE is disabled", 4 unless $can_load_data;
$sb->load_file('master', "$sample/002/tables.sql");
$sb->load_file('master1', "$sample/002/tables.sql");
@@ -116,7 +113,7 @@ SKIP: {
ok(
no_diff(
sub { pt_upgrade::main(@op_args, "$log/002/no-db.log",
'h=127.1,P=12345,D=test', 'P=12348,D=test',
'h=127.1,P=12345,D=test,L=1', 'P=12348,D=test',
qw(--compare-results-method rows --temp-database test)) },
"$sample/002/report-01.txt",
),
@@ -130,7 +127,7 @@ SKIP: {
ok(
no_diff(
sub { pt_upgrade::main(@op_args, "$log/002/no-db.log",
'h=127.1,P=12345,D=test', 'P=12348,D=test',
'h=127.1,P=12345,D=test,L=1', 'P=12348,D=test',
qw(--compare-results-method rows --temp-database tmp_db)) },
"$sample/002/report-01.txt",
),
@@ -151,15 +148,11 @@ SKIP: {
$sb->wipe_clean($dbh1);
$sb->wipe_clean($dbh2);
}
# #############################################################################
# Bug 926598: DBD::mysql bug causes pt-upgrade to use wrong
# precision (M) and scale (D)
# #############################################################################
SKIP: {
skip "LOAD DATA LOCAL INFILE is disabled", 2 unless $can_load_data;
$sb->load_file('master', "$sample/003/tables.sql");
$sb->load_file('master1', "$sample/003/tables.sql");
@@ -181,7 +174,6 @@ SKIP: {
qr/[`"]SUM\(total\)[`"]\s+double\sDEFAULT/i,
"No M,D in table def (bug 926598)"
);
}
# #############################################################################
# Done.

View File

@@ -36,7 +36,7 @@ $sb->load_file('master', 't/pt-upgrade/samples/001/tables.sql');
$sb->load_file('master1', 't/pt-upgrade/samples/001/tables.sql');
my $output;
my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox P=12348 --compare results,warnings --zero-query-times --compare-results-method rows --limit 10";
my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox,L=1 P=12348 --compare results,warnings --zero-query-times --compare-results-method rows --limit 10";
# This test really deals with,
# http://code.google.com/p/maatkit/issues/detail?id=754