File: ddl_common.inc

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 (305 lines) | stat: -rw-r--r-- 7,748 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
## Common file for controlled DDL execution with concurrent Clone
##
## 1. ddl_op         : DDL operation - CREATE TABLE,  DROP TABLE,  ALTER TABLE ...
## 2. ddl_stmt       : DDL statement text following table name
## 3. ddl_post       : Any other follow up clause like partition
## 4. ddl_table_extn : Second table name extension - new [t1_new, t2_new ...]
## 5. dml_stmt1      : DML to be executed after DDL during stage-1 FILE COPY
## 6. dml_stmt11     : DML to be executed after DDL before sending DDL metadata in FILE COPY
## 7. dml_stmt2      : DML to be executed after DDL during stage-1 PAGE COPY
## 8. dml_stmt21     : DML to be executed after DDL before sending DDL metadata in PAGE COPY
## 9. ddl_skip_check : Skip checking data. Used tables are dropped
##10. ddl_encryption : restart server with keyring plugin

--source include/count_sessions.inc

## Get rid of the binary logs from previous run.
RESET MASTER;

--let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new
--let $MYSQLD_DATADIR= `select @@datadir;`

if ($remote_clone) {
  SET GLOBAL DEBUG = '+d,remote_release_clone_file_pin';
}

if (!$remote_clone) {
  SET GLOBAL DEBUG = '+d,local_release_clone_file_pin';
}

if ($ddl_encryption) {
  SET GLOBAL DEBUG = '+d,log_redo_with_invalid_master_key';
}

if ($ddl_redo_encrypt) {
  --let $skip_ddl = 1
}

--let $ddl_exec = 1
--let $table_num = 0

if (!$skip_ddl) {
  --source ../include/clone_exec_ddl.inc
}

if ($post_dml) {
  --let $after_dml = _after_dml
  --source ../include/clone_exec_ddl.inc
  --let $after_dml =
}

SET DEBUG_SYNC = 'clone_before_init_meta SIGNAL start_ddl_file_init WAIT_FOR resume_file_init';
SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl_file WAIT_FOR resume_file';
SET DEBUG_SYNC = 'clone_file_copy_end_before_ack SIGNAL start_ddl_file_ack WAIT_FOR resume_file_ack';
SET DEBUG_SYNC = 'clone_before_file_ddl_meta SIGNAL start_ddl_file_meta WAIT_FOR resume_file_meta';
SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl_page WAIT_FOR resume_page';
SET DEBUG_SYNC = 'clone_before_page_ddl_meta SIGNAL start_ddl_page_meta WAIT_FOR resume_page_meta';
SET DEBUG_SYNC = 'clone_redo_copy SIGNAL start_ddl_redo WAIT_FOR resume_redo';
--source ../include/clone_command_send.inc

if ($ddl_file_copy) {
  --let $skip_ddl =
}

connect (con1,localhost,root,,);

--echo # In connection CON1

if (!$remote_clone) {
  --echo # Waiting for clone to reach 'Initial metadata transfer'
  SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_init';
  --echo # Wait finished
}

--let $table_num = 01

if (!$skip_ddl) {
  --source ../include/clone_exec_ddl.inc
}

if ($post_dml) {
  --let $after_dml = _after_dml
  --source ../include/clone_exec_ddl.inc
  --let $after_dml =
}

SET DEBUG_SYNC = 'now SIGNAL resume_file_init';

--echo # Waiting for clone to reach 'file copy'
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file';
--echo # Wait finished

--let $table_num = 1

if($remote_clone) {
  --echo # For remote clone, let the donor progress concurrently
  --echo # otherwise file pins may not be released causing deadlock
  SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL resume_file';
}

if (!$skip_ddl) {
  --source ../include/clone_exec_ddl.inc
}

--eval $dml_stmt1

--echo # Flush all dirty pages to track
SET GLOBAL innodb_buf_flush_list_now = 1;

if ($post_dml) {
  --let $after_dml = _after_dml
  --source ../include/clone_exec_ddl.inc
  --let $after_dml =
}

SET DEBUG_SYNC = 'now SIGNAL resume_file';

# For remote clone, DDL is executed concurrently. This is to
# make sure that clone doesn't enter into page copy state
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_ack';
SET DEBUG_SYNC = 'now SIGNAL resume_file_ack';

if (!$remote_clone) {
  --echo # Waiting for clone to reach DDL metadata for 'file copy'
  SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_file_meta';
  --echo # Wait finished
}

if(!$in_place_ddl) {
  --let $table_num = 11

  if (!$skip_ddl) {
    --source ../include/clone_exec_ddl.inc
  }

  --eval $dml_stmt11

  if ($post_dml) {
    --let $after_dml = _after_dml
    --source ../include/clone_exec_ddl.inc
    --let $after_dml =
  }
}

