Merge ptc-privs-bug-916168.

This commit is contained in:
Daniel Nichter
2012-07-21 10:46:37 -06:00
3 changed files with 49 additions and 11 deletions

View File

@@ -8177,15 +8177,8 @@ sub check_repl_table {
}
else {
PTDEBUG && _d('--replicate table', $repl_table, 'already exists');
# Check it again but this time check the privs.
my $have_tbl_privs = $tp->check_table(
dbh => $dbh,
db => $db,
tbl => $tbl,
all_privs => 1,
);
die "User does not have all privileges on --replicate table "
. "$repl_table.\n" unless $have_tbl_privs;
# We used to check the table privs here, but:
# https://bugs.launchpad.net/percona-toolkit/+bug/916168
}
# Check and wait for the repl table to appear on all slaves.

View File

@@ -42,7 +42,7 @@ elsif ( !@{$master_dbh->selectall_arrayref("show databases like 'sakila'")} ) {
plan skip_all => 'sakila database is not loaded';
}
else {
plan tests => 3;
plan tests => 4;
}
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
@@ -94,7 +94,31 @@ diag(`/tmp/12345/use -u root -e "drop user 'ro_checksum_user'\@'%'"`);
wait_until(
sub {
my $rows=$slave2_dbh->selectall_arrayref("SELECT user FROM mysql.user");
return !grep { ($_->[0] || '') ne 'ro_checksum_user' } @$rows;
return !grep { ($_->[0] || '') eq 'ro_checksum_user' } @$rows;
}
);
# #############################################################################
# Bug 916168: bug in pt-table-checksum privileges check
# #############################################################################
`/tmp/12345/use -u root < $trunk/t/pt-table-checksum/samples/privs-bug-916168.sql`;
$output = output(
sub { $exit_status = pt_table_checksum::main(@args,
"$master_dsn,u=test_user,p=foo", qw(-t sakila.country)) },
);
is(
PerconaTest::count_checksum_results($output, 'rows'),
109,
"test_user privs work (bug 916168)"
);
diag(`/tmp/12345/use -u root -e "drop user 'test_user'\@'%'"`);
wait_until(
sub {
my $rows=$slave2_dbh->selectall_arrayref("SELECT user FROM mysql.user");
return !grep { ($_->[0] || '') eq 'test_user' } @$rows;
}
);

View File

@@ -0,0 +1,21 @@
grant select, replication slave, replication client, super, process on *.* to 'test_user'@'%' identified by 'foo';
grant all on percona.* to 'test_user'@'%';
create database if not exists percona;
use percona;
drop table if exists checksums;
CREATE TABLE `checksums` (
`db` char(64) NOT NULL,
`tbl` char(64) NOT NULL,
`chunk` int(11) NOT NULL,
`chunk_time` float DEFAULT NULL,
`chunk_index` varchar(200) DEFAULT NULL,
`lower_boundary` text,
`upper_boundary` text,
`this_crc` char(40) NOT NULL,
`this_cnt` int(11) NOT NULL,
`master_crc` char(40) DEFAULT NULL,
`master_cnt` int(11) DEFAULT NULL,
`ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`db`,`tbl`,`chunk`),
KEY `ts_db_tbl` (`ts`,`db`,`tbl`)
) ENGINE=InnoDB;