Debian Codegraph @

mysql-test/suite/group_replication/t/gr_message_cache_size_min.test

raw
1 #
2 # WL#13979: MySQL GCS: Reduce minimum value of group_replication_message_cache_size
3 #
4 # This test case does:
5 # - configure the xcom cache to be capped at 128 MB
6 # - start a two member group: {server1, server2}
7 # - create 201 transactions, out of which 200 are larger than 1MB
8 # - checks that these are replicated
9 # - asserts that more messages than 201 were sent
10 # - asserts that the cache remains below the cap
11 #
12
13 # this test needs large transactions
14 --source include/not_binlog_transaction_compression_on.inc
15 --source include/have_group_replication_plugin.inc
16 --let $rpl_skip_group_replication_start= 1
17 --source include/group_replication.inc
18
19 --let $saved_gr_message_cache_size = `SELECT @@global.group_replication_message_cache_size`
20 --let $min = `SELECT 128 * 1024 * 1024`
21 --let $message_size = `SELECT 1024 * 1024`
22 --let $nmessages = 200
23
24 ## configure server 1
25
26 --let $rpl_connection_name= server1
27 --source include/rpl_connection.inc
28
29 --replace_result $min MESSAGE_CACHE_SIZE_MIN
30 --eval SET GLOBAL group_replication_message_cache_size = $min
31
32 --source include/start_and_bootstrap_group_replication.inc
33
34 --let $assert_text= The value of group_replication_message_cache_size should be MESSAGE_CACHE_SIZE_MIN
35 --let $assert_cond= "[SELECT @@group_replication_message_cache_size]" = $min
36 --source include/assert.inc
37
38 ## configure server2
39
40 --let $rpl_connection_name= server2
41 --source include/rpl_connection.inc
42
43 --replace_result $min MESSAGE_CACHE_SIZE_MIN
44 --eval SET GLOBAL group_replication_message_cache_size = $min
45 --source include/start_group_replication.inc
46
47 ## generate some load
48
49 --let $rpl_connection_name= server1
50 --source include/rpl_connection.inc
51
52 CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY, c2 LONGTEXT);
53
54 --disable_query_log
55 --let $i = $nmessages
56 --echo # sending $nmessages messages of approx 1MB each
57 while ($i > 0) {
58 BEGIN;
59 --eval INSERT INTO t1 VALUES($i, REPEAT('A', $message_size))
60
61 # just to clear the c2 table to be able to diff tables quicker below
62 # and not run into sort buffer size issues
63 UPDATE t1 SET c2 = NULL;
64
65 COMMIT;
66
67 --dec $i
68 }
69 --echo # sent all $nmessages messages
70 --enable_query_log
71
72 ## synchronize servers
73 --source include/rpl_sync.inc
74
75 --let $rpl_connection_name= server1
76 --source include/rpl_connection.inc
77
78 --let $diff_tables=server1:test.t1,server2:test.t1
79 --source include/diff_tables.inc
80
81 DROP TABLE t1;
82 --source include/rpl_sync.inc
83
84 ## now assert perfschema readings and cleanup
85
86 --let $s=2
87 while ($s > 0) {
88
89 --let $rpl_connection_name= server$s
90 --source include/rpl_connection.inc
91
92 --let $count_alloc = `SELECT count_alloc FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/GCS_XCom::xcom_cache'`
93 --let $curr_used = `SELECT current_number_of_bytes_used FROM performance_schema.memory_summary_global_by_event_name WHERE EVENT_NAME LIKE 'memory/group_rpl/GCS_XCom::xcom_cache'`
94
95 --let $assert_text= Assert that we allocated more than $nmessages entries
96 --let $assert_cond= $count_alloc > $nmessages
97 --source include/assert.inc
98
99 --let $assert_text= Assert that the cache has not exceeded the cap
100 --let $assert_cond= $curr_used < $min
101 --source include/assert.inc
102
103 --source include/stop_group_replication.inc
104 --replace_result $saved_gr_message_cache_size MESSAGE_CACHE_SIZE_SAVED
105 --eval SET GLOBAL group_replication_message_cache_size = $saved_gr_message_cache_size
106
107 --dec $s
108 }
109
110 --source include/group_replication_end.inc