Debian Codegraph @

mysql-test/suite/clone/t/local_features.test

raw
1 # Test clone with different table types with debug sync
2
3 --source include/have_debug_sync.inc
4 --source include/count_sessions.inc
5
6 # Compressed table do not support more than 16K page size
7 --source include/have_innodb_max_16k.inc
8
9 ## Install plugin
10 --let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new
11
12 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
13 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
14
15 ## Create test schema
16 --source ../include/create_schema.inc
17
18 # Modify the schema and add compressed table
19 DROP TABLE t1;
20 DROP TABLE t2;
21
22 # Create table with compressed row format using default KEY_BLOCK_SIZE.
23 CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB)
24 ROW_FORMAT = COMPRESSED;
25
26 # Create table in general tablespace
27 CREATE TABLESPACE tbs1 ADD DATAFILE 'tbs1_data1.ibd';
28 CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB)
29 TABLESPACE = tbs1;
30
31 ## Execute Clone while concurrent DMLs are in progress
32
33 # Insert 200 rows
34 call execute_dml(0, 0, 200, 200, 100, 0);
35
36 # Check base rows
37 SHOW CREATE TABLE t1;
38
39 SELECT count(*) from t1;
40 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
41 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
42
43 SHOW CREATE TABLE t2;
44 SELECT count(*) from t2;
45 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
46 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
47
48 ## Test-1: Clone with no redo log to copy.
49 SET GLOBAL innodb_buf_flush_list_now = 1;
50 --source ../include/clone_command.inc
51
52 --echo # Restart cloned database
53 --replace_result $CLONE_DATADIR CLONE_DATADIR
54 --let restart_parameters="restart: --datadir=$CLONE_DATADIR"
55 --source include/restart_mysqld.inc
56
57 # Check table in cloned database
58 SHOW CREATE TABLE t1;
59 SELECT count(*) from t1;
60 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
61 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
62
63 SHOW CREATE TABLE t2;
64 SELECT count(*) from t2;
65 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
66 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
67
68 # Execute procedure to delete all rows and insert
69 call execute_dml(3, 0, 1, 1, 1, 0);
70 call execute_dml(0, 0, 200, 200, 100, 0);
71
72 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
73 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
74
75 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
76
77 --let restart_parameters="restart:"
78 --source include/restart_mysqld.inc
79 --force-rmdir $CLONE_DATADIR
80
81 ## Test-2: Clone with dirty pages and redo log
82
83 --echo # In connection default - Cloning database
84 # Bug#32340112 Clone should not depend on server idle timeout
85 if($remote_clone) {
86 SET GLOBAL wait_timeout = 1;
87 SET GLOBAL CLONE_DONOR_TIMEOUT_AFTER_NETWORK_FAILURE = 0;
88 }
89
90 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
91 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2';
92 --source ../include/clone_command_send.inc
93
94 --echo # In connection con1 - Running Update Random [0 - 200 Key Range]
95 connect (con1,localhost,root,,);
96 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
97
98 if($remote_clone) {
99 SET GLOBAL wait_timeout = default;
100 }
101
102 START TRANSACTION;
103 CALL execute_dml(1, 0, 200, 500, 100, 1);
104 COMMIT;
105 --echo # Flush all dirty buffers
106 SET GLOBAL innodb_buf_flush_list_now = 1;
107
108 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
109
110 SET DEBUG_SYNC = 'now WAIT_FOR start_dml2';
111 START TRANSACTION;
112 CALL execute_dml(1, 0, 200, 500, 100, 1);
113 COMMIT;
114 SET DEBUG_SYNC = 'now SIGNAL resume_clone2';
115
116 connection default;
117 --echo # In connection default - Cloning database
118 --reap
119
120 disconnect con1;
121
122 --echo # Restart cloned database
123 --replace_result $CLONE_DATADIR CLONE_DATADIR
124 --let restart_parameters="restart: --datadir=$CLONE_DATADIR"
125 --source include/restart_mysqld.inc
126
127 # Check table in cloned database
128 SHOW CREATE TABLE t1;
129 SELECT count(*) from t1;
130 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
131 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
132
133 SHOW CREATE TABLE t2;
134 SELECT count(*) from t2;
135 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
136 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
137
138 # Execute procedure to delete all rows and insert
139 call execute_dml(3, 0, 1, 1, 1, 0);
140 call execute_dml(0, 0, 200, 200, 100, 0);
141
142 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
143 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
144
145 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
146 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
147
148 # Restart and Remove cloned directory
149 --let restart_parameters="restart:"
150 --source include/restart_mysqld.inc
151 --force-rmdir $CLONE_DATADIR
152
153 # Cleanup
154 --source ../include/drop_schema.inc
155
156 DROP TABLESPACE tbs1;
157
158 UNINSTALL PLUGIN clone;
159 SET DEBUG_SYNC = 'RESET';
160
161 --source include/wait_until_count_sessions.inc