Merge branch 'master' into releases/tokudb-7.5
This commit is contained in:
commit
b54a7af40d
14
mysql-test/suite/rpl/r/rpl_tokudb_read_only_ff.result
Normal file
14
mysql-test/suite/rpl/r/rpl_tokudb_read_only_ff.result
Normal file
@ -0,0 +1,14 @@
|
||||
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
|
14
mysql-test/suite/rpl/r/rpl_tokudb_read_only_ft.result
Normal file
14
mysql-test/suite/rpl/r/rpl_tokudb_read_only_ft.result
Normal file
@ -0,0 +1,14 @@
|
||||
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
|
14
mysql-test/suite/rpl/r/rpl_tokudb_read_only_tf.result
Normal file
14
mysql-test/suite/rpl/r/rpl_tokudb_read_only_tf.result
Normal file
@ -0,0 +1,14 @@
|
||||
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
|
14
mysql-test/suite/rpl/r/rpl_tokudb_read_only_tt.result
Normal file
14
mysql-test/suite/rpl/r/rpl_tokudb_read_only_tt.result
Normal file
@ -0,0 +1,14 @@
|
||||
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
|
1
mysql-test/suite/rpl/t/rpl_tokudb_read_only_ff-slave.opt
Normal file
1
mysql-test/suite/rpl/t/rpl_tokudb_read_only_ff-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
--read-only=OFF --tokudb-rpl-check-readonly=OFF --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=OFF
|
53
mysql-test/suite/rpl/t/rpl_tokudb_read_only_ff.test
Normal file
53
mysql-test/suite/rpl/t/rpl_tokudb_read_only_ff.test
Normal file
@ -0,0 +1,53 @@
|
||||
# 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;
|
||||
|
1
mysql-test/suite/rpl/t/rpl_tokudb_read_only_ft-slave.opt
Normal file
1
mysql-test/suite/rpl/t/rpl_tokudb_read_only_ft-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
--read-only=OFF --tokudb-rpl-check-readonly=ON --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=OFF
|
53
mysql-test/suite/rpl/t/rpl_tokudb_read_only_ft.test
Normal file
53
mysql-test/suite/rpl/t/rpl_tokudb_read_only_ft.test
Normal file
@ -0,0 +1,53 @@
|
||||
# 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;
|
||||
|
1
mysql-test/suite/rpl/t/rpl_tokudb_read_only_tf-slave.opt
Normal file
1
mysql-test/suite/rpl/t/rpl_tokudb_read_only_tf-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
--read-only=ON --tokudb-rpl-check-readonly=OFF --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=OFF
|
53
mysql-test/suite/rpl/t/rpl_tokudb_read_only_tf.test
Normal file
53
mysql-test/suite/rpl/t/rpl_tokudb_read_only_tf.test
Normal file
@ -0,0 +1,53 @@
|
||||
# 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;
|
||||
|
1
mysql-test/suite/rpl/t/rpl_tokudb_read_only_tt-slave.opt
Normal file
1
mysql-test/suite/rpl/t/rpl_tokudb_read_only_tt-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
--read-only=ON --tokudb-rpl-check-readonly=ON --tokudb-rpl-unique-checks-delay=5000 --tokudb-rpl-unique-checks=OFF
|
53
mysql-test/suite/rpl/t/rpl_tokudb_read_only_tt.test
Normal file
53
mysql-test/suite/rpl/t/rpl_tokudb_read_only_tt.test
Normal file
@ -0,0 +1,53 @@
|
||||
# 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;
|
||||
|
@ -3545,8 +3545,12 @@ static void maybe_do_unique_checks_delay(THD *thd) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool need_read_only(THD *thd) {
|
||||
return opt_readonly || !THDVAR(thd, rpl_check_readonly);
|
||||
}
|
||||
|
||||
static bool do_unique_checks(THD *thd, bool do_rpl_event) {
|
||||
if (do_rpl_event && thd->slave_thread && opt_readonly && !THDVAR(thd, rpl_unique_checks))
|
||||
if (do_rpl_event && thd->slave_thread && need_read_only(thd) && !THDVAR(thd, rpl_unique_checks))
|
||||
return false;
|
||||
else
|
||||
return !thd_test_options(thd, OPTION_RELAXED_UNIQUE_CHECKS);
|
||||
|
@ -1466,6 +1466,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
|
||||
MYSQL_SYSVAR(rpl_unique_checks_delay),
|
||||
MYSQL_SYSVAR(rpl_lookup_rows),
|
||||
MYSQL_SYSVAR(rpl_lookup_rows_delay),
|
||||
MYSQL_SYSVAR(rpl_check_readonly),
|
||||
MYSQL_SYSVAR(optimize_index_name),
|
||||
MYSQL_SYSVAR(optimize_index_fraction),
|
||||
MYSQL_SYSVAR(optimize_throttle),
|
||||
|
@ -545,6 +545,9 @@ static MYSQL_THDVAR_BOOL(rpl_lookup_rows, PLUGIN_VAR_THDLOCAL, "lookup a row on
|
||||
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*/);
|
||||
|
||||
static MYSQL_THDVAR_BOOL(rpl_check_readonly, PLUGIN_VAR_THDLOCAL, "check if the slave is read only",
|
||||
NULL /*check*/, NULL /*update*/, true /*default*/);
|
||||
|
||||
static MYSQL_THDVAR_STR(optimize_index_name, PLUGIN_VAR_THDLOCAL + PLUGIN_VAR_MEMALLOC, "optimize index name (default all indexes)", NULL /*check*/, NULL /*update*/, NULL /*default*/);
|
||||
|
||||
static MYSQL_THDVAR_DOUBLE(optimize_index_fraction, 0, "optimize index fraction (default 1.0 all)", NULL /*check*/, NULL /*update*/, 1.0 /*def*/, 0 /*min*/, 1.0 /*max*/, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user