mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-18 08:24:06 +00:00
Merge pull request #286 from percona/PT-205
PT-205 pt-online-schema-change show message on rocksdb if binlog_form…
This commit is contained in:
@@ -10065,6 +10065,12 @@ sub check_alter {
|
||||
die ($msg);
|
||||
}
|
||||
}
|
||||
if ( $alter =~ m/Engine\s*=\s*["']?RocksDB["']?/i ) {
|
||||
my $row = $cxn->dbh()->selectrow_arrayref('SELECT @@binlog_format');
|
||||
if (scalar $row > 0 && $row->[0] eq 'STATEMENT') {
|
||||
die("Cannot change engine to RocksDB while binlog_format is other than 'ROW'");
|
||||
}
|
||||
}
|
||||
# ########################################################################
|
||||
# Check for DROP PRIMARY KEY.
|
||||
# ########################################################################
|
||||
|
0
sandbox/5.6
Normal file
0
sandbox/5.6
Normal file
80
t/pt-online-schema-change/pt-205.t
Normal file
80
t/pt-online-schema-change/pt-205.t
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
BEGIN {
|
||||
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
|
||||
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
|
||||
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
|
||||
};
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use threads;
|
||||
|
||||
use English qw(-no_match_vars);
|
||||
use Test::More;
|
||||
|
||||
use Data::Dumper;
|
||||
use PerconaTest;
|
||||
use Sandbox;
|
||||
use SqlModes;
|
||||
use File::Temp qw/ tempdir /;
|
||||
|
||||
require "$trunk/bin/pt-online-schema-change";
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $master_dbh = $sb->get_dbh_for('master');
|
||||
my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
|
||||
|
||||
if ( !$master_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
|
||||
if ($sandbox_version lt '5.7') {
|
||||
plan skip_all => "RocksDB is only available on Percona Server 5.7.19+";
|
||||
}
|
||||
|
||||
|
||||
if (!$sb->has_engine('master', 'rocksdb')) {
|
||||
plan skip_all => "RocksDB engine is not available";
|
||||
}
|
||||
|
||||
plan tests => 3;
|
||||
|
||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the
|
||||
# tool will die.
|
||||
my @args = (qw(--set-vars innodb_lock_wait_timeout=3));
|
||||
my $output;
|
||||
my $exit_status;
|
||||
|
||||
$sb->load_file('master', "t/pt-online-schema-change/samples/pt-205.sql");
|
||||
|
||||
($output, $exit_status) = full_output(
|
||||
sub { pt_online_schema_change::main(@args, "$master_dsn,D=test,t=t1",
|
||||
'--execute',
|
||||
'--alter', "Engine=RocksDB",
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
isnt(
|
||||
$exit_status,
|
||||
0,
|
||||
"PT-205 Altering engine to RocksDB, exit status != 0",
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/Cannot change engine to RocksDB while binlog_format is other than 'ROW'/s,
|
||||
"PT-205 Altering engine to RocksDB error message",
|
||||
);
|
||||
|
||||
$master_dbh->do("DROP DATABASE IF EXISTS test");
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($master_dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
done_testing;
|
8
t/pt-online-schema-change/samples/pt-205.sql
Normal file
8
t/pt-online-schema-change/samples/pt-205.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
CREATE SCHEMA IF NOT EXISTS test;
|
||||
USE test;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE `test`.`t1` (
|
||||
`ID` int(11) NOT NULL,
|
||||
`Column2` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
Reference in New Issue
Block a user