mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
704becf228
include/mysqld_error.h: new errors mysql-test/r/rpl000009.result: test load data from master mysql-test/t/rpl000009.test: test load data from master sql/mini_client.cc: extra functionality needed for load data from master and other things sql/mini_client.h: addition to API sql/mysql_priv.h: mysql_create_db()/mysql_rm_db() now return a value sql/share/english/errmsg.txt: more error messages sql/slave.cc: cleanup of fetch_nx_table() sql/slave.h: cleanup of fetch_nx_table() sql/sql_base.cc: remove unused code originally written for retrieving a non-existent table in slave thread sql/sql_class.cc: remove unused replication variables sql/sql_class.h: remove unused replication variabled sql/sql_db.cc: make mysql_create_db()/mysql_rm_db() work with thd == 0 (do not write messages to the net) and instead return success/error sql/sql_lex.h: added SQLCOM_LOAD_MASTER_DATA sql/sql_parse.cc: LOAD MASTER DATA, cleanup of LOAD TABLE FROM MASTER sql/sql_repl.cc: LOAD DATA FROM MASTER sql/sql_repl.h: LOAD DATA FROM MASTER sql/sql_yacc.yy: LOAD DATA FROM MASTER
86 lines
2.2 KiB
Text
86 lines
2.2 KiB
Text
#this one assumes we are ignoring updates on tables in database foo, but doing
|
|
#the ones in database bar
|
|
source include/master-slave.inc;
|
|
connection master;
|
|
drop database if exists foo;
|
|
create database foo;
|
|
drop database if exists bar;
|
|
create database bar;
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
drop table if exists foo.foo;
|
|
create table foo.foo (n int);
|
|
insert into foo.foo values(4);
|
|
connection master;
|
|
drop table if exists foo.foo;
|
|
create table foo.foo (n int);
|
|
insert into foo.foo values(5);
|
|
drop table if exists bar.bar;
|
|
create table bar.bar (m int);
|
|
insert into bar.bar values(15);
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
select foo.foo.n,bar.bar.m from foo.foo,bar.bar;
|
|
connection master;
|
|
drop database if exists bar;
|
|
drop database if exists foo;
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
drop database if exists bar;
|
|
drop database if exists foo;
|
|
|
|
#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 foo;
|
|
create database bar;
|
|
show databases;
|
|
create table foo.t1(n int, s char(20));
|
|
create table foo.t2(n int, s text);
|
|
insert into foo.t1 values (1, 'one'), (2, 'two'), (3, 'three');
|
|
insert into foo.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
|
|
|
|
create table bar.t1(n int, s char(20));
|
|
create table bar.t2(n int, s text);
|
|
insert into bar.t1 values (1, 'one bar'), (2, 'two bar'), (3, 'three bar');
|
|
insert into bar.t2 values (11, 'eleven bar'), (12, 'twelve bar'),
|
|
(13, 'thirteen bar');
|
|
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;
|
|
load data from master;
|
|
|
|
#now let's check if we have the right tables and the right data in them
|
|
show databases;
|
|
use foo;
|
|
show tables;
|
|
use bar;
|
|
show tables;
|
|
select * from bar.t1;
|
|
select * from bar.t2;
|
|
|
|
#now let's see if replication works
|
|
connection master;
|
|
insert into bar.t1 values (4, 'four bar');
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
select * from bar.t1;
|
|
|
|
#now time for cleanup
|
|
connection master;
|
|
drop database bar;
|
|
drop database foo;
|
|
save_master_pos;
|
|
connection slave;
|
|
sync_with_master;
|
|
|