Debian Codegraph @

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

raw
1 # Test clone with debug sync point to simulate archiving error in different stage
2
3 --source include/linux.inc
4 --source include/have_innodb_16k.inc
5 --source include/no_valgrind_without_big.inc
6 --source include/have_debug_sync.inc
7 --source include/count_sessions.inc
8
9 # Needed for the hypergraph optimizer only; since it does not support indexes yet,
10 # it needs to sort some rows involving fairly large blobs.
11 set sort_buffer_size=1048576;
12
13 call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* The redo log archiver is aborted as it was lagging behind at LSN = .*");
14
15 --disable_query_log
16 RESET MASTER;
17 --enable_query_log
18
19 ## Install plugin
20 --let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new
21
22 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
23 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
24
25 ## Create test schema
26 --source ../include/create_schema.inc
27
28 ## Execute Clone while concurrent DMLs are in progress
29
30 # Insert 100 rows
31 call execute_dml(0, 0, 100, 100, 10, 0);
32
33 # Check base rows
34 SHOW CREATE TABLE t1;
35
36 SELECT count(*) from t1;
37 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
38 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
39
40 SHOW CREATE TABLE t2;
41 SELECT count(*) from t2;
42 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
43 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
44
45 --echo # Test-1: Error during redo archival
46 --echo # In connection default - Cloning database
47 SET GLOBAL DEBUG = '+d,clone_redo_archive_error';
48 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
49 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2';
50 --source ../include/clone_command_send.inc
51
52 --echo # In connection con1 - Running Update Random [0 - 100 Key Range]
53 connect (con1,localhost,root,,);
54 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
55 START TRANSACTION;
56 CALL execute_dml(1, 0, 100, 500, 50, 1);
57 COMMIT;
58 --echo # Flush all dirty buffers
59 SET GLOBAL innodb_buf_flush_list_now = 1;
60 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
61
62 SET DEBUG_SYNC = 'now WAIT_FOR start_dml2';
63 START TRANSACTION;
64 CALL execute_dml(1, 0, 100, 300, 50, 1);
65 COMMIT;
66 SET DEBUG_SYNC = 'now SIGNAL resume_clone2';
67
68 connection default;
69 --echo # In connection default - Cloning database
70 --error ER_INTERNAL_ERROR
71 --reap
72 --force-rmdir $CLONE_DATADIR
73 SET GLOBAL DEBUG = '-d,clone_redo_archive_error';
74 SET DEBUG_SYNC = 'RESET';
75
76 --echo # Test-2: Error overwrite redo archival data
77 --echo # In connection default - Cloning database
78 SET GLOBAL DEBUG = '+d,clone_redo_no_archive';
79 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
80 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2';
81 --source ../include/clone_command_send.inc
82
83 --echo # In connection con1 - Delete all rows
84 connection con1;
85 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
86 START TRANSACTION;
87 call execute_dml(3, 0, 1, 1, 1, 0);
88 COMMIT;
89 --echo # Flush all dirty buffers
90 SET GLOBAL innodb_buf_flush_list_now = 1;
91 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
92
93 SET DEBUG_SYNC = 'now WAIT_FOR start_dml2';
94 --echo # In connection con1 - Insert 200 rows
95 call execute_dml(0, 0, 200, 200, 10, 0);
96 SET DEBUG_SYNC = 'now SIGNAL resume_clone2';
97
98 connection default;
99 --echo # In connection default - Cloning database
100 --error ER_INTERNAL_ERROR
101 --reap
102 --force-rmdir $CLONE_DATADIR
103 SET GLOBAL DEBUG = '-d,clone_redo_no_archive';
104 SET DEBUG_SYNC = 'RESET';
105
106 --echo # Test-3: Successful clone after archival error
107 --echo # In connection default - Cloning database
108 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
109 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2';
110 --source ../include/clone_command_send.inc
111
112 --echo # In connection con1 - Running Update Random [0 - 100 Key Range]
113 connection con1;
114 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
115 START TRANSACTION;
116 CALL execute_dml(1, 0, 100, 500, 50, 1);
117 COMMIT;
118 --echo # Flush all dirty buffers
119 SET GLOBAL innodb_buf_flush_list_now = 1;
120 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
121
122 SET DEBUG_SYNC = 'now WAIT_FOR start_dml2';
123 START TRANSACTION;
124 CALL execute_dml(1, 0, 100, 300, 50, 1);
125 COMMIT;
126 SET DEBUG_SYNC = 'now SIGNAL resume_clone2';
127
128 connection default;
129 --echo # In connection default - Cloning database
130 --reap
131 SET DEBUG_SYNC = 'RESET';
132
133 disconnect con1;
134
135 --echo # Restart cloned database
136 --replace_result $CLONE_DATADIR CLONE_DATADIR
137 --let restart_parameters="restart: --datadir=$CLONE_DATADIR"
138 --source include/restart_mysqld.inc
139
140 # Check table in cloned database
141 SHOW CREATE TABLE t1;
142 SELECT count(*) from t1;
143 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
144 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
145
146 SHOW CREATE TABLE t2;
147 SELECT count(*) from t2;
148 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
149 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
150
151 # Execute procedure to delete all rows and insert
152 call execute_dml(3, 0, 1, 1, 1, 0);
153 call execute_dml(0, 0, 100, 100, 10, 0);
154
155 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
156 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
157
158 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
159 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
160
161 #Cleanup
162 --let restart_parameters="restart:"
163 --source include/restart_mysqld.inc
164
165 --source ../include/drop_schema.inc
166
167 UNINSTALL PLUGIN clone;
168 SET DEBUG_SYNC = 'RESET';
169
170 set sort_buffer_size=DEFAULT;
171
172 --source include/wait_until_count_sessions.inc
173 --force-rmdir $CLONE_DATADIR