config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/ndb_rpl/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : /home/usr.opt/mysql57/mysql-test/suite/ndb_rpl/t/ndb_rpl_batch.test

--source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source suite/ndb_rpl/ndb_master-slave.inc

#
# Simple test to check that slave_allow_batching has at least a /2 effect
# on round trips.
# Further testing could be added in the areas of
#  - Correlation of batch size to data written
#  - Slave batching and Blobs
#  - Slave batching and hidden/autoinc keys
#  - Batching within a multi-image event with 
#    slave_allow_batching=OFF
#

--connection master

use test;

--echo Create a couple of tables to defeat Binlog Injector's
--echo creation of multi-image events which can be batch-applied
--echo on the slave regardless of slave_allow_batching

create table t1 (pk int primary key, a varchar(8000)) engine=ndb;
create table t2 (pk int primary key, a varchar(8000)) engine=ndb;

--echo Insert some data which we can later delete
--echo This also serves to 'prime' the Slave, so that NdbApi
--echo access related to slave setup (last_replicated_epoch fetch etc)
--echo can be ignored.

insert into t1 values (1, repeat("I", 80)), (2, repeat("R", 80));

--sync_slave_with_master

--echo First pass with slave_allow_batching OFF
--connection slave
set global slave_allow_batching=OFF;
show variables like 'slave_allow_batching';
#show status like 'ndb_api%slave';
--source ndb_slave_exec_info_init.inc

--connection master

--echo Check out batching
--echo Transaction includes deletes + inserts, and
--echo two different tables, shouldn't be entirely batchable
--echo without slave_allow_batching

begin;
  delete from t1;
  insert into t1 values (3, repeat("I", 80)), (4, repeat("F", 80));
  insert into t2 values (5, repeat("B", 90)), (6, repeat("E", 90));
commit;

--sync_slave_with_master
--connection slave

#show status like 'ndb_api%slave';

--disable_query_log
--disable_result_log
SELECT @start_exec_count:=@init_wait_exec_complete_count_slave;
SELECT @start_pk_op_count:=@init_pk_op_count_slave;
--enable_result_log
--enable_query_log

--source ndb_slave_exec_info_init.inc

--disable_query_log
--disable_result_log
SELECT @batching_off_execs:=@init_wait_exec_complete_count_slave - @start_exec_count AS 'Exec_count';
SELECT @batching_off_pk_ops:=@init_pk_op_count_slave - @start_pk_op_count AS 'Pk_op_count';
--enable_result_log
--enable_query_log

--connection master
delete from t1;
delete from t2;
insert into t1 values (1, repeat("I", 80)), (2, repeat("R", 80));

--sync_slave_with_master
--connection slave
--echo Second pass with slave_allow_batching ON
set global slave_allow_batching=ON;
show variables like 'slave_allow_batching';
#show status like 'ndb_api%slave';
--source ndb_slave_exec_info_init.inc

--connection master

--echo Check out batching
--echo Transaction includes deletes + inserts, and
--echo two different tables, shouldn't be batchable
--echo without slave_allow_batching

begin;
  delete from t1;
  insert into t1 values (3, repeat("I", 80)), (4, repeat("F", 80));
  insert into t2 values (5, repeat("B", 90)), (6, repeat("E", 90));
commit;

--sync_slave_with_master
--connection slave

#show status like 'ndb_api%slave';

--echo Determine slave activity in terms of PK ops and execute() calls
--disable_query_log
--disable_result_log
SELECT @start_exec_count:=@init_wait_exec_complete_count_slave;
SELECT @start_pk_op_count:=@init_pk_op_count_slave;
--enable_result_log 
--enable_query_log

--source ndb_slave_exec_info_init.inc

--disable_query_log
--disable_result_log
SELECT @batching_on_execs:=@init_wait_exec_complete_count_slave - @start_exec_count AS 'Exec_count';
SELECT @batching_on_pk_ops:=@init_pk_op_count_slave - @start_pk_op_count AS 'Pk_op_count';
--enable_result_log 
--enable_query_log

--echo Check that test compared like-for-like, and that slave_allow_batching
--echo came out ahead by a factor of at least 2.
SELECT @batching_on_pk_ops = @batching_off_pk_ops AS 'Fair contest';
SELECT @batching_off_pk_ops >=4 as 'Batching can improve matters';
SELECT @batching_on_execs * 2 < @batching_off_execs AS 'slave_allow_batching works';

--echo Cleanup
--connection master
drop table t2;
drop table t1;
--sync_slave_with_master
--connection master

--source include/rpl_end.inc

Man Man