From: Frazer Clement Date: December 10 2012 2:07pm Subject: bzr push into mysql-5.1-telco-7.1 branch (frazer.clement:4689 to 4690) List-Archive: http://lists.mysql.com/commits/145467 Message-Id: <201212101407.qBAE78vt019817@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4690 Frazer Clement 2012-12-10 [merge] Merge 7.0->7.1 added: mysql-test/suite/ndb_rpl/r/ndb_rpl_batch.result mysql-test/suite/ndb_rpl/t/ndb_rpl_batch.test mysql-test/suite/ndb_rpl/t/ndb_slave_exec_info_init.inc 4689 Frazer Clement 2012-12-03 [merge] Merge 7.1->7.2 modified: mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_epoch_trans.result mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch_trans.cnf mysql-test/suite/ndb_rpl/t/ndb_rpl_conflict_epoch_trans.test === added file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_batch.result' --- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_batch.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_batch.result 2012-12-10 12:09:22 +0000 @@ -0,0 +1,60 @@ +include/master-slave.inc +[connection master] +use test; +Create a couple of tables to defeat Binlog Injector's +creation of multi-image events which can be batch-applied +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; +Insert some data which we can later delete +This also serves to 'prime' the Slave, so that NdbApi +access related to slave setup (last_replicated_epoch fetch etc) +can be ignored. +insert into t1 values (1, repeat("I", 80)), (2, repeat("R", 80)); +First pass with slave_allow_batching OFF +set global slave_allow_batching=OFF; +show variables like 'slave_allow_batching'; +Variable_name Value +slave_allow_batching OFF +Check out batching +Transaction includes deletes + inserts, and +two different tables, shouldn't be entirely batchable +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; +delete from t1; +delete from t2; +insert into t1 values (1, repeat("I", 80)), (2, repeat("R", 80)); +Second pass with slave_allow_batching ON +set global slave_allow_batching=ON; +show variables like 'slave_allow_batching'; +Variable_name Value +slave_allow_batching ON +Check out batching +Transaction includes deletes + inserts, and +two different tables, shouldn't be batchable +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; +Determine slave activity in terms of PK ops and execute() calls +Check that test compared like-for-like, and that slave_allow_batching +came out ahead by a factor of at least 2. +SELECT @batching_on_pk_ops = @batching_off_pk_ops AS 'Fair contest'; +Fair contest +1 +SELECT @batching_off_pk_ops >=4 as 'Batching can improve matters'; +Batching can improve matters +1 +SELECT @batching_on_execs * 2 < @batching_off_execs AS 'slave_allow_batching works'; +slave_allow_batching works +1 +Cleanup +drop table t2; +drop table t1; +include/rpl_end.inc === added file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_batch.test' --- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_batch.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_batch.test 2012-12-10 12:09:22 +0000 @@ -0,0 +1,138 @@ +--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 === added file 'mysql-test/suite/ndb_rpl/t/ndb_slave_exec_info_init.inc' --- a/mysql-test/suite/ndb_rpl/t/ndb_slave_exec_info_init.inc 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/ndb_rpl/t/ndb_slave_exec_info_init.inc 2012-12-10 12:09:22 +0000 @@ -0,0 +1,8 @@ +--disable_query_log +--disable_result_log +SELECT @init_wait_exec_complete_count_slave:=(VARIABLE_VALUE+0) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_API_WAIT_EXEC_COMPLETE_COUNT_SLAVE"; +SELECT @init_trans_start_count_slave:=(VARIABLE_VALUE+0) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_API_TRANS_START_COUNT_SLAVE"; +SELECT @init_pk_op_count_slave:=(VARIABLE_VALUE+0) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_API_PK_OP_COUNT_SLAVE"; +SELECT @init_trans_commit_count_slave:=(VARIABLE_VALUE+0) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE "NDB_API_TRANS_COMMIT_COUNT_SLAVE"; +--enable_query_log +--enable_result_log No bundle (reason: useless for push emails).