mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-19 02:05:23 +00:00
PT-2340 - Support MySQL 8.4
- Removed offensive terminology from library files and their tests - Removed unused sandbox/prove2junit.pl - Added option mysql_ssl to DSN and possibility to have DSN of multiple letters
This commit is contained in:
@@ -19,8 +19,8 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts => $dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $master_dbh = $sb->get_dbh_for('master');
|
||||
my $slave1_dbh = $sb->get_dbh_for('slave1');
|
||||
my $master_dbh = $sb->get_dbh_for('source');
|
||||
my $slave1_dbh = $sb->get_dbh_for('replica1');
|
||||
|
||||
throws_ok(
|
||||
sub { new ChangeHandler() },
|
||||
@@ -439,7 +439,7 @@ is(
|
||||
|
||||
SKIP: {
|
||||
skip 'Cannot connect to sandbox master', 1 unless $master_dbh;
|
||||
$sb->load_file('master', "t/lib/samples/issue_641.sql");
|
||||
$sb->load_file('source', "t/lib/samples/issue_641.sql");
|
||||
|
||||
@rows = ();
|
||||
$tbl_struct = {
|
||||
@@ -503,7 +503,7 @@ is_deeply(
|
||||
# #############################################################################
|
||||
SKIP: {
|
||||
skip 'Cannot connect to sandbox master', 1 unless $master_dbh;
|
||||
$sb->load_file('master', "t/lib/samples/bug_1038276.sql");
|
||||
$sb->load_file('source', "t/lib/samples/bug_1038276.sql");
|
||||
|
||||
@rows = ();
|
||||
$tbl_struct = {
|
||||
@@ -542,7 +542,7 @@ SKIP: {
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($master_dbh);
|
||||
$sb->wipe_clean($slave1_dbh);
|
||||
$sb->ok();
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
|
||||
done_testing;
|
||||
|
||||
done_testing;
|
||||
|
@@ -20,7 +20,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
|
@@ -33,8 +33,8 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh1 = $sb->get_dbh_for('master');
|
||||
my $dbh2 = $sb->get_dbh_for('slave1');
|
||||
my $dbh1 = $sb->get_dbh_for('source');
|
||||
my $dbh2 = $sb->get_dbh_for('replica1');
|
||||
|
||||
if ( !$dbh1 ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
@@ -99,7 +99,7 @@ sub get_id {
|
||||
# Test the checksum method.
|
||||
# #############################################################################
|
||||
|
||||
$sb->load_file('master', "t/lib/samples/compare-results.sql");
|
||||
$sb->load_file('source', "t/lib/samples/compare-results.sql");
|
||||
|
||||
$cr = new CompareResults(
|
||||
method => 'checksum',
|
||||
@@ -308,7 +308,7 @@ my $tmpdir = '/tmp/mk-upgrade-res';
|
||||
|
||||
diag(`rm -rf $tmpdir 2>/dev/null; mkdir $tmpdir`);
|
||||
|
||||
$sb->load_file('master', "t/lib/samples/compare-results.sql");
|
||||
$sb->load_file('source', "t/lib/samples/compare-results.sql");
|
||||
|
||||
$cr = new CompareResults(
|
||||
method => 'rows',
|
||||
|
@@ -22,7 +22,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master', {no_lc=>1});
|
||||
my $dbh = $sb->get_dbh_for('source', {no_lc=>1});
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
|
@@ -29,7 +29,7 @@ $Data::Dumper::Quotekeys = 0;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to MySQL';
|
||||
@@ -57,7 +57,7 @@ sub test_copy_table {
|
||||
my (%args) = @_;
|
||||
my ($tbl, $col, $expect) = @args{qw(tbl col expect)};
|
||||
|
||||
$sb->load_file("master", "t/lib/samples/osc/$tbl");
|
||||
$sb->load_file("source", "t/lib/samples/osc/$tbl");
|
||||
$dbh->do("USE osc");
|
||||
|
||||
$osc->copy(
|
||||
|
19
t/lib/Cxn.t
19
t/lib/Cxn.t
@@ -23,9 +23,9 @@ use Data::Dumper;
|
||||
my $q = new Quoter();
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $master_dbh = $sb->get_dbh_for('master');
|
||||
my $slave1_dbh = $sb->get_dbh_for('slave1');
|
||||
my $slave1_dsn = $sb->dsn_for('slave1');
|
||||
my $master_dbh = $sb->get_dbh_for('source');
|
||||
my $slave1_dbh = $sb->get_dbh_for('replica1');
|
||||
my $slave1_dsn = $sb->dsn_for('replica1');
|
||||
|
||||
if ( !$master_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
@@ -125,7 +125,7 @@ ok(
|
||||
"cxn->connect()"
|
||||
);
|
||||
|
||||
my ($row) = $cxn->dbh()->selectrow_hashref('SHOW MASTER STATUS');
|
||||
my ($row) = $cxn->dbh()->selectrow_hashref("SHOW ${source_status} STATUS");
|
||||
ok(
|
||||
exists $row->{binlog_ignore_db},
|
||||
"FetchHashKeyName = NAME_lc",
|
||||
@@ -174,7 +174,7 @@ test_var_val(
|
||||
$cxn->dbh()->disconnect();
|
||||
$cxn->connect();
|
||||
|
||||
($row) = $cxn->dbh()->selectrow_hashref('SHOW MASTER STATUS');
|
||||
($row) = $cxn->dbh()->selectrow_hashref("SHOW ${source_status} STATUS");
|
||||
ok(
|
||||
exists $row->{binlog_ignore_db},
|
||||
"Reconnect FetchHashKeyName = NAME_lc",
|
||||
@@ -213,6 +213,7 @@ is_deeply(
|
||||
S => undef,
|
||||
D => undef,
|
||||
t => undef,
|
||||
mysql_ssl => undef,
|
||||
},
|
||||
"cxn->dsn()"
|
||||
);
|
||||
@@ -240,6 +241,7 @@ is_deeply(
|
||||
S => undef,
|
||||
D => undef,
|
||||
t => undef,
|
||||
mysql_ssl => undef,
|
||||
},
|
||||
"Defaults to h=localhost"
|
||||
);
|
||||
@@ -259,6 +261,7 @@ is_deeply(
|
||||
S => undef,
|
||||
D => undef,
|
||||
t => undef,
|
||||
mysql_ssl => undef,
|
||||
},
|
||||
"Default cxn inherits default connection options"
|
||||
);
|
||||
@@ -339,7 +342,7 @@ SKIP: {
|
||||
"First connect()"
|
||||
);
|
||||
|
||||
($row) = $cxn->dbh()->selectrow_hashref('SHOW SLAVE STATUS');
|
||||
($row) = $cxn->dbh()->selectrow_hashref("SHOW ${replica_name} STATUS");
|
||||
ok(
|
||||
!defined $row,
|
||||
"First connect() to master"
|
||||
@@ -356,7 +359,7 @@ SKIP: {
|
||||
PXC_SKIP: {
|
||||
skip 'Not for PXC' if ( $sb->is_cluster_mode );
|
||||
|
||||
($row) = $cxn->dbh()->selectrow_hashref('SHOW SLAVE STATUS');
|
||||
($row) = $cxn->dbh()->selectrow_hashref("SHOW ${replica_name} STATUS");
|
||||
ok(
|
||||
$row,
|
||||
"Re-connect connect(slave_dsn) to slave"
|
||||
@@ -370,7 +373,7 @@ PXC_SKIP: {
|
||||
"Re-re-connect connect()"
|
||||
);
|
||||
|
||||
($row) = $cxn->dbh()->selectrow_hashref('SHOW SLAVE STATUS');
|
||||
($row) = $cxn->dbh()->selectrow_hashref("SHOW ${source_status} STATUS");
|
||||
ok(
|
||||
$row,
|
||||
"Re-re-connect connect() to slave"
|
||||
|
@@ -527,6 +527,7 @@ my @password_commas = (
|
||||
['u=a,p=foo\,,P=12345', 'foo,', 12345, 'Pass ends with comma'],
|
||||
['u=a,p=foo\,', 'foo,', undef, 'Pass ends with comma, last part'],
|
||||
['u=a,p=\,,P=12345', ',', 12345, 'Pass is a comma'],
|
||||
['u=a,p=foo=bar,P=12345', 'foo=bar', 12345, '= in a pass'],
|
||||
);
|
||||
foreach my $password_comma ( @password_commas ) {
|
||||
test_password_comma(@$password_comma);
|
||||
@@ -551,8 +552,9 @@ sub test_password_comma_with_auto {
|
||||
}
|
||||
|
||||
@password_commas = (
|
||||
['host,p=a\,z,P=9', 'a,z', 9, 'Comma-pass with leading bareword host'],
|
||||
['p=a\,z,P=9,host', 'a,z', 9, 'Comma-pass with trailing bareword host'],
|
||||
['host,p=a\,z,P=9', 'a,z', 9, 'Comma-pass with leading bareword host'],
|
||||
['p=a\,z,P=9,host', 'a,z', 9, 'Comma-pass with trailing bareword host'],
|
||||
['p=foo=bar,P=9,host', 'foo=bar', 9, '= in a pass with trailing bareword host'],
|
||||
|
||||
);
|
||||
foreach my $password_comma ( @password_commas ) {
|
||||
|
@@ -26,7 +26,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master', {no_lc=>1});
|
||||
my $dbh = $sb->get_dbh_for('source', {no_lc=>1});
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
|
@@ -31,7 +31,7 @@ $Data::Dumper::Quotekeys = 0;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
@@ -77,7 +77,7 @@ sub test_index_len {
|
||||
# #############################################################################
|
||||
# bad_plan, PK with 4 cols
|
||||
# #############################################################################
|
||||
$sb->load_file('master', "t/pt-table-checksum/samples/bad-plan-bug-1010232.sql");
|
||||
$sb->load_file('source', "t/pt-table-checksum/samples/bad-plan-bug-1010232.sql");
|
||||
my $tbl_struct = $tp->parse(
|
||||
$tp->get_create_table($dbh, 'bad_plan', 't'));
|
||||
my $tbl = {
|
||||
|
@@ -31,7 +31,7 @@ Transformers->import(qw(make_checksum));
|
||||
my $qr = new QueryRewriter();
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
my $iu = new IndexUsage();
|
||||
|
||||
|
@@ -21,7 +21,7 @@ require VersionParser;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
@@ -38,7 +38,7 @@ my ($size, $chosen_key);
|
||||
|
||||
sub key_info {
|
||||
my ( $file, $db, $tbl, $key, $cols ) = @_;
|
||||
$sb->load_file('master', $file, $db);
|
||||
$sb->load_file('source', $file, $db);
|
||||
my $tbl_name = $q->quote($db, $tbl);
|
||||
my $struct = $tp->parse( load_file($file) );
|
||||
return (
|
||||
@@ -83,7 +83,7 @@ is_deeply(
|
||||
'Two column int key'
|
||||
);
|
||||
|
||||
$sb->load_file('master', 't/lib/samples/issue_331-parent.sql', 'test');
|
||||
$sb->load_file('source', 't/lib/samples/issue_331-parent.sql', 'test');
|
||||
%key = key_info('t/lib/samples/issue_331.sql', 'test', 'issue_331_t2', 'fk_1', ['id']);
|
||||
($size, $chosen_key) = $ks->get_key_size(%key);
|
||||
is(
|
||||
@@ -110,7 +110,7 @@ $dbh->do('DROP TABLE IF EXISTS test.issue_364');
|
||||
'BASE_KID_ID',
|
||||
[qw(BASE_KID_ID ID)]
|
||||
);
|
||||
$sb->load_file('master', 't/lib/samples/issue_364-data.sql', 'test');
|
||||
$sb->load_file('source', 't/lib/samples/issue_364-data.sql', 'test');
|
||||
|
||||
# This issue had another issue: the key is ALL CAPS, but TableParser
|
||||
# lowercases all identifies, so KeySize said the key didn't exist.
|
||||
@@ -214,7 +214,7 @@ is(
|
||||
# #############################################################################
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1201443
|
||||
# #############################################################################
|
||||
$sb->load_file('master', "t/pt-duplicate-key-checker/samples/fk_chosen_index_bug_1201443.sql");
|
||||
$sb->load_file('source', "t/pt-duplicate-key-checker/samples/fk_chosen_index_bug_1201443.sql");
|
||||
|
||||
($size, $chosen_key) = $ks->get_key_size(
|
||||
name => 'child_ibfk_2',
|
||||
|
@@ -25,8 +25,8 @@ use Data::Dumper;
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
|
||||
my $master_dbh = $sb->get_dbh_for('master');
|
||||
my $slave_dbh = $sb->get_dbh_for('slave1');
|
||||
my $master_dbh = $sb->get_dbh_for('source');
|
||||
my $slave_dbh = $sb->get_dbh_for('replica1');
|
||||
my $master_dsn = {
|
||||
h => '127.1',
|
||||
P => '12345',
|
||||
@@ -81,9 +81,10 @@ PXC_SKIP: {
|
||||
h => '127.0.0.1',
|
||||
p => 'msandbox',
|
||||
t => undef,
|
||||
mysql_ssl => undef,
|
||||
u => 'msandbox',
|
||||
server_id => 12346,
|
||||
master_id => 12345,
|
||||
source_id => 12345,
|
||||
source => 'hosts',
|
||||
},
|
||||
'get_slaves() from recurse_to_slaves() with a default --recursion-method'
|
||||
@@ -137,7 +138,7 @@ PXC_SKIP: {
|
||||
diag(`/tmp/12345/use -u root < $trunk/t/lib/samples/ro-checksum-user.sql`);
|
||||
|
||||
my $ro_dbh = DBI->connect(
|
||||
"DBI:mysql:;host=127.0.0.1;port=12345", 'ro_checksum_user', 'msandbox',
|
||||
"DBI:mysql:;host=127.0.0.1;port=12345;mysql_ssl=1", 'ro_checksum_user', 'msandbox',
|
||||
{ PrintError => 0, RaiseError => 1 });
|
||||
my $ro_dsn = {
|
||||
h => '127.1',
|
||||
@@ -219,20 +220,20 @@ PXC_SKIP: {
|
||||
# sandbox servers) as seen in the %port_for hash below.
|
||||
# #############################################################################
|
||||
my %port_for = (
|
||||
master => 2900,
|
||||
slave0 => 2901,
|
||||
slave1 => 2902,
|
||||
slave2 => 2903,
|
||||
source => 2900,
|
||||
replica0 => 2901,
|
||||
replica1 => 2902,
|
||||
replica2 => 2903,
|
||||
);
|
||||
foreach my $port ( values %port_for ) {
|
||||
if ( -d "/tmp/$port" ) {
|
||||
diag(`$trunk/sandbox/stop-sandbox $port >/dev/null 2>&1`);
|
||||
}
|
||||
}
|
||||
diag(`$trunk/sandbox/start-sandbox master 2900`);
|
||||
diag(`$trunk/sandbox/start-sandbox slave 2903 2900`);
|
||||
diag(`$trunk/sandbox/start-sandbox slave 2901 2900`);
|
||||
diag(`$trunk/sandbox/start-sandbox slave 2902 2901`);
|
||||
diag(`$trunk/sandbox/start-sandbox source 2900`);
|
||||
diag(`$trunk/sandbox/start-sandbox replica 2903 2900`);
|
||||
diag(`$trunk/sandbox/start-sandbox replica 2901 2900`);
|
||||
diag(`$trunk/sandbox/start-sandbox replica 2902 2901`);
|
||||
|
||||
# I discovered something weird while updating this test. Above, you see that
|
||||
# slave2 is started first, then the others. Before, slave2 was started last,
|
||||
@@ -256,7 +257,7 @@ my $dbh;
|
||||
my @slaves;
|
||||
my @sldsns;
|
||||
|
||||
my $dsn = $dp->parse("h=127.0.0.1,P=$port_for{master},u=msandbox,p=msandbox");
|
||||
my $dsn = $dp->parse("h=127.0.0.1,P=$port_for{source},u=msandbox,p=msandbox,mysql_ssl=>1");
|
||||
$dbh = $dp->get_dbh($dp->get_cxn_params($dsn), { AutoCommit => 1 });
|
||||
|
||||
my $callback = sub {
|
||||
@@ -294,16 +295,17 @@ is(
|
||||
) or diag(Dumper(\@slaves));
|
||||
|
||||
is_deeply(
|
||||
$ms->get_master_dsn( $slaves[0], undef, $dp ),
|
||||
$ms->get_source_dsn( $slaves[0], undef, $dp ),
|
||||
{ h => '127.0.0.1',
|
||||
u => undef,
|
||||
P => $port_for{master},
|
||||
P => $port_for{source},
|
||||
S => undef,
|
||||
F => undef,
|
||||
p => undef,
|
||||
D => undef,
|
||||
A => undef,
|
||||
t => undef,
|
||||
mysql_ssl => undef,
|
||||
},
|
||||
'Got master DSN',
|
||||
);
|
||||
@@ -313,17 +315,17 @@ is_deeply(
|
||||
# +- 127.0.0.1:slave0
|
||||
# | +- 127.0.0.1:slave1
|
||||
# +- 127.0.0.1:slave2
|
||||
is($ms->get_slave_status($slaves[0])->{master_port}, $port_for{master}, 'slave 1 port');
|
||||
is($ms->get_slave_status($slaves[1])->{master_port}, $port_for{slave0}, 'slave 2 port');
|
||||
is($ms->get_slave_status($slaves[2])->{master_port}, $port_for{master}, 'slave 3 port');
|
||||
is($ms->get_slave_status($slaves[0])->{source_port}, $port_for{source}, 'slave 1 port');
|
||||
is($ms->get_slave_status($slaves[1])->{source_port}, $port_for{replica0}, 'slave 2 port');
|
||||
is($ms->get_slave_status($slaves[2])->{source_port}, $port_for{source}, 'slave 3 port');
|
||||
|
||||
ok($ms->is_master_of($slaves[0], $slaves[1]), 'slave 1 is slave of slave 0');
|
||||
ok($ms->is_source_of($slaves[0], $slaves[1]), 'slave 1 is slave of slave 0');
|
||||
eval {
|
||||
$ms->is_master_of($slaves[0], $slaves[2]);
|
||||
$ms->is_source_of($slaves[0], $slaves[2]);
|
||||
};
|
||||
like($EVAL_ERROR, qr/but the master's port/, 'slave 2 is not slave of slave 0');
|
||||
like($EVAL_ERROR, qr/but the ${source_name}'s port/, 'slave 2 is not slave of slave 0');
|
||||
eval {
|
||||
$ms->is_master_of($slaves[2], $slaves[1]);
|
||||
$ms->is_source_of($slaves[2], $slaves[1]);
|
||||
};
|
||||
like($EVAL_ERROR, qr/has no connected slaves/, 'slave 1 is not slave of slave 2');
|
||||
|
||||
@@ -334,8 +336,8 @@ map { $ms->start_slave($_) } @slaves;
|
||||
sleep(5);
|
||||
|
||||
my $res;
|
||||
$res = $ms->wait_for_master(
|
||||
master_status => $ms->get_master_status($dbh),
|
||||
$res = $ms->wait_for_source(
|
||||
source_status => $ms->get_source_status($dbh),
|
||||
slave_dbh => $slaves[0],
|
||||
timeout => 10,
|
||||
);
|
||||
@@ -348,10 +350,10 @@ $dbh->do('create database test');
|
||||
$dbh->do('create table test.t(a int)');
|
||||
$dbh->do('insert into test.t(a) values(1)');
|
||||
$dbh->do('update test.t set a=sleep(5)');
|
||||
diag(`(/tmp/$port_for{slave0}/use -e 'start slave')&`);
|
||||
diag(`(/tmp/$port_for{replica0}/use -e 'start ${replica_name}')&`);
|
||||
eval {
|
||||
$res = $ms->wait_for_master(
|
||||
master_status => $ms->get_master_status($dbh),
|
||||
$res = $ms->wait_for_source(
|
||||
source_status => $ms->get_source_status($dbh),
|
||||
slave_dbh => $slaves[0],
|
||||
timeout => 1,
|
||||
);
|
||||
@@ -366,11 +368,11 @@ sleep 1;
|
||||
$ms->stop_slave($slaves[0]);
|
||||
$dbh->do('drop database if exists test'); # Any stmt will do
|
||||
eval {
|
||||
$res = $ms->catchup_to_master($slaves[0], $dbh, 10);
|
||||
$res = $ms->catchup_to_source($slaves[0], $dbh, 10);
|
||||
};
|
||||
diag $EVAL_ERROR if $EVAL_ERROR;
|
||||
ok(!$EVAL_ERROR, 'No eval error catching up');
|
||||
my $master_stat = $ms->get_master_status($dbh);
|
||||
my $master_stat = $ms->get_source_status($dbh);
|
||||
my $slave_stat = $ms->get_slave_status($slaves[0]);
|
||||
is_deeply(
|
||||
$ms->repl_posn($master_stat),
|
||||
@@ -626,8 +628,8 @@ PXC_SKIP: {
|
||||
diag(`/tmp/12345/start >/dev/null 2>&1`);
|
||||
diag(`/tmp/12346/start >/dev/null 2>&1`);
|
||||
|
||||
$master_dbh = $sb->get_dbh_for('master');
|
||||
$slave_dbh = $sb->get_dbh_for('slave1');
|
||||
$master_dbh = $sb->get_dbh_for('source');
|
||||
$slave_dbh = $sb->get_dbh_for('replica1');
|
||||
|
||||
is_deeply(
|
||||
$ms->get_replication_filters(dbh=>$master_dbh),
|
||||
@@ -651,10 +653,10 @@ PXC_SKIP: {
|
||||
diag(`mv /tmp/12345/orig.cnf /tmp/12345/my.sandbox.cnf`);
|
||||
diag(`/tmp/12345/start >/dev/null`);
|
||||
diag(`/tmp/12346/start >/dev/null`);
|
||||
diag(`/tmp/12347/use -e "STOP SLAVE; START SLAVE;" >/dev/null`);
|
||||
diag(`/tmp/12347/use -e "STOP ${replica_name}; START ${replica_name};" >/dev/null`);
|
||||
|
||||
$master_dbh = $sb->get_dbh_for('master');
|
||||
$slave_dbh = $sb->get_dbh_for('slave1');
|
||||
$master_dbh = $sb->get_dbh_for('source');
|
||||
$slave_dbh = $sb->get_dbh_for('replica1');
|
||||
};
|
||||
|
||||
is(
|
||||
@@ -671,7 +673,7 @@ ok(
|
||||
# ############################################################################
|
||||
# get_slaves() and DSN table
|
||||
# ############################################################################
|
||||
$sb->load_file('master', "t/lib/samples/MasterSlave/dsn_table.sql");
|
||||
$sb->load_file('source', "t/lib/samples/MasterSlave/dsn_table.sql");
|
||||
|
||||
@ARGV = ('--recursion-method', 'dsn=F=/tmp/12345/my.sandbox.cnf,D=dsn_t,t=dsns');
|
||||
$o->get_opts();
|
||||
@@ -702,6 +704,7 @@ is_deeply(
|
||||
p => 'msandbox',
|
||||
t => undef,
|
||||
u => 'msandbox',
|
||||
mysql_ssl => undef,
|
||||
},
|
||||
'get_slaves() from DSN table'
|
||||
);
|
||||
@@ -766,22 +769,22 @@ SKIP: {
|
||||
skip "Only test on mysql 5.7",6 if ( $sandbox_version lt '5.7' );
|
||||
|
||||
my ($master1_dbh, $master1_dsn) = $sb->start_sandbox(
|
||||
server => 'chan_master1',
|
||||
type => 'master',
|
||||
server => 'chan_source1',
|
||||
type => 'source',
|
||||
);
|
||||
my ($master2_dbh, $master2_dsn) = $sb->start_sandbox(
|
||||
server => 'chan_master2',
|
||||
type => 'master',
|
||||
server => 'chan_source2',
|
||||
type => 'source',
|
||||
);
|
||||
my ($slave1_dbh, $slave1_dsn) = $sb->start_sandbox(
|
||||
server => 'chan_slave1',
|
||||
type => 'master',
|
||||
server => 'chan_replica1',
|
||||
type => 'source',
|
||||
);
|
||||
my $slave1_port = $sb->port_for('chan_slave1');
|
||||
my $slave1_port = $sb->port_for('chan_replica1');
|
||||
|
||||
$sb->load_file('chan_master1', "sandbox/gtid_on.sql", undef, no_wait => 1);
|
||||
$sb->load_file('chan_master2', "sandbox/gtid_on.sql", undef, no_wait => 1);
|
||||
$sb->load_file('chan_slave1', "sandbox/slave_channels.sql", undef, no_wait => 1);
|
||||
$sb->load_file('chan_source1', "sandbox/gtid_on.sql", undef, no_wait => 1);
|
||||
$sb->load_file('chan_source2', "sandbox/gtid_on.sql", undef, no_wait => 1);
|
||||
$sb->load_file('chan_replica1', "sandbox/replica_channels.sql", undef, no_wait => 1);
|
||||
|
||||
my $chan_slaves;
|
||||
eval {
|
||||
@@ -822,8 +825,8 @@ SKIP: {
|
||||
|
||||
my $wfm;
|
||||
eval {
|
||||
$wfm = $ms->wait_for_master(
|
||||
master_status => $ms->get_master_status($dbh),
|
||||
$wfm = $ms->wait_for_source(
|
||||
source_status => $ms->get_source_status($dbh),
|
||||
slave_dbh => $slave1_dbh,
|
||||
timeout => 1,
|
||||
);
|
||||
@@ -839,7 +842,7 @@ SKIP: {
|
||||
# After stopping one of the replication channels, show slave status returns only one slave
|
||||
# but it has a channel name and we didn't specified a channels name in the command line.
|
||||
# It should return undef
|
||||
$slave1_dbh->do("STOP SLAVE for channel 'sourcechan2'");
|
||||
$slave1_dbh->do("STOP ${replica_name} for channel 'sourcechan2'");
|
||||
|
||||
eval {
|
||||
$css = $ms->get_slave_status($slave1_dbh);
|
||||
@@ -850,7 +853,7 @@ SKIP: {
|
||||
'Cannot determine slave in a multi source config without --channel param (only one server)'
|
||||
);
|
||||
|
||||
$slave1_dbh->do("START SLAVE for channel 'sourcechan2'");
|
||||
$slave1_dbh->do("START ${replica_name} for channel 'sourcechan2'");
|
||||
|
||||
# Now try specifying a channel name
|
||||
$ms->{channel} = 'sourcechan1';
|
||||
@@ -861,8 +864,8 @@ SKIP: {
|
||||
'Returned the correct slave',
|
||||
);
|
||||
|
||||
$wfm = $ms->wait_for_master(
|
||||
master_status => $ms->get_master_status($dbh),
|
||||
$wfm = $ms->wait_for_source(
|
||||
source_status => $ms->get_source_status($dbh),
|
||||
slave_dbh => $slave1_dbh,
|
||||
timeout => 1,
|
||||
);
|
||||
@@ -872,7 +875,7 @@ SKIP: {
|
||||
'Wait for master returned no error',
|
||||
);
|
||||
|
||||
$sb->stop_sandbox(qw(chan_master1 chan_master2 chan_slave1));
|
||||
$sb->stop_sandbox(qw(chan_source1 chan_source2 chan_replica1));
|
||||
}
|
||||
|
||||
my $connected_slaves = [
|
||||
|
@@ -81,7 +81,7 @@ use DSNParser;
|
||||
use Sandbox;
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
SKIP: {
|
||||
skip 'Cannot connect to sandbox mater', 2 unless $dbh;
|
||||
|
@@ -19,7 +19,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
use Data::Dumper;
|
||||
$Data::Dumper::Indent = 1;
|
||||
|
@@ -34,7 +34,7 @@ $Data::Dumper::Quotekeys = 0;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
@@ -69,7 +69,7 @@ sub make_nibble_iter {
|
||||
|
||||
|
||||
if (my $file = $args{sql_file}) {
|
||||
$sb->load_file('master', "$in/$file");
|
||||
$sb->load_file('source', "$in/$file");
|
||||
}
|
||||
|
||||
@ARGV = $args{argv} ? @{$args{argv}} : ();
|
||||
@@ -622,7 +622,7 @@ is_deeply(
|
||||
# ############################################################################
|
||||
# Avoid infinite loops.
|
||||
# ############################################################################
|
||||
$sb->load_file('master', "$in/bad_tables.sql");
|
||||
$sb->load_file('source', "$in/bad_tables.sql");
|
||||
$dbh->do('analyze table bad_tables.inv');
|
||||
$ni = make_nibble_iter(
|
||||
db => 'bad_tables',
|
||||
@@ -855,7 +855,7 @@ is(
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/995274
|
||||
# Index case-sensitivity.
|
||||
# #############################################################################
|
||||
$sb->load_file('master', "t/pt-table-checksum/samples/undef-arrayref-bug-995274.sql");
|
||||
$sb->load_file('source', "t/pt-table-checksum/samples/undef-arrayref-bug-995274.sql");
|
||||
|
||||
eval {
|
||||
$ni = make_nibble_iter(
|
||||
|
@@ -34,7 +34,7 @@ $Data::Dumper::Quotekeys = 0;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
my $output;
|
||||
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
@@ -72,7 +72,7 @@ sub make_nibble_iter {
|
||||
my (%args) = @_;
|
||||
|
||||
if (my $file = $args{sql_file}) {
|
||||
$sb->load_file('master', "$in/$file");
|
||||
$sb->load_file('source', "$in/$file");
|
||||
}
|
||||
|
||||
@ARGV = $args{argv} ? @{$args{argv}} : ();
|
||||
@@ -258,7 +258,7 @@ ok(
|
||||
# Empty table
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/987393
|
||||
# #############################################################################
|
||||
$sb->load_file('master', "t/pt-table-checksum/samples/empty-table-bug-987393.sql");
|
||||
$sb->load_file('source', "t/pt-table-checksum/samples/empty-table-bug-987393.sql");
|
||||
|
||||
$ni = make_nibble_iter(
|
||||
db => 'test',
|
||||
|
@@ -20,7 +20,7 @@ use PerconaTest;
|
||||
# instead of writing test rows by hand.
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
my $outfile = new Outfile();
|
||||
|
||||
|
@@ -31,7 +31,7 @@ use Percona::XtraDB::Cluster;
|
||||
my $q = new Quoter();
|
||||
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_dbh = $sb->get_dbh_for('source');
|
||||
|
||||
my $cluster = Percona::XtraDB::Cluster->new();
|
||||
my $db_flavor = VersionParser->new($master_dbh)->flavor();
|
||||
@@ -74,14 +74,14 @@ local @ARGV = ();
|
||||
$o->get_opts();
|
||||
|
||||
diag("Starting master1");
|
||||
$sb->start_sandbox(type => "master", server => "master1");
|
||||
$sb->start_sandbox(type => "source", server => "source1");
|
||||
|
||||
my ($master_cxn, $slave1_cxn, $master1_cxn)
|
||||
= map {
|
||||
my $cxn = make_cxn( dsn_string => $sb->dsn_for($_) );
|
||||
$cxn->connect();
|
||||
$cxn;
|
||||
} qw( master slave1 master1 );
|
||||
} qw( source replica1 source1 );
|
||||
|
||||
for my $cxn ( $master_cxn, $slave1_cxn, $master1_cxn ) {
|
||||
ok(
|
||||
@@ -90,7 +90,7 @@ for my $cxn ( $master_cxn, $slave1_cxn, $master1_cxn ) {
|
||||
);
|
||||
}
|
||||
|
||||
diag($sb->stop_sandbox("master1"));
|
||||
diag($sb->stop_sandbox("source1"));
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
|
@@ -31,7 +31,7 @@ use Percona::XtraDB::Cluster;
|
||||
my $q = new Quoter();
|
||||
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_dbh = $sb->get_dbh_for('source');
|
||||
|
||||
my $cluster = Percona::XtraDB::Cluster->new();
|
||||
|
||||
@@ -75,9 +75,9 @@ local @ARGV = ();
|
||||
$o->get_opts();
|
||||
|
||||
diag("Starting master1");
|
||||
$sb->start_sandbox(type => "master", server => "master1");
|
||||
$sb->start_sandbox(type => "source", server => "source1");
|
||||
|
||||
my $master1_cxn = make_cxn( dsn_string => $sb->dsn_for("master1") );
|
||||
my $master1_cxn = make_cxn( dsn_string => $sb->dsn_for("source1") );
|
||||
$master1_cxn->connect();
|
||||
|
||||
diag("Starting a 1-node PXC");
|
||||
@@ -94,7 +94,7 @@ ok(
|
||||
);
|
||||
|
||||
diag("Setting node as a slave of master1");
|
||||
$sb->set_as_slave("node4", "master1");
|
||||
$sb->set_as_slave("node4", "source1");
|
||||
ok(
|
||||
!$cluster->same_cluster($master1_cxn, $cxn1),
|
||||
"->same_cluster works for master -> cluster"
|
||||
@@ -109,7 +109,7 @@ $cxn1 = make_cxn( dsn_string => $c->{node4}->{dsn} );
|
||||
$cxn1->connect();
|
||||
|
||||
diag("Setting master1 as a slave of the node");
|
||||
$sb->set_as_slave("master1", "node4");
|
||||
$sb->set_as_slave("source1", "node4");
|
||||
ok(
|
||||
!$cluster->same_cluster($cxn1, $master1_cxn),
|
||||
"->same_cluster works for cluster -> master"
|
||||
@@ -178,7 +178,7 @@ ok(
|
||||
|
||||
diag($sb->stop_sandbox(qw(node4 node5 node6 node7)));
|
||||
|
||||
diag($sb->stop_sandbox("master1"));
|
||||
diag($sb->stop_sandbox("source1"));
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
|
@@ -22,14 +22,14 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master', {no_lc=>1});
|
||||
my $dbh = $sb->get_dbh_for('source', {no_lc=>1});
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
}
|
||||
|
||||
$sb->create_dbs($dbh, ['test']);
|
||||
$sb->load_file('master', "t/lib/samples/query_review.sql");
|
||||
$sb->load_file('source', "t/lib/samples/query_review.sql");
|
||||
my $output = "";
|
||||
my $tp = new TableParser(Quoter => 'Quoter');
|
||||
my $opt_parser = new OptionParser( description => 'QueryHistory tests' );
|
||||
|
@@ -32,7 +32,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master', {no_lc=>1}); # for explain sparkline
|
||||
my $dbh = $sb->get_dbh_for('source', {no_lc=>1}); # for explain sparkline
|
||||
|
||||
my ($result, $events, $expected);
|
||||
|
||||
@@ -1186,7 +1186,7 @@ ok(
|
||||
# #############################################################################
|
||||
SKIP: {
|
||||
skip 'Cannot connect to sandbox master', 3 unless $dbh;
|
||||
$sb->load_file('master', "t/lib/samples/QueryReportFormatter/table.sql");
|
||||
$sb->load_file('source', "t/lib/samples/QueryReportFormatter/table.sql");
|
||||
|
||||
@ARGV = qw(--explain F=/tmp/12345/my.sandbox.cnf);
|
||||
$o->get_opts();
|
||||
|
@@ -23,14 +23,14 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master', {no_lc=>1, AutoCommit => 1});
|
||||
my $dbh = $sb->get_dbh_for('source', {no_lc=>1, AutoCommit => 1});
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
}
|
||||
|
||||
$sb->create_dbs($dbh, ['test']);
|
||||
$sb->load_file('master', "t/lib/samples/query_review.sql");
|
||||
$sb->load_file('source', "t/lib/samples/query_review.sql");
|
||||
my $output = "";
|
||||
my $qr = new QueryRewriter();
|
||||
my $lp = new SlowLogParser;
|
||||
|
@@ -19,7 +19,7 @@ use Sandbox;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
my $q = new Quoter;
|
||||
|
||||
@@ -213,7 +213,7 @@ SKIP: {
|
||||
}
|
||||
};
|
||||
|
||||
my $utf8_dbh = $sb->get_dbh_for('master');
|
||||
my $utf8_dbh = $sb->get_dbh_for('source');
|
||||
$utf8_dbh->{mysql_enable_utf8} = 1;
|
||||
$utf8_dbh->do("SET NAMES 'utf8'");
|
||||
SKIP: {
|
||||
|
@@ -21,7 +21,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
@@ -397,7 +397,7 @@ is(
|
||||
# #############################################################################
|
||||
# Issue 94: Enhance mk-table-checksum, add a --ignorecols option
|
||||
# #############################################################################
|
||||
$sb->load_file('master', 't/lib/samples/issue_94.sql');
|
||||
$sb->load_file('source', 't/lib/samples/issue_94.sql');
|
||||
$tbl = {
|
||||
db => 'test',
|
||||
tbl => 'issue_94',
|
||||
|
@@ -83,7 +83,7 @@ my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
|
||||
# Connect to sandbox now to make sure it's running.
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $master_dbh = $sb->get_dbh_for('master');
|
||||
my $master_dbh = $sb->get_dbh_for('source');
|
||||
my $slave_dbh = $sb->get_dbh_for('slave1');
|
||||
if ( !$master_dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
@@ -97,7 +97,7 @@ else {
|
||||
|
||||
|
||||
$sb->create_dbs($master_dbh, [qw(test)]);
|
||||
$sb->load_file('master', 't/lib/samples/issue_11.sql');
|
||||
$sb->load_file('source', 't/lib/samples/issue_11.sql');
|
||||
|
||||
my $tbl = $tp->parse(
|
||||
$tp->get_create_table($master_dbh, 'test', 'issue_11'));
|
||||
|
@@ -28,8 +28,8 @@ my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
|
||||
# Connect to sandbox now to make sure it's running.
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $master_dbh = $sb->get_dbh_for('master');
|
||||
my $slave_dbh = $sb->get_dbh_for('slave1');
|
||||
my $master_dbh = $sb->get_dbh_for('source');
|
||||
my $slave_dbh = $sb->get_dbh_for('replica1');
|
||||
|
||||
throws_ok( sub { new RowDiff() }, qr/I need a dbh/, 'DBH required' );
|
||||
$d = new RowDiff(dbh => 1);
|
||||
@@ -448,7 +448,7 @@ PXC_SKIP: {
|
||||
$d = new RowDiff(dbh => $master_dbh);
|
||||
|
||||
$sb->create_dbs($master_dbh, [qw(test)]);
|
||||
$sb->load_file('master', 't/lib/samples/issue_11.sql');
|
||||
$sb->load_file('source', 't/lib/samples/issue_11.sql');
|
||||
PerconaTest::wait_until(
|
||||
sub {
|
||||
my $r;
|
||||
|
@@ -30,7 +30,7 @@ $Data::Dumper::Quotekeys = 0;
|
||||
my $q = new Quoter();
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
my $tp = new TableParser(Quoter => $q);
|
||||
my $fi = new FileIterator();
|
||||
@@ -178,7 +178,7 @@ SKIP: {
|
||||
# ########################################################################
|
||||
# Test filters.
|
||||
# ########################################################################
|
||||
$sb->load_file('master', "t/lib/samples/SchemaIterator.sql");
|
||||
$sb->load_file('source', "t/lib/samples/SchemaIterator.sql");
|
||||
|
||||
test_so(
|
||||
filters => [qw(-d this_db_does_not_exist)],
|
||||
@@ -488,10 +488,10 @@ SKIP: {
|
||||
my $master3_port = 2900;
|
||||
my $master_basedir = "/tmp/$master3_port";
|
||||
diag(`$trunk/sandbox/stop-sandbox $master3_port >/dev/null`);
|
||||
diag(`$trunk/sandbox/start-sandbox master $master3_port >/dev/null`);
|
||||
my $dbh3 = $sb->get_dbh_for("master3");
|
||||
diag(`$trunk/sandbox/start-sandbox source $master3_port >/dev/null`);
|
||||
my $dbh3 = $sb->get_dbh_for("source3");
|
||||
|
||||
$sb->load_file('master3', "t/lib/samples/bug_1047335_crashed_table.sql");
|
||||
$sb->load_file('source3', "t/lib/samples/bug_1047335_crashed_table.sql");
|
||||
|
||||
# Create the SI object before crashing the table
|
||||
my $tmp_si = new SchemaIterator(
|
||||
@@ -600,7 +600,7 @@ diag(`/tmp/12345/use < $trunk/t/lib/samples/100-dbs-drop.sql`);
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1304062
|
||||
# #############################################################################
|
||||
|
||||
$sb->load_file('master', "t/lib/samples/SchemaIterator.sql");
|
||||
$sb->load_file('source', "t/lib/samples/SchemaIterator.sql");
|
||||
$dbh->do("CREATE TABLE d3.t1 (id int auto_increment primary key, c char(8))");
|
||||
|
||||
test_so(
|
||||
|
@@ -19,7 +19,7 @@ use SqlModes;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
|
@@ -20,7 +20,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
@@ -634,7 +634,7 @@ is_deeply(
|
||||
# #############################################################################
|
||||
# Issue 94: Enhance mk-table-checksum, add a --ignorecols option
|
||||
# #############################################################################
|
||||
$sb->load_file('master', 't/lib/samples/issue_94.sql');
|
||||
$sb->load_file('source', 't/lib/samples/issue_94.sql');
|
||||
$t= $tp->parse( $tp->get_create_table($dbh, 'test', 'issue_94') );
|
||||
my $query = $c->make_checksum_query(
|
||||
db => 'test',
|
||||
|
@@ -20,7 +20,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
@@ -550,7 +550,7 @@ SKIP: {
|
||||
# #############################################################################
|
||||
# Issue 47: TableChunker::range_num broken for very large bigint
|
||||
# #############################################################################
|
||||
$sb->load_file('master', 't/lib/samples/issue_47.sql');
|
||||
$sb->load_file('source', 't/lib/samples/issue_47.sql');
|
||||
$t = $tp->parse( $tp->get_create_table($dbh, 'test', 'issue_47') );
|
||||
my %params = $c->get_range_statistics(
|
||||
dbh => $dbh,
|
||||
@@ -591,7 +591,7 @@ is(
|
||||
'Adds USE INDEX (issue 8)'
|
||||
);
|
||||
|
||||
$sb->load_file('master', 't/lib/samples/issue_8.sql');
|
||||
$sb->load_file('source', 't/lib/samples/issue_8.sql');
|
||||
$t = $tp->parse( $tp->get_create_table($dbh, 'test', 'issue_8') );
|
||||
my @candidates = $c->find_chunk_columns(tbl_struct=>$t);
|
||||
is_deeply(
|
||||
@@ -628,7 +628,7 @@ $Data::Dumper::Quotekeys = 0;
|
||||
# is ignored then the chunks are much better and the first chunk will
|
||||
# cover the zero row.
|
||||
|
||||
$sb->load_file('master', 't/lib/samples/issue_941.sql');
|
||||
$sb->load_file('source', 't/lib/samples/issue_941.sql');
|
||||
|
||||
# We use empty SQL mode here, because zero dates do not work with
|
||||
# the default SQL mode. We do not adjust the tool, because, if users
|
||||
@@ -764,7 +764,7 @@ test_zero_row(
|
||||
# #############################################################################
|
||||
# Issue 602: mk-table-checksum issue with invalid dates
|
||||
# #############################################################################
|
||||
$sb->load_file('master', 't/pt-table-checksum/samples/issue_602.sql');
|
||||
$sb->load_file('source', 't/pt-table-checksum/samples/issue_602.sql');
|
||||
$t = $tp->parse( $tp->get_create_table($dbh, 'issue_602', 't') );
|
||||
%params = $c->get_range_statistics(
|
||||
dbh => $dbh,
|
||||
@@ -977,7 +977,7 @@ is_deeply(
|
||||
"get_first_chunkable_column(), bad preferred column and index"
|
||||
);
|
||||
|
||||
$sb->load_file('master', "t/lib/samples/t1.sql", 'test');
|
||||
$sb->load_file('source', "t/lib/samples/t1.sql", 'test');
|
||||
$t = $tp->parse( load_file('t/lib/samples/t1.sql') );
|
||||
|
||||
is_deeply(
|
||||
@@ -987,7 +987,7 @@ is_deeply(
|
||||
);
|
||||
|
||||
# char chunking ###############################################################
|
||||
$sb->load_file('master', "t/lib/samples/char-chunking/ascii.sql", 'test');
|
||||
$sb->load_file('source', "t/lib/samples/char-chunking/ascii.sql", 'test');
|
||||
$t = $tp->parse( $tp->get_create_table($dbh, 'test', 'ascii') );
|
||||
|
||||
is_deeply(
|
||||
@@ -1180,7 +1180,7 @@ SKIP: {
|
||||
);
|
||||
}
|
||||
|
||||
$sb->load_file('master', "t/lib/samples/char-chunking/world-city.sql", 'test');
|
||||
$sb->load_file('source', "t/lib/samples/char-chunking/world-city.sql", 'test');
|
||||
$t = $tp->parse( $tp->get_create_table($dbh, 'test', 'world_city') );
|
||||
%params = $c->get_range_statistics(
|
||||
dbh => $dbh,
|
||||
@@ -1269,7 +1269,7 @@ SKIP: {
|
||||
# ############################################################################
|
||||
# Bug 821673: pt-table-checksum doesn't included --where in min max queries
|
||||
# ############################################################################
|
||||
$sb->load_file('master', "t/pt-table-checksum/samples/where01.sql");
|
||||
$sb->load_file('source', "t/pt-table-checksum/samples/where01.sql");
|
||||
$t = $tp->parse( $tp->get_create_table($dbh, 'test', 'checksum_test') );
|
||||
%params = $c->get_range_statistics(
|
||||
dbh => $dbh,
|
||||
@@ -1291,7 +1291,7 @@ is(
|
||||
);
|
||||
|
||||
# char chunking
|
||||
$sb->load_file('master', "t/pt-table-checksum/samples/where02.sql");
|
||||
$sb->load_file('source', "t/pt-table-checksum/samples/where02.sql");
|
||||
$t = $tp->parse( $tp->get_create_table($dbh, 'test', 'checksum_test') );
|
||||
%params = $c->get_range_statistics(
|
||||
dbh => $dbh,
|
||||
@@ -1327,7 +1327,7 @@ is(
|
||||
# #############################################################################
|
||||
# Bug 967451: Char chunking doesn't quote column name
|
||||
# #############################################################################
|
||||
$sb->load_file('master', "t/lib/samples/char-chunking/ascii.sql", 'test');
|
||||
$sb->load_file('source', "t/lib/samples/char-chunking/ascii.sql", 'test');
|
||||
$dbh->do("ALTER TABLE test.ascii CHANGE COLUMN c `key` char(64) NOT NULL");
|
||||
$t = $tp->parse( $tp->get_create_table($dbh, 'test', 'ascii') );
|
||||
|
||||
@@ -1387,7 +1387,7 @@ is(
|
||||
# Bug 1034717: Divison by zero error when all columns tsart with the same char
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1034717
|
||||
# #############################################################################
|
||||
$sb->load_file('master', "t/lib/samples/bug_1034717.sql", 'test');
|
||||
$sb->load_file('source', "t/lib/samples/bug_1034717.sql", 'test');
|
||||
$t = $tp->parse( $tp->get_create_table($dbh, 'bug_1034717', 'table1') );
|
||||
|
||||
%params = $c->get_range_statistics(
|
||||
|
@@ -20,7 +20,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
my $q = new Quoter();
|
||||
my $tp = new TableParser(Quoter=>$q);
|
||||
@@ -69,7 +69,7 @@ SKIP: {
|
||||
);
|
||||
|
||||
# Bug 932442: column with 2 spaces
|
||||
$sb->load_file('master', "t/pt-table-checksum/samples/2-space-col.sql");
|
||||
$sb->load_file('source', "t/pt-table-checksum/samples/2-space-col.sql");
|
||||
$ddl = $tp->get_create_table($dbh, qw(test t));
|
||||
like(
|
||||
$ddl,
|
||||
@@ -749,11 +749,11 @@ is_deeply(
|
||||
SKIP: {
|
||||
skip 'Cannot connect to sandbox master', 8 unless $dbh;
|
||||
|
||||
$sb->load_file('master', 't/lib/samples/check_table.sql');
|
||||
$sb->load_file('source', 't/lib/samples/check_table.sql');
|
||||
|
||||
# msandbox user does not have GRANT privs.
|
||||
my $root_dbh = DBI->connect(
|
||||
"DBI:mysql:host=127.0.0.1;port=12345", 'root', 'msandbox',
|
||||
"DBI:mysql:host=127.0.0.1;port=12345;mysql_ssl=1", 'root', 'msandbox',
|
||||
{ PrintError => 0, RaiseError => 1 });
|
||||
|
||||
$root_dbh->do(q[CREATE USER 'user'@'%' IDENTIFIED BY '';] ) || die($root_dbh->errstr);
|
||||
|
@@ -18,7 +18,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( $dbh ) {
|
||||
plan tests => 35;
|
||||
@@ -40,7 +40,7 @@ use TableSyncer;
|
||||
use MasterSlave;
|
||||
use Retry;
|
||||
|
||||
my $mysql = $sb->_use_for('master');
|
||||
my $mysql = $sb->_use_for('source');
|
||||
|
||||
diag(`$mysql < $trunk/t/lib/samples/before-TableSyncChunk.sql`);
|
||||
|
||||
|
@@ -28,7 +28,7 @@ use PerconaTest;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
@@ -37,7 +37,7 @@ else {
|
||||
plan tests => 37;
|
||||
}
|
||||
|
||||
my $mysql = $sb->_use_for('master');
|
||||
my $mysql = $sb->_use_for('source');
|
||||
|
||||
my $q = new Quoter();
|
||||
my $ms = new MasterSlave(OptionParser=>1,DSNParser=>1,Quoter=>1);
|
||||
@@ -355,7 +355,7 @@ like(
|
||||
# #########################################################################
|
||||
# Issue 96: mk-table-sync: Nibbler infinite loop
|
||||
# #########################################################################
|
||||
$sb->load_file('master', 't/lib/samples/issue_96.sql');
|
||||
$sb->load_file('source', 't/lib/samples/issue_96.sql');
|
||||
$tbl_struct = $tp->parse($tp->get_create_table($dbh, 'issue_96', 't'));
|
||||
$t->prepare_to_sync(
|
||||
ChangeHandler => $ch,
|
||||
@@ -455,7 +455,7 @@ SKIP: {
|
||||
# chunk 2:
|
||||
my $where = '`player_id` >= 201 AND `player_id` < 301';
|
||||
|
||||
$sb->load_file('master', 't/pt-table-sync/samples/issue_560.sql');
|
||||
$sb->load_file('source', 't/pt-table-sync/samples/issue_560.sql');
|
||||
$tbl_struct = $tp->parse($tp->get_create_table($dbh, 'issue_560', 'buddy_list'));
|
||||
(undef, %plugin_args) = $t->can_sync(tbl_struct => $tbl_struct);
|
||||
$t->prepare_to_sync(
|
||||
@@ -566,7 +566,7 @@ is(
|
||||
# #############################################################################
|
||||
# Issue 804: mk-table-sync: can't nibble because index name isn't lower case?
|
||||
# #############################################################################
|
||||
$sb->load_file('master', 't/lib/samples/issue_804.sql');
|
||||
$sb->load_file('source', 't/lib/samples/issue_804.sql');
|
||||
$tbl_struct = $tp->parse($tp->get_create_table($dbh, 'issue_804', 't'));
|
||||
($can_sync, %plugin_args) = $t->can_sync(tbl_struct => $tbl_struct);
|
||||
is(
|
||||
|
@@ -39,9 +39,9 @@ use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $src_dbh = $sb->get_dbh_for('master');
|
||||
my $dst_dbh = $sb->get_dbh_for('slave1');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
my $src_dbh = $sb->get_dbh_for('source');
|
||||
my $dst_dbh = $sb->get_dbh_for('replica1');
|
||||
|
||||
if ( !$src_dbh || !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
@@ -50,8 +50,10 @@ elsif ( !$dst_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox slave';
|
||||
}
|
||||
|
||||
my $vp = VersionParser->new($dbh);
|
||||
|
||||
$sb->create_dbs($dbh, ['test']);
|
||||
$sb->load_file('master', 't/lib/samples/before-TableSyncChunk.sql');
|
||||
$sb->load_file('source', 't/lib/samples/before-TableSyncChunk.sql');
|
||||
|
||||
my $q = new Quoter();
|
||||
my $tp = new TableParser(Quoter=>$q);
|
||||
@@ -565,8 +567,8 @@ SKIP: {
|
||||
# a lock.
|
||||
$src_dbh->disconnect();
|
||||
$dst_dbh->disconnect();
|
||||
$src_dbh = $sb->get_dbh_for('master');
|
||||
$dst_dbh = $sb->get_dbh_for('slave1');
|
||||
$src_dbh = $sb->get_dbh_for('source');
|
||||
$dst_dbh = $sb->get_dbh_for('replica1');
|
||||
|
||||
$src->{dbh} = $src_dbh;
|
||||
$dst->{dbh} = $dst_dbh;
|
||||
@@ -575,7 +577,7 @@ SKIP: {
|
||||
# Test TableSyncGroupBy.
|
||||
# ###########################################################################
|
||||
make_plugins();
|
||||
$sb->load_file('master', 't/lib/samples/before-TableSyncGroupBy.sql');
|
||||
$sb->load_file('source', 't/lib/samples/before-TableSyncGroupBy.sql');
|
||||
|
||||
sync_table(
|
||||
src => "test.test1",
|
||||
@@ -604,7 +606,7 @@ is_deeply(
|
||||
# Issue 96: mk-table-sync: Nibbler infinite loop
|
||||
# #############################################################################
|
||||
make_plugins();
|
||||
$sb->load_file('master', 't/lib/samples/issue_96.sql');
|
||||
$sb->load_file('source', 't/lib/samples/issue_96.sql');
|
||||
|
||||
# Make paranoid-sure that the tables differ.
|
||||
my $r1 = $src_dbh->selectall_arrayref('SELECT from_city FROM issue_96.t WHERE package_id=4');
|
||||
@@ -703,8 +705,8 @@ is_deeply(
|
||||
# #############################################################################
|
||||
# Issue 464: Make mk-table-sync do two-way sync
|
||||
# #############################################################################
|
||||
diag(`$trunk/sandbox/start-sandbox master 12348 >/dev/null`);
|
||||
my $dbh3 = $sb->get_dbh_for('master1');
|
||||
diag(`$trunk/sandbox/start-sandbox source 12348 >/dev/null`);
|
||||
my $dbh3 = $sb->get_dbh_for('source1');
|
||||
SKIP: {
|
||||
skip 'Cannot connect to sandbox master', 7 unless $dbh;
|
||||
skip 'Cannot connect to second sandbox master', 7 unless $dbh3;
|
||||
@@ -775,11 +777,11 @@ SKIP: {
|
||||
# First bidi test with chunk size=2, roughly 9 chunks.
|
||||
# ########################################################################
|
||||
# Load "master" data.
|
||||
$sb->load_file('master', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('master', 't/pt-table-sync/samples/bidirectional/master-data.sql');
|
||||
$sb->load_file('source', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('source', 't/pt-table-sync/samples/bidirectional/master-data.sql');
|
||||
# Load remote data.
|
||||
$sb->load_file('master1', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('master1', 't/pt-table-sync/samples/bidirectional/remote-1.sql');
|
||||
$sb->load_file('source1', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('source1', 't/pt-table-sync/samples/bidirectional/remote-1.sql');
|
||||
make_plugins();
|
||||
set_bidi_callbacks();
|
||||
$tbl_struct = $tp->parse($tp->get_create_table($src_dbh, 'bidi', 't'));
|
||||
@@ -822,10 +824,10 @@ SKIP: {
|
||||
# ########################################################################
|
||||
# Test it again with a larger chunk size, roughly half the table.
|
||||
# ########################################################################
|
||||
$sb->load_file('master', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('master', 't/pt-table-sync/samples/bidirectional/master-data.sql');
|
||||
$sb->load_file('master1', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('master1', 't/pt-table-sync/samples/bidirectional/remote-1.sql');
|
||||
$sb->load_file('source', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('source', 't/pt-table-sync/samples/bidirectional/master-data.sql');
|
||||
$sb->load_file('source1', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('source1', 't/pt-table-sync/samples/bidirectional/remote-1.sql');
|
||||
make_plugins();
|
||||
set_bidi_callbacks();
|
||||
$args{ChangeHandler} = new_ch($dbh3, 0);
|
||||
@@ -850,10 +852,10 @@ SKIP: {
|
||||
# ########################################################################
|
||||
# Chunk whole table.
|
||||
# ########################################################################
|
||||
$sb->load_file('master', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('master', 't/pt-table-sync/samples/bidirectional/master-data.sql');
|
||||
$sb->load_file('master1', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('master1', 't/pt-table-sync/samples/bidirectional/remote-1.sql');
|
||||
$sb->load_file('source', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('source', 't/pt-table-sync/samples/bidirectional/master-data.sql');
|
||||
$sb->load_file('source1', 't/pt-table-sync/samples/bidirectional/table.sql');
|
||||
$sb->load_file('source1', 't/pt-table-sync/samples/bidirectional/remote-1.sql');
|
||||
make_plugins();
|
||||
set_bidi_callbacks();
|
||||
$args{ChangeHandler} = new_ch($dbh3, 0);
|
||||
@@ -895,9 +897,9 @@ SKIP: {
|
||||
make_plugins();
|
||||
# Sandbox::get_dbh_for() defaults to AutoCommit=1. Autocommit must
|
||||
# be off else commit() will cause an error.
|
||||
$dbh = $sb->get_dbh_for('master', {AutoCommit=>0});
|
||||
$src_dbh = $sb->get_dbh_for('master', {AutoCommit=>0});
|
||||
$dst_dbh = $sb->get_dbh_for('slave1', {AutoCommit=>0});
|
||||
$dbh = $sb->get_dbh_for('source', {AutoCommit=>0});
|
||||
$src_dbh = $sb->get_dbh_for('source', {AutoCommit=>0});
|
||||
$dst_dbh = $sb->get_dbh_for('replica1', {AutoCommit=>0});
|
||||
|
||||
sync_table(
|
||||
src => "test.test1",
|
||||
@@ -945,7 +947,7 @@ like(
|
||||
# Issue 672: mk-table-sync should COALESCE to avoid undef
|
||||
# #############################################################################
|
||||
make_plugins();
|
||||
$sb->load_file('master', "t/lib/samples/empty_tables.sql");
|
||||
$sb->load_file('source', "t/lib/samples/empty_tables.sql");
|
||||
|
||||
foreach my $sync( $sync_chunk, $sync_nibble, $sync_groupby ) {
|
||||
sync_table(
|
||||
@@ -974,7 +976,7 @@ foreach my $sync( $sync_chunk, $sync_nibble, $sync_groupby ) {
|
||||
# #############################################################################
|
||||
# Retry wait.
|
||||
# #############################################################################
|
||||
diag(`/tmp/12346/use -e "stop slave"`);
|
||||
diag(`/tmp/12346/use -e "stop ${replica_name}"`);
|
||||
my $output = '';
|
||||
{
|
||||
local *STDERR;
|
||||
@@ -1006,9 +1008,9 @@ my $output = '';
|
||||
"Retries wait"
|
||||
);
|
||||
}
|
||||
diag(`/tmp/12347/use -e "stop slave"`);
|
||||
diag(`/tmp/12346/use -e "start slave"`);
|
||||
diag(`/tmp/12347/use -e "start slave"`);
|
||||
diag(`/tmp/12347/use -e "stop ${replica_name}"`);
|
||||
diag(`/tmp/12346/use -e "start ${replica_name}"`);
|
||||
diag(`/tmp/12347/use -e "start ${replica_name}"`);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
@@ -1023,6 +1025,7 @@ like(
|
||||
qr/Complete test coverage/,
|
||||
'_d() works'
|
||||
);
|
||||
|
||||
$src_dbh->disconnect() if $src_dbh;
|
||||
$dst_dbh->disconnect() if $dst_dbh;
|
||||
$sb->wipe_clean($dbh);
|
||||
|
@@ -19,7 +19,7 @@ use Sandbox;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
|
||||
use Data::Dumper;
|
||||
$Data::Dumper::Indent = 1;
|
||||
|
@@ -162,7 +162,7 @@ use DSNParser;
|
||||
use Sandbox;
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
SKIP: {
|
||||
skip 'Cannot connect to sandbox master', 1 unless $dbh;
|
||||
my $now = $dbh->selectall_arrayref('SELECT NOW()')->[0]->[0];
|
||||
|
@@ -22,8 +22,8 @@ use Percona::Toolkit;
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $master_dbh = $sb->get_dbh_for('master');
|
||||
my $slave1_dbh = $sb->get_dbh_for('slave1');
|
||||
my $master_dbh = $sb->get_dbh_for('source');
|
||||
my $slave1_dbh = $sb->get_dbh_for('replica1');
|
||||
|
||||
local $ENV{PERCONA_FORCE_VERSION_CHECK} = 1;
|
||||
|
||||
|
@@ -112,7 +112,7 @@ use DSNParser;
|
||||
use Sandbox;
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
my $dbh = $sb->get_dbh_for('source');
|
||||
SKIP: {
|
||||
skip 'Cannot connect to MySQL', 2 unless $dbh;
|
||||
my $vp = new_ok "VersionParser", [ $dbh ], "new from dbh works";
|
||||
|
611
t/lib/samples/SchemaIterator/all-dbs-tbls-8.4.txt
Normal file
611
t/lib/samples/SchemaIterator/all-dbs-tbls-8.4.txt
Normal file
@@ -0,0 +1,611 @@
|
||||
mysql.columns_priv
|
||||
CREATE TABLE `columns_priv` (
|
||||
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`User` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Column_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Host`,`User`,`Db`,`Table_name`,`Column_name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Column privileges'
|
||||
|
||||
mysql.component
|
||||
CREATE TABLE `component` (
|
||||
`component_id` int unsigned NOT NULL AUTO_INCREMENT,
|
||||
`component_group_id` int unsigned NOT NULL,
|
||||
`component_urn` text NOT NULL,
|
||||
PRIMARY KEY (`component_id`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='Components'
|
||||
|
||||
mysql.db
|
||||
CREATE TABLE `db` (
|
||||
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`User` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
PRIMARY KEY (`Host`,`User`,`Db`),
|
||||
KEY `User` (`User`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Database privileges'
|
||||
|
||||
mysql.default_roles
|
||||
CREATE TABLE `default_roles` (
|
||||
`HOST` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`USER` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`DEFAULT_ROLE_HOST` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '%',
|
||||
`DEFAULT_ROLE_USER` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`HOST`,`USER`,`DEFAULT_ROLE_HOST`,`DEFAULT_ROLE_USER`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Default roles'
|
||||
|
||||
mysql.engine_cost
|
||||
CREATE TABLE `engine_cost` (
|
||||
`engine_name` varchar(64) NOT NULL,
|
||||
`device_type` int NOT NULL,
|
||||
`cost_name` varchar(64) NOT NULL,
|
||||
`cost_value` float DEFAULT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`comment` varchar(1024) DEFAULT NULL,
|
||||
`default_value` float GENERATED ALWAYS AS ((case `cost_name` when _utf8mb3'io_block_read_cost' then 1.0 when _utf8mb3'memory_block_read_cost' then 0.25 else NULL end)) VIRTUAL,
|
||||
PRIMARY KEY (`cost_name`,`engine_name`,`device_type`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC
|
||||
|
||||
mysql.func
|
||||
CREATE TABLE `func` (
|
||||
`name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`ret` tinyint NOT NULL DEFAULT '0',
|
||||
`dl` char(128) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`type` enum('function','aggregate') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
|
||||
PRIMARY KEY (`name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='User defined functions'
|
||||
|
||||
mysql.global_grants
|
||||
CREATE TABLE `global_grants` (
|
||||
`USER` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`HOST` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`PRIV` char(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
|
||||
`WITH_GRANT_OPTION` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
PRIMARY KEY (`USER`,`HOST`,`PRIV`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Extended global grants'
|
||||
|
||||
mysql.help_category
|
||||
CREATE TABLE `help_category` (
|
||||
`help_category_id` smallint unsigned NOT NULL,
|
||||
`name` char(64) NOT NULL,
|
||||
`parent_category_id` smallint unsigned DEFAULT NULL,
|
||||
`url` text NOT NULL,
|
||||
PRIMARY KEY (`help_category_id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='help categories'
|
||||
|
||||
mysql.help_keyword
|
||||
CREATE TABLE `help_keyword` (
|
||||
`help_keyword_id` int unsigned NOT NULL,
|
||||
`name` char(64) NOT NULL,
|
||||
PRIMARY KEY (`help_keyword_id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='help keywords'
|
||||
|
||||
mysql.help_relation
|
||||
CREATE TABLE `help_relation` (
|
||||
`help_topic_id` int unsigned NOT NULL,
|
||||
`help_keyword_id` int unsigned NOT NULL,
|
||||
PRIMARY KEY (`help_keyword_id`,`help_topic_id`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='keyword-topic relation'
|
||||
|
||||
mysql.help_topic
|
||||
CREATE TABLE `help_topic` (
|
||||
`help_topic_id` int unsigned NOT NULL,
|
||||
`name` char(64) NOT NULL,
|
||||
`help_category_id` smallint unsigned NOT NULL,
|
||||
`description` text NOT NULL,
|
||||
`example` text NOT NULL,
|
||||
`url` text NOT NULL,
|
||||
PRIMARY KEY (`help_topic_id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='help topics'
|
||||
|
||||
mysql.ndb_binlog_index
|
||||
CREATE TABLE `ndb_binlog_index` (
|
||||
`Position` bigint unsigned NOT NULL,
|
||||
`File` varchar(255) NOT NULL,
|
||||
`epoch` bigint unsigned NOT NULL,
|
||||
`inserts` int unsigned NOT NULL,
|
||||
`updates` int unsigned NOT NULL,
|
||||
`deletes` int unsigned NOT NULL,
|
||||
`schemaops` int unsigned NOT NULL,
|
||||
`orig_server_id` int unsigned NOT NULL,
|
||||
`orig_epoch` bigint unsigned NOT NULL,
|
||||
`gci` int unsigned NOT NULL,
|
||||
`next_position` bigint unsigned NOT NULL,
|
||||
`next_file` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`epoch`,`orig_server_id`,`orig_epoch`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC
|
||||
|
||||
mysql.password_history
|
||||
CREATE TABLE `password_history` (
|
||||
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`User` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Password_timestamp` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||
`Password` text COLLATE utf8mb3_bin,
|
||||
PRIMARY KEY (`Host`,`User`,`Password_timestamp` DESC)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Password history for user accounts'
|
||||
|
||||
mysql.plugin
|
||||
CREATE TABLE `plugin` (
|
||||
`name` varchar(64) NOT NULL DEFAULT '',
|
||||
`dl` varchar(128) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='MySQL plugins'
|
||||
|
||||
mysql.procs_priv
|
||||
CREATE TABLE `procs_priv` (
|
||||
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`User` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Routine_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
|
||||
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8mb3_bin NOT NULL,
|
||||
`Grantor` varchar(288) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
|
||||
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`Host`,`User`,`Db`,`Routine_name`,`Routine_type`),
|
||||
KEY `Grantor` (`Grantor`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Procedure privileges'
|
||||
|
||||
mysql.proxies_priv
|
||||
CREATE TABLE `proxies_priv` (
|
||||
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`User` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Proxied_host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`Proxied_user` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`With_grant` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`Grantor` varchar(288) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`),
|
||||
KEY `Grantor` (`Grantor`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='User proxy privileges'
|
||||
|
||||
mysql.replication_asynchronous_connection_failover
|
||||
CREATE TABLE `replication_asynchronous_connection_failover` (
|
||||
`Channel_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'The replication channel name that connects source and replica.',
|
||||
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT 'The source hostname that the replica will attempt to switch over the replication connection to in case of a failure.',
|
||||
`Port` int unsigned NOT NULL COMMENT 'The source port that the replica will attempt to switch over the replication connection to in case of a failure.',
|
||||
`Network_namespace` char(64) NOT NULL COMMENT 'The source network namespace that the replica will attempt to switch over the replication connection to in case of a failure. If its value is empty, connections use the default (global) namespace.',
|
||||
`Weight` tinyint unsigned NOT NULL COMMENT 'The order in which the replica shall try to switch the connection over to when there are failures. Weight can be set to a number between 1 and 100, where 100 is the highest weight and 1 the lowest.',
|
||||
`Managed_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT 'The name of the group which this server belongs to.',
|
||||
PRIMARY KEY (`Channel_name`,`Host`,`Port`,`Network_namespace`,`Managed_name`),
|
||||
KEY `Channel_name` (`Channel_name`,`Managed_name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='The source configuration details'
|
||||
|
||||
mysql.replication_asynchronous_connection_failover_managed
|
||||
CREATE TABLE `replication_asynchronous_connection_failover_managed` (
|
||||
`Channel_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'The replication channel name that connects source and replica.',
|
||||
`Managed_name` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT 'The name of the source which needs to be managed.',
|
||||
`Managed_type` char(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT 'Determines the managed type.',
|
||||
`Configuration` json DEFAULT NULL COMMENT 'The data to help manage group. For Managed_type = GroupReplication, Configuration value should contain {"Primary_weight": 80, "Secondary_weight": 60}, so that it assigns weight=80 to PRIMARY of the group, and weight=60 for rest of the members in mysql.replication_asynchronous_connection_failover table.',
|
||||
PRIMARY KEY (`Channel_name`,`Managed_name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='The managed source configuration details'
|
||||
|
||||
mysql.replication_group_configuration_version
|
||||
CREATE TABLE `replication_group_configuration_version` (
|
||||
`name` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT 'The configuration name.',
|
||||
`version` bigint unsigned NOT NULL COMMENT 'The version of the configuration name.',
|
||||
PRIMARY KEY (`name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='The group configuration version.'
|
||||
|
||||
mysql.replication_group_member_actions
|
||||
CREATE TABLE `replication_group_member_actions` (
|
||||
`name` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT 'The action name.',
|
||||
`event` char(64) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT 'The event that will trigger the action.',
|
||||
`enabled` tinyint(1) NOT NULL COMMENT 'Whether the action is enabled.',
|
||||
`type` char(64) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT 'The action type.',
|
||||
`priority` tinyint unsigned NOT NULL COMMENT 'The order on which the action will be run, value between 1 and 100, lower values first.',
|
||||
`error_handling` char(64) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT 'On errors during the action will be handled: IGNORE, CRITICAL.',
|
||||
PRIMARY KEY (`name`,`event`),
|
||||
KEY `event` (`event`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='The member actions configuration.'
|
||||
|
||||
mysql.role_edges
|
||||
CREATE TABLE `role_edges` (
|
||||
`FROM_HOST` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`FROM_USER` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`TO_HOST` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`TO_USER` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`WITH_ADMIN_OPTION` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
PRIMARY KEY (`FROM_HOST`,`FROM_USER`,`TO_HOST`,`TO_USER`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Role hierarchy and role grants'
|
||||
|
||||
mysql.server_cost
|
||||
CREATE TABLE `server_cost` (
|
||||
`cost_name` varchar(64) NOT NULL,
|
||||
`cost_value` float DEFAULT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`comment` varchar(1024) DEFAULT NULL,
|
||||
`default_value` float GENERATED ALWAYS AS ((case `cost_name` when _utf8mb3'disk_temptable_create_cost' then 20.0 when _utf8mb3'disk_temptable_row_cost' then 0.5 when _utf8mb3'key_compare_cost' then 0.05 when _utf8mb3'memory_temptable_create_cost' then 1.0 when _utf8mb3'memory_temptable_row_cost' then 0.1 when _utf8mb3'row_evaluate_cost' then 0.1 else NULL end)) VIRTUAL,
|
||||
PRIMARY KEY (`cost_name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC
|
||||
|
||||
mysql.servers
|
||||
CREATE TABLE `servers` (
|
||||
`Server_name` char(64) NOT NULL DEFAULT '',
|
||||
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`Db` char(64) NOT NULL DEFAULT '',
|
||||
`Username` char(64) NOT NULL DEFAULT '',
|
||||
`Password` char(64) NOT NULL DEFAULT '',
|
||||
`Port` int NOT NULL DEFAULT '0',
|
||||
`Socket` char(64) NOT NULL DEFAULT '',
|
||||
`Wrapper` char(64) NOT NULL DEFAULT '',
|
||||
`Owner` char(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Server_name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='MySQL Foreign Servers table'
|
||||
|
||||
mysql.tables_priv
|
||||
CREATE TABLE `tables_priv` (
|
||||
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`Db` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`User` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Table_name` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Grantor` varchar(288) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
|
||||
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Host`,`User`,`Db`,`Table_name`),
|
||||
KEY `Grantor` (`Grantor`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Table privileges'
|
||||
|
||||
mysql.time_zone
|
||||
CREATE TABLE `time_zone` (
|
||||
`Time_zone_id` int unsigned NOT NULL AUTO_INCREMENT,
|
||||
`Use_leap_seconds` enum('Y','N') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
PRIMARY KEY (`Time_zone_id`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Time zones'
|
||||
|
||||
mysql.time_zone_leap_second
|
||||
CREATE TABLE `time_zone_leap_second` (
|
||||
`Transition_time` bigint NOT NULL,
|
||||
`Correction` int NOT NULL,
|
||||
PRIMARY KEY (`Transition_time`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Leap seconds information for time zones'
|
||||
|
||||
mysql.time_zone_name
|
||||
CREATE TABLE `time_zone_name` (
|
||||
`Name` char(64) NOT NULL,
|
||||
`Time_zone_id` int unsigned NOT NULL,
|
||||
PRIMARY KEY (`Name`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Time zone names'
|
||||
|
||||
mysql.time_zone_transition
|
||||
CREATE TABLE `time_zone_transition` (
|
||||
`Time_zone_id` int unsigned NOT NULL,
|
||||
`Transition_time` bigint NOT NULL,
|
||||
`Transition_type_id` int unsigned NOT NULL,
|
||||
PRIMARY KEY (`Time_zone_id`,`Transition_time`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Time zone transitions'
|
||||
|
||||
mysql.time_zone_transition_type
|
||||
CREATE TABLE `time_zone_transition_type` (
|
||||
`Time_zone_id` int unsigned NOT NULL,
|
||||
`Transition_type_id` int unsigned NOT NULL,
|
||||
`Offset` int NOT NULL DEFAULT '0',
|
||||
`Is_DST` tinyint unsigned NOT NULL DEFAULT '0',
|
||||
`Abbreviation` char(8) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Time_zone_id`,`Transition_type_id`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Time zone transition types'
|
||||
|
||||
mysql.user
|
||||
CREATE TABLE `user` (
|
||||
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`User` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Reload_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Shutdown_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Process_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`File_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Show_db_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Super_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Repl_slave_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Repl_client_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_user_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
|
||||
`ssl_cipher` blob NOT NULL,
|
||||
`x509_issuer` blob NOT NULL,
|
||||
`x509_subject` blob NOT NULL,
|
||||
`max_questions` int unsigned NOT NULL DEFAULT '0',
|
||||
`max_updates` int unsigned NOT NULL DEFAULT '0',
|
||||
`max_connections` int unsigned NOT NULL DEFAULT '0',
|
||||
`max_user_connections` int unsigned NOT NULL DEFAULT '0',
|
||||
`plugin` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT 'caching_sha2_password',
|
||||
`authentication_string` text COLLATE utf8mb3_bin,
|
||||
`password_expired` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`password_last_changed` timestamp NULL DEFAULT NULL,
|
||||
`password_lifetime` smallint unsigned DEFAULT NULL,
|
||||
`account_locked` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_role_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Drop_role_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Password_reuse_history` smallint unsigned DEFAULT NULL,
|
||||
`Password_reuse_time` smallint unsigned DEFAULT NULL,
|
||||
`Password_require_current` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||
`User_attributes` json DEFAULT NULL,
|
||||
PRIMARY KEY (`Host`,`User`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Users and global privileges'
|
||||
|
||||
percona_test.checksums
|
||||
CREATE TABLE `checksums` (
|
||||
`db_tbl` varchar(128) NOT NULL,
|
||||
`checksum` int unsigned NOT NULL,
|
||||
PRIMARY KEY (`db_tbl`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
|
||||
|
||||
percona_test.load_data
|
||||
CREATE TABLE `load_data` (
|
||||
`i` int DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
|
||||
|
||||
percona_test.sentinel
|
||||
CREATE TABLE `sentinel` (
|
||||
`id` int NOT NULL,
|
||||
`ping` varchar(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
|
||||
|
||||
sakila.actor
|
||||
CREATE TABLE `actor` (
|
||||
`actor_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`first_name` varchar(45) NOT NULL,
|
||||
`last_name` varchar(45) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`actor_id`),
|
||||
KEY `idx_actor_last_name` (`last_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.address
|
||||
CREATE TABLE `address` (
|
||||
`address_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`address` varchar(50) NOT NULL,
|
||||
`address2` varchar(50) DEFAULT NULL,
|
||||
`district` varchar(20) NOT NULL,
|
||||
`city_id` smallint unsigned NOT NULL,
|
||||
`postal_code` varchar(10) DEFAULT NULL,
|
||||
`phone` varchar(20) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`address_id`),
|
||||
KEY `idx_fk_city_id` (`city_id`),
|
||||
CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.category
|
||||
CREATE TABLE `category` (
|
||||
`category_id` tinyint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(25) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`category_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.city
|
||||
CREATE TABLE `city` (
|
||||
`city_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`city` varchar(50) NOT NULL,
|
||||
`country_id` smallint unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`city_id`),
|
||||
KEY `idx_fk_country_id` (`country_id`),
|
||||
CONSTRAINT `fk_city_country` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=601 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.country
|
||||
CREATE TABLE `country` (
|
||||
`country_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`country` varchar(50) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`country_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.customer
|
||||
CREATE TABLE `customer` (
|
||||
`customer_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`store_id` tinyint unsigned NOT NULL,
|
||||
`first_name` varchar(45) NOT NULL,
|
||||
`last_name` varchar(45) NOT NULL,
|
||||
`email` varchar(50) DEFAULT NULL,
|
||||
`address_id` smallint unsigned NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`create_date` datetime NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`customer_id`),
|
||||
KEY `idx_fk_store_id` (`store_id`),
|
||||
KEY `idx_fk_address_id` (`address_id`),
|
||||
KEY `idx_last_name` (`last_name`),
|
||||
CONSTRAINT `fk_customer_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_customer_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=600 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.film
|
||||
CREATE TABLE `film` (
|
||||
`film_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`description` text,
|
||||
`release_year` year DEFAULT NULL,
|
||||
`language_id` tinyint unsigned NOT NULL,
|
||||
`original_language_id` tinyint unsigned DEFAULT NULL,
|
||||
`rental_duration` tinyint unsigned NOT NULL DEFAULT '3',
|
||||
`rental_rate` decimal(4,2) NOT NULL DEFAULT '4.99',
|
||||
`length` smallint unsigned DEFAULT NULL,
|
||||
`replacement_cost` decimal(5,2) NOT NULL DEFAULT '19.99',
|
||||
`rating` enum('G','PG','PG-13','R','NC-17') DEFAULT 'G',
|
||||
`special_features` set('Trailers','Commentaries','Deleted Scenes','Behind the Scenes') DEFAULT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`film_id`),
|
||||
KEY `idx_title` (`title`),
|
||||
KEY `idx_fk_language_id` (`language_id`),
|
||||
KEY `idx_fk_original_language_id` (`original_language_id`),
|
||||
CONSTRAINT `fk_film_language` FOREIGN KEY (`language_id`) REFERENCES `language` (`language_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_film_language_original` FOREIGN KEY (`original_language_id`) REFERENCES `language` (`language_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.film_actor
|
||||
CREATE TABLE `film_actor` (
|
||||
`actor_id` smallint unsigned NOT NULL,
|
||||
`film_id` smallint unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`actor_id`,`film_id`),
|
||||
KEY `idx_fk_film_id` (`film_id`),
|
||||
CONSTRAINT `fk_film_actor_actor` FOREIGN KEY (`actor_id`) REFERENCES `actor` (`actor_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_film_actor_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.film_category
|
||||
CREATE TABLE `film_category` (
|
||||
`film_id` smallint unsigned NOT NULL,
|
||||
`category_id` tinyint unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`film_id`,`category_id`),
|
||||
KEY `fk_film_category_category` (`category_id`),
|
||||
CONSTRAINT `fk_film_category_category` FOREIGN KEY (`category_id`) REFERENCES `category` (`category_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_film_category_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.film_text
|
||||
CREATE TABLE `film_text` (
|
||||
`film_id` smallint NOT NULL,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`description` text,
|
||||
PRIMARY KEY (`film_id`),
|
||||
FULLTEXT KEY `idx_title_description` (`title`,`description`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.inventory
|
||||
CREATE TABLE `inventory` (
|
||||
`inventory_id` mediumint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`film_id` smallint unsigned NOT NULL,
|
||||
`store_id` tinyint unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`inventory_id`),
|
||||
KEY `idx_fk_film_id` (`film_id`),
|
||||
KEY `idx_store_id_film_id` (`store_id`,`film_id`),
|
||||
CONSTRAINT `fk_inventory_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_inventory_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4582 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.language
|
||||
CREATE TABLE `language` (
|
||||
`language_id` tinyint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` char(20) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`language_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.payment
|
||||
CREATE TABLE `payment` (
|
||||
`payment_id` smallint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`customer_id` smallint unsigned NOT NULL,
|
||||
`staff_id` tinyint unsigned NOT NULL,
|
||||
`rental_id` int DEFAULT NULL,
|
||||
`amount` decimal(5,2) NOT NULL,
|
||||
`payment_date` datetime NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`payment_id`),
|
||||
KEY `idx_fk_staff_id` (`staff_id`),
|
||||
KEY `idx_fk_customer_id` (`customer_id`),
|
||||
KEY `fk_payment_rental` (`rental_id`),
|
||||
CONSTRAINT `fk_payment_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_payment_rental` FOREIGN KEY (`rental_id`) REFERENCES `rental` (`rental_id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_payment_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.rental
|
||||
CREATE TABLE `rental` (
|
||||
`rental_id` int NOT NULL AUTO_INCREMENT,
|
||||
`rental_date` datetime NOT NULL,
|
||||
`inventory_id` mediumint unsigned NOT NULL,
|
||||
`customer_id` smallint unsigned NOT NULL,
|
||||
`return_date` datetime DEFAULT NULL,
|
||||
`staff_id` tinyint unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`rental_id`),
|
||||
UNIQUE KEY `rental_date` (`rental_date`,`inventory_id`,`customer_id`),
|
||||
KEY `idx_fk_inventory_id` (`inventory_id`),
|
||||
KEY `idx_fk_customer_id` (`customer_id`),
|
||||
KEY `idx_fk_staff_id` (`staff_id`),
|
||||
CONSTRAINT `fk_rental_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_rental_inventory` FOREIGN KEY (`inventory_id`) REFERENCES `inventory` (`inventory_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_rental_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.staff
|
||||
CREATE TABLE `staff` (
|
||||
`staff_id` tinyint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`first_name` varchar(45) NOT NULL,
|
||||
`last_name` varchar(45) NOT NULL,
|
||||
`address_id` smallint unsigned NOT NULL,
|
||||
`picture` blob,
|
||||
`email` varchar(50) DEFAULT NULL,
|
||||
`store_id` tinyint unsigned NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`username` varchar(16) NOT NULL,
|
||||
`password` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`staff_id`),
|
||||
KEY `idx_fk_store_id` (`store_id`),
|
||||
KEY `idx_fk_address_id` (`address_id`),
|
||||
CONSTRAINT `fk_staff_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_staff_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sakila.store
|
||||
CREATE TABLE `store` (
|
||||
`store_id` tinyint unsigned NOT NULL AUTO_INCREMENT,
|
||||
`manager_staff_id` tinyint unsigned NOT NULL,
|
||||
`address_id` smallint unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`store_id`),
|
||||
UNIQUE KEY `idx_unique_manager` (`manager_staff_id`),
|
||||
KEY `idx_fk_address_id` (`address_id`),
|
||||
CONSTRAINT `fk_store_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_store_staff` FOREIGN KEY (`manager_staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3
|
||||
|
||||
sys.sys_config
|
||||
CREATE TABLE `sys_config` (
|
||||
`variable` varchar(128) NOT NULL,
|
||||
`value` varchar(128) DEFAULT NULL,
|
||||
`set_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`set_by` varchar(128) DEFAULT NULL,
|
||||
PRIMARY KEY (`variable`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
|
||||
|
56
t/lib/samples/SchemaIterator/mysql-user-ddl-8.4.txt
Normal file
56
t/lib/samples/SchemaIterator/mysql-user-ddl-8.4.txt
Normal file
@@ -0,0 +1,56 @@
|
||||
mysql.user
|
||||
CREATE TABLE `user` (
|
||||
`Host` char(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
|
||||
`User` char(32) COLLATE utf8mb3_bin NOT NULL DEFAULT '',
|
||||
`Select_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Insert_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Update_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Delete_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Drop_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Reload_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Shutdown_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Process_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`File_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Grant_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`References_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Index_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Alter_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Show_db_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Super_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Lock_tables_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Execute_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Repl_slave_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Repl_client_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Show_view_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Alter_routine_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_user_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Event_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Trigger_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '',
|
||||
`ssl_cipher` blob NOT NULL,
|
||||
`x509_issuer` blob NOT NULL,
|
||||
`x509_subject` blob NOT NULL,
|
||||
`max_questions` int unsigned NOT NULL DEFAULT '0',
|
||||
`max_updates` int unsigned NOT NULL DEFAULT '0',
|
||||
`max_connections` int unsigned NOT NULL DEFAULT '0',
|
||||
`max_user_connections` int unsigned NOT NULL DEFAULT '0',
|
||||
`plugin` char(64) COLLATE utf8mb3_bin NOT NULL DEFAULT 'caching_sha2_password',
|
||||
`authentication_string` text COLLATE utf8mb3_bin,
|
||||
`password_expired` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`password_last_changed` timestamp NULL DEFAULT NULL,
|
||||
`password_lifetime` smallint unsigned DEFAULT NULL,
|
||||
`account_locked` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Create_role_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Drop_role_priv` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT 'N',
|
||||
`Password_reuse_history` smallint unsigned DEFAULT NULL,
|
||||
`Password_reuse_time` smallint unsigned DEFAULT NULL,
|
||||
`Password_require_current` enum('N','Y') CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||
`User_attributes` json DEFAULT NULL,
|
||||
PRIMARY KEY (`Host`,`User`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC COMMENT='Users and global privileges'
|
||||
|
Reference in New Issue
Block a user