mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 05:52:27 +01:00
3320c165cf
into pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-mtr BitKeeper/etc/ignore: auto-union BitKeeper/deleted/.del-rpl_row_charset.test: Auto merged BitKeeper/deleted/.del-rpl_row_charset_innodb.test: Auto merged CMakeLists.txt: Auto merged client/mysqltest.c: Auto merged configure.in: Auto merged mysql-test/extra/binlog_tests/blackhole.test: Auto merged mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test: Auto merged mysql-test/include/mix1.inc: Auto merged mysql-test/r/ctype_big5.result: Auto merged mysql-test/r/gis.result: Auto merged mysql-test/r/mysqlbinlog.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/r/system_mysql_db.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/r/type_blob.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/r/warnings.result: Auto merged mysql-test/suite/federated/federated.result: Auto merged mysql-test/suite/federated/federated.test: Auto merged mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result: Auto merged mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result: Auto merged mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test: Auto merged mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result: Auto merged mysql-test/suite/rpl/r/rpl_row_log_innodb.result: Auto merged mysql-test/suite/rpl/r/rpl_timezone.result: Auto merged mysql-test/suite/rpl/t/rpl_load_from_master.test: Auto merged mysql-test/suite/rpl/t/rpl_rotate_logs.test: Auto merged mysql-test/suite/rpl/t/rpl_trigger.test: Auto merged mysql-test/t/csv.test: Auto merged mysql-test/t/ctype_big5.test: Auto merged mysql-test/t/gis.test: Auto merged mysql-test/t/innodb.test: Auto merged mysql-test/t/mysqldump.test: Auto merged mysql-test/t/partition.test: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/system_mysql_db_fix50117.test: Auto merged mysql-test/t/trigger.test: Auto merged mysql-test/t/trigger_notembedded.test: Auto merged mysql-test/t/type_blob.test: Auto merged mysql-test/t/view.test: Auto merged mysql-test/t/warnings.test: Auto merged sql/ha_ndbcluster.cc: Auto merged mysql-test/Makefile.am: SCCS merged mysql-test/mysql-test-run.pl: Use local version of mtr.pl mysql-test/lib/mtr_cases.pm: Use local mtr_cases.pm mysql-test/suite/rpl/t/disabled.def: Use remote disabled file mysql-test/t/disabled.def: Use remote disabled file sql/ha_ndbcluster_binlog.cc: Use remote mysql-test/extra/rpl_tests/rpl_charset.test: Manual merge mysql-test/lib/mtr_report.pm: Manual merge mysql-test/suite/binlog/r/binlog_killed_simulate.result: Manual merge mysql-test/suite/binlog/r/binlog_multi_engine.result: Manual merge mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: Manual merge mysql-test/suite/binlog/r/binlog_stm_blackhole.result: Manual merge mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Manual merge mysql-test/suite/binlog/t/binlog_killed.test: Manual merge mysql-test/suite/binlog/t/binlog_killed_simulate.test: Manual merge mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test: Manual merge mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test: Manual merge mysql-test/suite/ndb/r/ndb_binlog_format.result: Manual merge mysql-test/suite/ndb/r/ndb_restore.result: Manual merge mysql-test/suite/ndb/t/ndb_restore.test: Manual merge mysql-test/suite/rpl/include/rpl_mixed_dml.inc: Manual merge mysql-test/suite/rpl/r/rpl_stm_log.result: Manual merge mysql-test/suite/rpl/t/rpl_row_sp005.test: Manual merge mysql-test/t/log_state.test: Manual merge mysql-test/t/mysqlbinlog.test: Manual merge mysql-test/t/mysqlbinlog2.test: Manual merge mysql-test/t/upgrade.test: Manual merge
181 lines
5.9 KiB
Text
181 lines
5.9 KiB
Text
# This one assumes we are ignoring updates on tables in database mysqltest2,
|
|
# but doing the ones in database mysqltest
|
|
#################################################################
|
|
# Change Author: JBM
|
|
# Change Date: 2006-02-02
|
|
# Change: Added ENGINE=MyISAM
|
|
# Reason: LOAD from master is only supported by MyISAM
|
|
#################################################################
|
|
|
|
source include/master-slave.inc;
|
|
--disable_warnings
|
|
drop database if exists mysqltest;
|
|
drop database if exists mysqltest2;
|
|
drop database if exists mysqltest3;
|
|
connection slave;
|
|
drop database if exists mysqltest;
|
|
drop database if exists mysqltest2;
|
|
drop database if exists mysqltest3;
|
|
connection master;
|
|
create database mysqltest2;
|
|
create database mysqltest;
|
|
--enable_warnings
|
|
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
create database mysqltest2;
|
|
create table mysqltest2.foo (n int)ENGINE=MyISAM;
|
|
insert into mysqltest2.foo values(4);
|
|
connection master;
|
|
create table mysqltest2.foo (n int)ENGINE=MyISAM;
|
|
insert into mysqltest2.foo values(5);
|
|
create table mysqltest.bar (m int)ENGINE=MyISAM;
|
|
insert into mysqltest.bar values(15);
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
|
|
connection master;
|
|
drop database mysqltest;
|
|
drop database if exists mysqltest2;
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
--error 1008
|
|
drop database mysqltest;
|
|
drop database mysqltest2;
|
|
|
|
# Now let's test load data from master
|
|
|
|
# First create some databases and tables on the master
|
|
|
|
connection master;
|
|
set sql_log_bin = 0;
|
|
create database mysqltest2;
|
|
create database mysqltest;
|
|
show databases like 'mysql%';
|
|
create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
|
|
create table mysqltest2.t2(n int, s text)ENGINE=MyISAM;
|
|
insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
|
|
insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
|
|
|
|
create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
|
|
create table mysqltest.t2(n int, s text)ENGINE=MyISAM;
|
|
insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
|
|
insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
|
|
(13, 'thirteen test');
|
|
set sql_log_bin = 1;
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
|
|
# This should show that the slave is empty at this point
|
|
show databases like 'mysql%';
|
|
# Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM
|
|
# MASTER will neither touch database mysqltest nor mysqltest3
|
|
create database mysqltest2;
|
|
create table mysqltest2.t1(n int, s char(20))ENGINE=MyISAM;
|
|
insert into mysqltest2.t1 values (1, 'original foo.t1');
|
|
create table mysqltest2.t3(n int, s char(20))ENGINE=MyISAM;
|
|
insert into mysqltest2.t3 values (1, 'original foo.t3');
|
|
create database mysqltest3;
|
|
create table mysqltest3.t1(n int, s char(20))ENGINE=MyISAM;
|
|
insert into mysqltest3.t1 values (1, 'original foo2.t1');
|
|
|
|
# Create mysqltest, and mysqltest.t1, to check that it gets replaced,
|
|
# and mysqltest.t3 to check that it is not touched (there is no
|
|
# mysqltest.t3 on master)
|
|
create database mysqltest;
|
|
create table mysqltest.t1(n int, s char(20))ENGINE=MyISAM;
|
|
insert into mysqltest.t1 values (1, 'original bar.t1');
|
|
create table mysqltest.t3(n int, s char(20))ENGINE=MyISAM;
|
|
insert into mysqltest.t3 values (1, 'original bar.t3');
|
|
|
|
load data from master;
|
|
|
|
# Now let's check if we have the right tables and the right data in them
|
|
show databases like 'mysql%';
|
|
use mysqltest2;
|
|
|
|
# LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which
|
|
# databases have to be copied. So it thinks "mysqltest" has to be
|
|
# copied. Before 4.0.16 it would first drop "mysqltest", then create
|
|
# "mysqltest". This "drop" is a bug; in that case t3 would disappear. So
|
|
# here the effect of this bug (BUG#1248) would be to leave an empty
|
|
# "mysqltest" on the slave.
|
|
|
|
show tables; # should be t1 & t3
|
|
select * from t1; # should be slave's original
|
|
use mysqltest3;
|
|
show tables; # should be t1
|
|
select * from t1; # should be slave's original
|
|
use mysqltest;
|
|
show tables; # should contain master's copied t1&t2, slave's original t3
|
|
select * from mysqltest.t1;
|
|
select * from mysqltest.t2;
|
|
select * from mysqltest.t3;
|
|
|
|
# Now let's see if replication works
|
|
connection master;
|
|
insert into mysqltest.t1 values (4, 'four test');
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
select * from mysqltest.t1;
|
|
|
|
# Check that LOAD DATA FROM MASTER is able to create master.info
|
|
# if needed (if RESET SLAVE was used before), before writing to it (BUG#2922).
|
|
|
|
stop slave;
|
|
reset slave;
|
|
load data from master;
|
|
start slave;
|
|
# see if replication coordinates were restored fine
|
|
connection master;
|
|
insert into mysqltest.t1 values (5, 'five bar');
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
select * from mysqltest.t1;
|
|
|
|
# Check that LOAD DATA FROM MASTER reports the error if it can't drop a
|
|
# table to be overwritten.
|
|
# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
|
|
# insert into mysqltest.t1 values(10, 'should be there');
|
|
# flush tables;
|
|
let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
|
|
# system chmod 500 $MYSQLD_SLAVE_DATADIR/mysqltest/;
|
|
# --error 6
|
|
# load data from master; # should fail (errno 13)
|
|
# system chmod 700 $MYSQLD_SLAVE_DATADIR/mysqltest/;
|
|
# select * from mysqltest.t1; # should contain the row (10, ...)
|
|
|
|
|
|
# Check that LOAD TABLE FROM MASTER fails if the table exists on slave
|
|
--error 1050
|
|
load table mysqltest.t1 from master;
|
|
drop table mysqltest.t1;
|
|
load table mysqltest.t1 from master;
|
|
|
|
# Check what happens when requestion not existing table
|
|
#
|
|
--error 1188
|
|
load table bar.t1 from master;
|
|
|
|
# as LOAD DATA FROM MASTER failed it did not restart slave threads
|
|
# DISABLED FOR NOW
|
|
# start slave;
|
|
|
|
# Now time for cleanup
|
|
connection master;
|
|
drop database mysqltest;
|
|
drop database mysqltest2;
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
# These have to be dropped on slave because they are not replicated
|
|
drop database mysqltest2;
|
|
drop database mysqltest3;
|
|
|
|
# End of 4.1 tests
|