From 0d572c3a02044c33b59b0d37acfd69566c66fb79 Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Fri, 13 Jul 2012 03:30:05 -0300 Subject: [PATCH] Some changes that somehow went missing during the merge --- bin/pt-archiver | 16 ++++++++++++++++ t/pt-archiver/bulk_insert.t | 8 ++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/bin/pt-archiver b/bin/pt-archiver index ffad2fe3..a2d42276 100644 --- a/bin/pt-archiver +++ b/bin/pt-archiver @@ -3949,6 +3949,22 @@ sub main { $dp->get_cxn_params($table), { AutoCommit => $ac }); PTDEBUG && _d('Inspecting table on', $dp->as_string($table)); + if ( $o->get('bulk-insert') ) { + local $@; + my $sql = "LOAD DATA LOCAL INFILE '/dev/null' INTO TABLE " + . "`test`.`pt_not_there`"; + eval { $dbh->do($sql); 1 } or do { + my $e = $@; + my $error_re = qr/\QDBD::mysql::db do failed: The used command is not allowed with this MySQL version [for Statement "LOAD DATA LOCAL INFILE/; + if ($e =~ $error_re) { + $dbh->disconnect(); + die("--bulk-insert cannot work as LOAD DATA LOCAL INFILE " + . "is disabled. See http://kb.percona.com/troubleshoot-load-data-infile" + ); + } + }; + } + # Set options that can enable removing data on the master and archiving it # on the slaves. if ( $table->{a} ) { diff --git a/t/pt-archiver/bulk_insert.t b/t/pt-archiver/bulk_insert.t index 8db5cf07..3b7f1011 100644 --- a/t/pt-archiver/bulk_insert.t +++ b/t/pt-archiver/bulk_insert.t @@ -36,7 +36,7 @@ my $cnf = "/tmp/12345/my.sandbox.cnf"; my $cmd = "$trunk/bin/pt-archiver"; if ( PerconaTest::load_data_is_disabled($dbh) ) { - test_disabled_load_data($dbh, $sb); + test_disabled_load_data($dbh, $sb, 'master', $cnf); } else { @@ -104,7 +104,7 @@ is_deeply( my $master3_dbh = $sb->get_dbh_for('master3'); - test_disabled_load_data($master3_dbh, $sb); + test_disabled_load_data($master3_dbh, $sb, 'master3', "/tmp/2900/my.sandbox.cnf"); diag(`$trunk/sandbox/stop-sandbox 2900 >/dev/null 2>&1`); $master3_dbh->disconnect() if $master3_dbh; @@ -113,10 +113,10 @@ is_deeply( } sub test_disabled_load_data { - my ($dbh, $sb) = @_; + my ($dbh, $sb, $master, $cnf) = @_; $sb->wipe_clean($dbh); $sb->create_dbs($dbh, ['test']); - $sb->load_file('master', 't/pt-archiver/samples/table5.sql'); + $sb->load_file($master, 't/pt-archiver/samples/table5.sql'); $dbh->do('INSERT INTO `test`.`table_5_copy` SELECT * FROM `test`.`table_5`'); my ($output, undef) = full_output(