SET DEBUG_SYNC = 'now SIGNAL resume_file_meta';

--echo # Waiting for clone to reach 'page copy'
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page';
--echo # Wait finished

if ($ddl_page_copy) {
  --let $skip_ddl =
}

# In place DDL currently waits for page copy to complete. Allow
# clone to proceed concurrently.

if($in_place_ddl) {
  SET DEBUG_SYNC = 'clone_notify_ddl SIGNAL resume_page';
}

--let $table_num = 2

if (!$skip_ddl) {
  --source ../include/clone_exec_ddl.inc
}

--eval $dml_stmt2

if ($post_dml) {
  --let $after_dml = _after_dml
  --source ../include/clone_exec_ddl.inc
  --let $after_dml =
}

SET DEBUG_SYNC = 'now SIGNAL resume_page';

if (!$remote_clone) {
  --echo # Waiting for clone to reach DDL metadata for 'page copy'
  SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_page_meta';
  --echo # Wait finished
}

if ($remote_clone) {
  --echo # Waiting for clone to reach 'redo copy'
  SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_redo';
  --echo # Wait finished
}

--let $table_num = 21

if (!$skip_ddl) {
  --source ../include/clone_exec_ddl.inc
}

--eval $dml_stmt21

if ($post_dml) {
  --let $after_dml = _after_dml
  --source ../include/clone_exec_ddl.inc
  --let $after_dml =
}

if (!$remote_clone) {
  SET DEBUG_SYNC = 'now SIGNAL resume_page_meta';

  --echo # Waiting for clone to reach 'redo copy'
  SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_redo';
  --echo # Wait finished
}

--let $table_num = 3

if (!$skip_ddl) {
  --source ../include/clone_exec_ddl.inc
}

if ($post_dml) {
  --let $after_dml = _after_dml
  --source ../include/clone_exec_ddl.inc
  --let $after_dml =
}

SET DEBUG_SYNC = 'now SIGNAL resume_redo';

connection default;
--echo # In connection DEFAULT
--echo # Waiting for clone to complete
--reap
--echo # Wait finished

if ($remote_clone) {
  SET GLOBAL DEBUG = '-d,remote_release_clone_file_pin';
}

if (!$remote_clone) {
  SET GLOBAL DEBUG = '-d,local_release_clone_file_pin';
}

--disconnect con1
--source include/wait_until_count_sessions.inc

--echo # Restart server on cloned data directory
if ($ddl_encryption) {
  --replace_result $CLONE_DATADIR CLONE_DATADIR $KEYRING_PLUGIN KEYRING_PLUGIN $MYSQL_TMP_DIR MYSQL_TMP_DIR
  --let restart_parameters="restart: --datadir=$CLONE_DATADIR --early-plugin-load="keyring_file=$KEYRING_PLUGIN" --keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring"
}

if (!$ddl_encryption) {
  --replace_result $CLONE_DATADIR CLONE_DATADIR
  --let restart_parameters="restart: --datadir=$CLONE_DATADIR"
}

--source include/restart_mysqld.inc

--let $ddl_exec =

--echo # Check cloned data
SHOW TABLES;

if (!$ddl_skip_check) {
  --let $ddl_show = 1

  --let $table_num = 1
  --source ../include/clone_exec_ddl.inc

  --let $table_num = 11
  --source ../include/clone_exec_ddl.inc

  --let $table_num = 2
  --source ../include/clone_exec_ddl.inc

  --let $ddl_show =

  if ($dml_stmt_check) {
    --eval $dml_stmt_check
  }
}

--echo # Restart server back on base data directory

if ($ddl_encryption) {
  --replace_result $KEYRING_PLUGIN KEYRING_PLUGIN $MYSQL_TMP_DIR MYSQL_TMP_DIR $ENCRYPT_DATADIR ENCRYPT_DATADIR
  --let restart_parameters=restart: --datadir=$ENCRYPT_DATADIR --early-plugin-load="keyring_file=$KEYRING_PLUGIN" --keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring
}

if (!$ddl_encryption) {

  if (!$skip_space_validation) {
    --let restart_parameters=restart:
  }

  if ($skip_space_validation) {
    --let restart_parameters=restart: --skip-innodb-validate-tablespace-paths
  }
}

--source include/restart_mysqld.inc

if ($undo_encryption) {
  SET GLOBAL innodb_undo_log_encrypt = ON;
  SHOW VARIABLES LIKE 'innodb_undo_log_encrypt';
}

--force-rmdir $CLONE_DATADIR
SET DEBUG_SYNC = 'RESET';