Commit 89784874 authored by Rich Prohaska's avatar Rich Prohaska

DB-714 read free replication

parent 3c64729c
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, primary key(a)) engine=tokudb;
insert into t values (1);
insert into t values (2),(3);
insert into t values (4);
include/diff_tables.inc [master:test.t, slave:test.t]
delete from t where a=2;
select unix_timestamp() into @tstart;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5;
@tend-@tstart <= 5
1
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, primary key(a)) engine=tokudb;
insert into t values (1);
insert into t values (2),(3);
insert into t values (4);
include/diff_tables.inc [master:test.t, slave:test.t]
delete from t where a=2;
select unix_timestamp() into @tstart;
select unix_timestamp() into @tend;
select @tend-@tstart > 5;
@tend-@tstart > 5
1
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, b bigint not null, primary key(a)) engine=tokudb;
insert into t values (1,0);
insert into t values (2,0),(3,0);
insert into t values (4,0);
include/diff_tables.inc [master:test.t, slave:test.t]
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5;
@tend-@tstart <= 5
1
select * from t;
a b
1 3
2 2
3 5
4 3
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, b bigint not null, primary key(a)) engine=tokudb;
insert into t values (1,0);
insert into t values (2,0),(3,0);
insert into t values (4,0);
include/diff_tables.inc [master:test.t, slave:test.t]
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5;
@tend-@tstart <= 5
0
select * from t;
a b
1 3
2 2
3 5
4 3
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, b bigint not null, primary key(a)) engine=tokudb;
insert into t values (1,0);
insert into t values (2,0),(3,0);
insert into t values (4,0);
include/diff_tables.inc [master:test.t, slave:test.t]
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5;
@tend-@tstart <= 5
0
select * from t;
a b
1 3
2 2
3 5
4 3
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, b bigint not null, primary key(a)) engine=tokudb;
insert into t values (1,0);
insert into t values (2,0),(3,0);
insert into t values (4,0);
include/diff_tables.inc [master:test.t, slave:test.t]
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5;
@tend-@tstart <= 5
0
select * from t;
a b
1 3
2 2
3 5
4 3
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, b bigint not null, c bigint not null, primary key(a), unique key(c)) engine=tokudb;
insert into t values (1,0,-1);
insert into t values (2,0,-2),(3,0,-3);
insert into t values (4,0,-4);
include/diff_tables.inc [master:test.t, slave:test.t]
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5;
@tend-@tstart <= 5
1
select * from t;
a b c
1 3 -1
2 2 -2
3 5 -3
4 3 -4
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, b bigint not null, c bigint not null, primary key(a), unique key(c)) engine=tokudb;
insert into t values (1,0,-1);
insert into t values (2,0,-2),(3,0,-3);
insert into t values (4,0,-4);
include/diff_tables.inc [master:test.t, slave:test.t]
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5;
@tend-@tstart <= 5
0
select * from t;
a b c
1 3 -1
2 2 -2
3 5 -3
4 3 -4
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, primary key(a)) engine=tokudb;
select unix_timestamp() into @tstart;
insert into t values (1);
insert into t values (2),(3);
insert into t values (4);
select unix_timestamp()-@tstart <= 10;
unix_timestamp()-@tstart <= 10
1
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, primary key(a)) engine=tokudb;
select unix_timestamp() into @tstart;
insert into t values (1);
insert into t values (2),(3);
insert into t values (4);
select unix_timestamp()-@tstart <= 10;
unix_timestamp()-@tstart <= 10
0
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, b bigint not null, primary key(a), unique key(b)) engine=tokudb;
select unix_timestamp() into @tstart;
insert into t values (1,2);
insert into t values (2,3),(3,4);
insert into t values (4,5);
select unix_timestamp()-@tstart <= 10;
unix_timestamp()-@tstart <= 10
1
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
include/master-slave.inc
[connection master]
drop table if exists t;
create table t (a bigint not null, b bigint not null, primary key(a), unique key(b)) engine=tokudb;
select unix_timestamp() into @tstart;
insert into t values (1,2);
insert into t values (2,3),(3,4);
insert into t values (4,5);
select unix_timestamp()-@tstart <= 10;
unix_timestamp()-@tstart <= 10
0
include/diff_tables.inc [master:test.t, slave:test.t]
drop table if exists t;
include/rpl_end.inc
--read-only=ON --tokudb-rpl-unique-checks-delay=10000 --tokudb-rpl-unique-checks=OFF --tokudb-rpl-lookup-rows-delay=10000 --tokudb-rpl-lookup-rows=OFF
# test replicated delete rows log events on a table with a primary key.
# the slave is read only with tokudb rpl row lookups OFF.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, primary key(a)) engine=$engine;
# show create table t;
insert into t values (1);
insert into t values (2),(3);
insert into t values (4);
# wait for the inserts to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# delete a row
connection master;
delete from t where a=2;
select unix_timestamp() into @tstart;
# wait for the delete to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5; # assert no delay in the delete time
# diff tables
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=0 --tokudb-rpl-unique-checks=ON --tokudb-rpl-lookup-rows-delay=10000 --tokudb-rpl-lookup-rows=ON
# test replicated delete rows log events on a table with a primary key.
# the slave is read only with tokudb rpl row lookups ON.
# this will cause SLOW deletes.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, primary key(a)) engine=$engine;
# show create table t;
insert into t values (1);
insert into t values (2),(3);
insert into t values (4);
# wait for the inserts to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# delete a row
connection master;
delete from t where a=2;
select unix_timestamp() into @tstart;
# wait for the delete to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp() into @tend;
select @tend-@tstart > 5; # assert big delay in the delete time
# diff tables
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=10000 --tokudb-rpl-unique-checks=OFF --tokudb-rpl-lookup-rows-delay=10000 --tokudb-rpl-lookup-rows=OFF
# test replicated update rows log events on a table with a primary key.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, b bigint not null, primary key(a)) engine=$engine;
# show create table t;
insert into t values (1,0);
insert into t values (2,0),(3,0);
insert into t values (4,0);
# wait for the inserts to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# delete a row
connection master;
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
# wait for the delete to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5; # assert no delay in the delete time
connection slave;
select * from t;
# diff tables
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=10000 --tokudb-rpl-unique-checks=OFF --tokudb-rpl-lookup-rows-delay=10000 --tokudb-rpl-lookup-rows=ON
# test replicated update rows log events on a table with a primary key.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, b bigint not null, primary key(a)) engine=$engine;
# show create table t;
insert into t values (1,0);
insert into t values (2,0),(3,0);
insert into t values (4,0);
# wait for the inserts to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# delete a row
connection master;
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
# wait for the delete to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5; # assert no delay in the delete time
connection slave;
select * from t;
# diff tables
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=10000 --tokudb-rpl-unique-checks=ON --tokudb-rpl-lookup-rows-delay=10000 --tokudb-rpl-lookup-rows=OFF
# test replicated update rows log events on a table with a primary key.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, b bigint not null, primary key(a)) engine=$engine;
# show create table t;
insert into t values (1,0);
insert into t values (2,0),(3,0);
insert into t values (4,0);
# wait for the inserts to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# delete a row
connection master;
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
# wait for the delete to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5; # assert no delay in the delete time
connection slave;
select * from t;
# diff tables
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=10000 --tokudb-rpl-unique-checks=ON --tokudb-rpl-lookup-rows-delay=10000 --tokudb-rpl-lookup-rows=ON
# test replicated update rows log events on a table with a primary key.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, b bigint not null, primary key(a)) engine=$engine;
# show create table t;
insert into t values (1,0);
insert into t values (2,0),(3,0);
insert into t values (4,0);
# wait for the inserts to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# delete a row
connection master;
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
# wait for the delete to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5; # assert no delay in the delete time
connection slave;
select * from t;
# diff tables
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=10000 --tokudb-rpl-unique-checks=OFF --tokudb-rpl-lookup-rows-delay=10000 --tokudb-rpl-lookup-rows=OFF
# test replicated update rows log events on a table with a primary key.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, b bigint not null, c bigint not null, primary key(a), unique key(c)) engine=$engine;
# show create table t;
insert into t values (1,0,-1);
insert into t values (2,0,-2),(3,0,-3);
insert into t values (4,0,-4);
# wait for the inserts to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# delete a row
connection master;
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
# wait for the delete to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5; # assert no delay in the delete time
connection slave;
select * from t;
# diff tables
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=10000 --tokudb-rpl-unique-checks=OFF --tokudb-rpl-lookup-rows-delay=10000 --tokudb-rpl-lookup-rows=ON
# test replicated update rows log events on a table with a primary key.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, b bigint not null, c bigint not null, primary key(a), unique key(c)) engine=$engine;
# show create table t;
insert into t values (1,0,-1);
insert into t values (2,0,-2),(3,0,-3);
insert into t values (4,0,-4);
# wait for the inserts to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# delete a row
connection master;
update t set b=b+1 where a=2;
update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
select unix_timestamp() into @tstart;
# wait for the delete to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp() into @tend;
select @tend-@tstart <= 5; # assert no delay in the delete time
connection slave;
select * from t;
# diff tables
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=OFF
# test replicated write rows log events on a table with a primary key.
# the slave is read only with tokudb unique checks disabled.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_unique_checks%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, primary key(a)) engine=$engine;
# show create table t;
select unix_timestamp() into @tstart;
insert into t values (1);
insert into t values (2),(3);
insert into t values (4);
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp()-@tstart <= 10;
connection slave;
# insert into t values (5); # test read-only
# show create table t;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=10000 --tokudb-rpl-unique-checks=ON
# test replicated write rows log events on a table with a primary key.
# the slave is read only with tokudb unique checks disabled.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_unique_checks%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, primary key(a)) engine=$engine;
# show create table t;
select unix_timestamp() into @tstart;
insert into t values (1);
insert into t values (2),(3);
insert into t values (4);
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp()-@tstart <= 10;
connection slave;
# insert into t values (5); # test read-only
# show create table t;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=OFF
# test replicated write rows log events on a table with a primary key and a unique secondary key.
# the slave is read only with tokudb unique checks disabled.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_unique_checks%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, b bigint not null, primary key(a), unique key(b)) engine=$engine;
# show create table t;
select unix_timestamp() into @tstart;
insert into t values (1,2);
insert into t values (2,3),(3,4);
insert into t values (4,5);
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp()-@tstart <= 10;
connection slave;
# show create table t;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
--read-only=ON --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=ON
# test replicated write rows log events on a table with a primary key and a unique secondary key.
# the slave is read only with tokudb unique checks disabled.
source include/have_tokudb.inc;
let $engine=tokudb;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
# initialize
connection master;
disable_warnings;
drop table if exists t;
enable_warnings;
connection slave;
# show variables like 'read_only';
# show variables like 'tokudb_rpl_unique_checks%';
# insert some rows
connection master;
# select @@binlog_format;
# select @@autocommit;
eval create table t (a bigint not null, b bigint not null, primary key(a), unique key(b)) engine=$engine;
# show create table t;
select unix_timestamp() into @tstart;
insert into t values (1,2);
insert into t values (2,3),(3,4);
insert into t values (4,5);
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
select unix_timestamp()-@tstart <= 10;
connection slave;
# show create table t;
# diff tables
connection master;
--let $diff_tables= master:test.t, slave:test.t
source include/diff_tables.inc;
# cleanup
connection master;
drop table if exists t;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
source include/rpl_end.inc;
This diff is collapsed.
...@@ -799,6 +799,19 @@ class ha_tokudb : public handler { ...@@ -799,6 +799,19 @@ class ha_tokudb : public handler {
private: private:
int do_optimize(THD *thd); int do_optimize(THD *thd);
int map_to_handler_error(int error); int map_to_handler_error(int error);
public:
void rpl_before_write_rows();
void rpl_after_write_rows();
void rpl_before_delete_rows();
void rpl_after_delete_rows();
void rpl_before_update_rows();
void rpl_after_update_rows();
bool rpl_lookup_rows();
private:
bool in_rpl_write_rows;
bool in_rpl_delete_rows;
bool in_rpl_update_rows;
}; };
#if TOKU_INCLUDE_OPTION_STRUCTS #if TOKU_INCLUDE_OPTION_STRUCTS
......
...@@ -1442,6 +1442,10 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = { ...@@ -1442,6 +1442,10 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
#if TOKU_INCLUDE_XA #if TOKU_INCLUDE_XA
MYSQL_SYSVAR(support_xa), MYSQL_SYSVAR(support_xa),
#endif #endif
MYSQL_SYSVAR(rpl_unique_checks),
MYSQL_SYSVAR(rpl_unique_checks_delay),
MYSQL_SYSVAR(rpl_lookup_rows),
MYSQL_SYSVAR(rpl_lookup_rows_delay),
NULL NULL
}; };
......
...@@ -504,17 +504,20 @@ static TYPELIB tokudb_empty_scan_typelib = { ...@@ -504,17 +504,20 @@ static TYPELIB tokudb_empty_scan_typelib = {
NULL NULL
}; };
static MYSQL_THDVAR_ENUM(empty_scan, static MYSQL_THDVAR_ENUM(empty_scan, PLUGIN_VAR_OPCMDARG,
PLUGIN_VAR_OPCMDARG,
"TokuDB algorithm to check if the table is empty when opened. ", "TokuDB algorithm to check if the table is empty when opened. ",
NULL, NULL, TOKUDB_EMPTY_SCAN_RL, &tokudb_empty_scan_typelib NULL, NULL, TOKUDB_EMPTY_SCAN_RL, &tokudb_empty_scan_typelib
); );
#if TOKUDB_CHECK_JEMALLOC #if TOKUDB_CHECK_JEMALLOC
static uint tokudb_check_jemalloc; static uint tokudb_check_jemalloc;
static MYSQL_SYSVAR_UINT(check_jemalloc, tokudb_check_jemalloc, 0, "Check if jemalloc is linked", NULL, NULL, 1, 0, 1, 0); static MYSQL_SYSVAR_UINT(check_jemalloc, tokudb_check_jemalloc, 0, "Check if jemalloc is linked",
NULL, NULL, 1, 0, 1, 0);
#endif #endif
static MYSQL_THDVAR_BOOL(bulk_fetch, PLUGIN_VAR_THDLOCAL, "enable bulk fetch",
NULL /*check*/, NULL /*update*/, true /*default*/);
#if TOKU_INCLUDE_XA #if TOKU_INCLUDE_XA
static MYSQL_THDVAR_BOOL(support_xa, static MYSQL_THDVAR_BOOL(support_xa,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
...@@ -525,7 +528,17 @@ static MYSQL_THDVAR_BOOL(support_xa, ...@@ -525,7 +528,17 @@ static MYSQL_THDVAR_BOOL(support_xa,
); );
#endif #endif
static MYSQL_THDVAR_BOOL(bulk_fetch, PLUGIN_VAR_THDLOCAL, "enable bulk fetch", NULL /*check*/, NULL /*update*/, true /*default*/); static MYSQL_THDVAR_BOOL(rpl_unique_checks, PLUGIN_VAR_THDLOCAL, "enable unique checks on replication slave",
NULL /*check*/, NULL /*update*/, true /*default*/);
static MYSQL_THDVAR_ULONGLONG(rpl_unique_checks_delay, PLUGIN_VAR_THDLOCAL, "time in milliseconds to add to unique checks test on replication slave",
NULL, NULL, 0 /*default*/, 0 /*min*/, ~0ULL /*max*/, 1 /*blocksize*/);
static MYSQL_THDVAR_BOOL(rpl_lookup_rows, PLUGIN_VAR_THDLOCAL, "lookup a row on rpl slave",
NULL /*check*/, NULL /*update*/, true /*default*/);
static MYSQL_THDVAR_ULONGLONG(rpl_lookup_rows_delay, PLUGIN_VAR_THDLOCAL, "time in milliseconds to add to lookups on replication slave",
NULL, NULL, 0 /*default*/, 0 /*min*/, ~0ULL /*max*/, 1 /*blocksize*/);
extern HASH tokudb_open_tables; extern HASH tokudb_open_tables;
extern pthread_mutex_t tokudb_mutex; extern pthread_mutex_t tokudb_mutex;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment