| 1 |
############################################################################### |
| 2 |
# Bug #21280753 MTS MUST BE ABLE HANDLE LARGE PACKETS WITH SMALL |
| 3 |
# REPLICA_PENDING_JOBS_SIZE_MAX |
| 4 |
# |
| 5 |
# To prove the slave applier can apply events that are larger |
| 6 |
# than REPLICA_PENDING_JOBS_SIZE_MAX but only one at a time. |
| 7 |
# |
| 8 |
# Steps to reproduce the issue: |
| 9 |
# |
| 10 |
# 0) Set REPLICA_PENDING_JOBS_SIZE_MAX to a smaller number (1024) |
| 11 |
# and replica_parallel_workers to 2 to make the test easy. |
| 12 |
# |
| 13 |
# 1) Create initial data required for the test |
| 14 |
# (two databases (db1, db2) and two tables (db1.t and db2.t)). |
| 15 |
# |
| 16 |
# 2) Prove that Coordinator will make a big event (bigger in size than |
| 17 |
# REPLICA_PENDING_JOBS_SIZE_MAX) wait for all workers to finish |
| 18 |
# their work (empty their queue) before processing the big event. |
| 19 |
# |
| 20 |
# 3) Prove that when a big event is being processed by a |
| 21 |
# worker, Coordinator will make smaller events to wait. |
| 22 |
# |
| 23 |
# 4) Prove that when a big event is being processed by a |
| 24 |
# worker, Coordinator will make another big event also to wait. |
| 25 |
# |
| 26 |
# 5) Cleanup (drop tables/databases and reset the variables) |
| 27 |
# |
| 28 |
############################################################################### |
| 29 |
|
| 30 |
# Row format is choosen so that event size can be changed easily. |
| 31 |
--source include/have_binlog_format_row.inc |
| 32 |
|
| 33 |
# This test requires an artificial large transaction and relies |
| 34 |
# on its size to test the functionality. Skipping compression |
| 35 |
# so that the test is deterministic |
| 36 |
--source include/not_binlog_transaction_compression_on.inc |
| 37 |
|
| 38 |
# The test is designed to work for replica_parallel_type=database |
| 39 |
# (db1 and db2 queries) |
| 40 |
--source include/have_replica_parallel_type_database.inc |
| 41 |
--let $rpl_skip_start_slave= 1 |
| 42 |
--source include/master-slave.inc |
| 43 |
|
| 44 |
--echo # |
| 45 |
--echo # 0) Set REPLICA_PENDING_JOBS_SIZE_MAX to a smaller number (1024) |
| 46 |
--echo # and replica_parallel_workers to 2 to make the test easy. |
| 47 |
--echo # |
| 48 |
--source include/rpl_connection_slave.inc |
| 49 |
SET @save.replica_pending_jobs_size_max= @@global.replica_pending_jobs_size_max; |
| 50 |
SET @save.replica_parallel_workers= @@global.replica_parallel_workers; |
| 51 |
--let $mts_pending_max=1024 |
| 52 |
--eval SET @@GLOBAL.replica_pending_jobs_size_max= $mts_pending_max |
| 53 |
--eval SET @@GLOBAL.replica_parallel_workers= 2 |
| 54 |
--disable_warnings |
| 55 |
--source include/start_slave.inc |
| 56 |
--enable_warnings |
| 57 |
|
| 58 |
--echo # |
| 59 |
--echo # |
| 60 |
--echo # 1) Create initial data required for the test |
| 61 |
--echo # (two databases (db1, db2) and two tables (db1.t and db2.t)). |
| 62 |
--echo # |
| 63 |
--source include/rpl_connection_master.inc |
| 64 |
CREATE DATABASE db1; |
| 65 |
CREATE DATABASE db2; |
| 66 |
CREATE TABLE db1.t (a TEXT) ENGINE=INNODB; |
| 67 |
CREATE TABLE db2.t (a TEXT) ENGINE=INNODB; |
| 68 |
--source include/sync_slave_sql_with_master.inc |
| 69 |
|
| 70 |
--echo # |
| 71 |
--echo # 2) Prove that Coordinator will make a big event (bigger in size than |
| 72 |
--echo # REPLICA_PENDING_JOBS_SIZE_MAX) wait for all workers to finish |
| 73 |
--echo # their work (empty their queue) before processing the big event. |
| 74 |
--echo # |
| 75 |
--let $table_to_lock=db1.t |
| 76 |
--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES ('small event') |
| 77 |
--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max)) |
| 78 |
--let $tables_involved_in_test=db1.t, db2.t |
| 79 |
--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc |
| 80 |
|
| 81 |
--echo # |
| 82 |
--echo # 3) When a big event is being processed by a worker, |
| 83 |
--echo # Coordinator will make smaller events to wait until the big event |
| 84 |
--echo # is executed completely. |
| 85 |
--echo # |
| 86 |
--echo # |
| 87 |
--let $table_to_lock=db1.t |
| 88 |
--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES (REPEAT('big event', $mts_pending_max)) |
| 89 |
--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES ('small event') |
| 90 |
--let $tables_involved_in_test=db1.t, db2.t |
| 91 |
--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc |
| 92 |
|
| 93 |
--echo # |
| 94 |
--echo # 4) When a big event is being processed by a worker, |
| 95 |
--echo # Coordinator will make another big event also to wait until the |
| 96 |
--echo # first big event is executed completely. |
| 97 |
--echo # |
| 98 |
--let $table_to_lock=db1.t |
| 99 |
--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES (REPEAT('big event', $mts_pending_max)) |
| 100 |
--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max)) |
| 101 |
--let $tables_involved_in_test=db1.t, db2.t |
| 102 |
--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc |
| 103 |
|
| 104 |
--echo # |
| 105 |
--echo # 5) Cleanup (drop tables/databases and reset the variables) |
| 106 |
--echo # |
| 107 |
--source include/rpl_connection_master.inc |
| 108 |
DROP DATABASE db1; |
| 109 |
DROP DATABASE db2; |
| 110 |
--source include/sync_slave_sql_with_master.inc |
| 111 |
--source include/stop_slave_sql.inc |
| 112 |
SET @@global.replica_pending_jobs_size_max= @save.replica_pending_jobs_size_max; |
| 113 |
SET @@GLOBAL.replica_parallel_workers= @save.replica_parallel_workers; |
| 114 |
--disable_warnings |
| 115 |
--source include/start_slave_sql.inc |
| 116 |
--enable_warnings |
| 117 |
--source include/rpl_end.inc |