mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 07:30:02 +00:00
Only use LOCK IN SHARE MODE with MySQL 5.1+.
This commit is contained in:
@@ -7860,10 +7860,15 @@ sub main {
|
||||
# Although triggers were introduced in 5.0.2, "Prior to MySQL 5.0.10,
|
||||
# triggers cannot contain direct references to tables by name."
|
||||
# ########################################################################
|
||||
if ( VersionParser->new($cxn->dbh()) < '5.0.10' ) {
|
||||
my $server_version = VersionParser->new($cxn->dbh());
|
||||
if ( $server_version < '5.0.10' ) {
|
||||
die "This tool requires MySQL 5.0.10 or newer.\n";
|
||||
}
|
||||
|
||||
# Use LOCK IN SHARE mode unless MySQL 5.0 because there's a bug like
|
||||
# http://bugs.mysql.com/bug.php?id=45694
|
||||
my $lock_in_share_mode = $server_version < '5.1' ? 0 : 1;
|
||||
|
||||
# ########################################################################
|
||||
# Setup lag and load monitors.
|
||||
# ########################################################################
|
||||
@@ -8698,7 +8703,7 @@ sub main {
|
||||
dml => $dml,
|
||||
select => $select,
|
||||
callbacks => $callbacks,
|
||||
lock_in_share_mode => 1,
|
||||
lock_in_share_mode => $lock_in_share_mode,
|
||||
OptionParser => $o,
|
||||
Quoter => $q,
|
||||
TableParser => $tp,
|
||||
|
@@ -235,6 +235,35 @@ $sb->load_file('master', "$sample/del-trg-bug-1062324.sql");
|
||||
);
|
||||
}
|
||||
|
||||
# #############################################################################
|
||||
# Something like http://bugs.mysql.com/bug.php?id=45694 means we should not
|
||||
# use LOCK IN SHARE MODE with MySQL 5.0.
|
||||
# #############################################################################
|
||||
$sb->load_file('master', "$sample/basic_no_fks_innodb.sql");
|
||||
|
||||
($output, $exit_status) = full_output(
|
||||
sub { pt_online_schema_change::main(@args,
|
||||
"$master_dsn,D=pt_osc,t=t",
|
||||
"--alter", "add column (foo int)",
|
||||
qw(--execute --print))
|
||||
},
|
||||
);
|
||||
|
||||
if ( $sandbox_version eq '5.0' ) {
|
||||
unlike(
|
||||
$output,
|
||||
qr/LOCK IN SHARE MODE/,
|
||||
"No LOCK IN SHARE MODE for MySQL $sandbox_version"
|
||||
);
|
||||
}
|
||||
else {
|
||||
like(
|
||||
$output,
|
||||
qr/LOCK IN SHARE MODE/,
|
||||
"LOCK IN SHARE MODE for MySQL $sandbox_version",
|
||||
);
|
||||
}
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user