File: rpl_mts_pending_max.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (117 lines) | stat: -rw-r--r-- 4,916 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
###############################################################################
# Bug #21280753 MTS MUST BE ABLE HANDLE LARGE PACKETS WITH SMALL
# REPLICA_PENDING_JOBS_SIZE_MAX
#
# To prove the slave applier can apply events that are larger
# than REPLICA_PENDING_JOBS_SIZE_MAX but only one at a time.
#
# Steps to reproduce the issue:
#
#   0) Set REPLICA_PENDING_JOBS_SIZE_MAX to a smaller number (1024)
#      and replica_parallel_workers to 2 to make the test easy.
#
#   1) Create initial data required for the test
#      (two databases (db1, db2) and two tables (db1.t and db2.t)).
#
#   2) Prove that Coordinator will make a big event (bigger in size than
#      REPLICA_PENDING_JOBS_SIZE_MAX) wait for all workers to finish
#      their work (empty their queue) before processing the big event.
#
#   3) Prove that when a big event is being processed by a
#      worker, Coordinator will make smaller events to wait.
#
#   4) Prove that when a big event is being processed by a
#      worker, Coordinator will make another big event also to wait.
#
#   5) Cleanup (drop tables/databases and reset the variables)
#
###############################################################################

# Row format is choosen so that event size can be changed easily.
--source include/have_binlog_format_row.inc

# This test requires an artificial large transaction and relies
# on its size to test the functionality. Skipping compression
# so that the test is deterministic
--source include/not_binlog_transaction_compression_on.inc

# The test is designed to work for replica_parallel_type=database
# (db1 and db2 queries)
--source include/have_replica_parallel_type_database.inc
--let $rpl_skip_start_slave= 1
--source include/master-slave.inc

--echo #
--echo #   0) Set REPLICA_PENDING_JOBS_SIZE_MAX to a smaller number (1024)
--echo #      and replica_parallel_workers to 2 to make the test easy.
--echo #
--source include/rpl_connection_slave.inc
SET @save.replica_pending_jobs_size_max= @@global.replica_pending_jobs_size_max;
SET @save.replica_parallel_workers= @@global.replica_parallel_workers;
--let $mts_pending_max=1024
--eval SET @@GLOBAL.replica_pending_jobs_size_max= $mts_pending_max
--eval SET @@GLOBAL.replica_parallel_workers= 2
--disable_warnings
--source include/start_slave.inc
--enable_warnings

--echo #
--echo #
--echo #   1) Create initial data required for the test
--echo #      (two databases (db1, db2) and two tables (db1.t and db2.t)).
--echo #
--source include/rpl_connection_master.inc
CREATE DATABASE db1;
CREATE DATABASE db2;
CREATE TABLE db1.t (a TEXT) ENGINE=INNODB;
CREATE TABLE db2.t (a TEXT) ENGINE=INNODB;
--source include/sync_slave_sql_with_master.inc

--echo #
--echo #   2) Prove that Coordinator will make a big event (bigger in size than
--echo #      REPLICA_PENDING_JOBS_SIZE_MAX) wait for all workers to finish
--echo #      their work (empty their queue) before processing the big event.
--echo #
--let $table_to_lock=db1.t
--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES ('small event')
--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max))
--let $tables_involved_in_test=db1.t, db2.t
--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc

--echo #
--echo #   3) When a big event is being processed by a worker,
--echo #      Coordinator will make smaller events to wait until the big event
--echo #      is executed completely.
--echo #
--echo #
--let $table_to_lock=db1.t
--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES (REPEAT('big event', $mts_pending_max))
--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES ('small event')
--let $tables_involved_in_test=db1.t, db2.t
--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc

--echo #
--echo #   4) When a big event is being processed by a worker,
--echo #      Coordinator will make another big event also to wait until the
--echo #      first big event is executed completely.
--echo #
--let $table_to_lock=db1.t
--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES (REPEAT('big event', $mts_pending_max))
--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max))
--let $tables_involved_in_test=db1.t, db2.t
--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc

--echo #
--echo #   5) Cleanup (drop tables/databases and reset the variables)
--echo #
--source include/rpl_connection_master.inc
DROP DATABASE db1;
DROP DATABASE db2;
--source include/sync_slave_sql_with_master.inc
--source include/stop_slave_sql.inc
SET @@global.replica_pending_jobs_size_max=  @save.replica_pending_jobs_size_max;
SET @@GLOBAL.replica_parallel_workers= @save.replica_parallel_workers;
--disable_warnings
--source include/start_slave_sql.inc
--enable_warnings
--source include/rpl_end.inc