File: ddl_truncate_same.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 (132 lines) | stat: -rw-r--r-- 4,063 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
# Test clone error cases with concurrent DDL
--source include/have_debug_sync.inc
--source include/have_log_bin.inc
--source include/count_sessions.inc

--let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new

--replace_result $CLONE_PLUGIN CLONE_PLUGIN
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'

--echo # Create test schema
--source ../include/create_schema.inc
CALL execute_dml(0, 0, 10, 10, 10, 0);

SET GLOBAL DEBUG = '+d,local_release_clone_file_pin';

--echo # 1. Truncate same table in various stages of CLONE
--echo # In connection DEFAULT
SET DEBUG_SYNC = 'clone_before_init_meta SIGNAL start_ddl_0 WAIT_FOR resume_clone_0';
SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl_1 WAIT_FOR resume_clone_1';
SET DEBUG_SYNC = 'clone_file_copy_end_before_ack SIGNAL start_ddl_2 WAIT_FOR resume_clone_2';
SET DEBUG_SYNC = 'clone_before_file_ddl_meta SIGNAL start_ddl_3 WAIT_FOR resume_clone_3';
SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_ddl_4 WAIT_FOR resume_clone_4';
SET DEBUG_SYNC = 'clone_before_page_ddl_meta SIGNAL start_ddl_5 WAIT_FOR resume_clone_5';
SET DEBUG_SYNC = 'clone_redo_copy SIGNAL start_ddl_6 WAIT_FOR resume_clone_6';
--source ../include/clone_command_send.inc

--connect (con1,localhost,root,,)
--echo # In connection CON1

--echo # Waiting for clone
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_0';
--echo # Wait finished
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
CALL execute_dml(0, 0, 10, 10, 10, 0);
SET DEBUG_SYNC = 'now SIGNAL resume_clone_0';

--echo # Waiting for clone
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_1';
--echo # Wait finished
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
CALL execute_dml(0, 0, 10, 10, 10, 0);
SET DEBUG_SYNC = 'now SIGNAL resume_clone_1';

--echo # Waiting for clone
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_2';
--echo # Wait finished
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
CALL execute_dml(0, 0, 10, 10, 10, 0);
SET DEBUG_SYNC = 'now SIGNAL resume_clone_2';

--echo # Waiting for clone
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_3';
--echo # Wait finished
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
CALL execute_dml(0, 0, 10, 10, 10, 0);
SET DEBUG_SYNC = 'now SIGNAL resume_clone_3';

--echo # Waiting for clone
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_4';
--echo # Wait finished
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
CALL execute_dml(0, 0, 10, 10, 10, 0);
SET DEBUG_SYNC = 'now SIGNAL resume_clone_4';

--echo # Waiting for clone
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_5';
--echo # Wait finished
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
CALL execute_dml(0, 0, 10, 10, 10, 0);
SET DEBUG_SYNC = 'now SIGNAL resume_clone_5';

--echo # Waiting for clone
SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_6';
--echo # Wait finished
TRUNCATE TABLE t1;
TRUNCATE TABLE t2;
CALL execute_dml(0, 0, 10, 10, 10, 0);
SET DEBUG_SYNC = 'now SIGNAL resume_clone_6';

--connection default
--echo # In connection DEFAULT

--echo # Waiting for clone to complete
--reap
--echo # Wait finished

SET GLOBAL DEBUG = '-d,local_release_clone_file_pin';

disconnect con1;

SET DEBUG_SYNC = 'RESET';
--source include/wait_until_count_sessions.inc

--echo # Restart cloned database
--replace_result $CLONE_DATADIR CLONE_DATADIR
--let restart_parameters="restart: --datadir=$CLONE_DATADIR"
--source include/restart_mysqld.inc

select STATE, ERROR_NO, length(BINLOG_FILE) > 0, length(GTID_EXECUTED) > 0,
(BINLOG_POSITION > 0) from performance_schema.clone_status;

# Execute procedure to delete all rows and insert
CALL execute_dml(3, 0, 1, 1, 1, 0);
CALL execute_dml(0, 0, 10, 10, 10, 0);

# Check table in cloned database
SHOW CREATE TABLE t1;
SELECT count(*) from t1;
SELECT col1, col2, col3 FROM t1 ORDER BY col1 LIMIT 10;
SELECT col1, col2, col3 FROM t1 ORDER BY col1 DESC LIMIT 10;

SHOW CREATE TABLE t2;
SELECT count(*) from t2;
SELECT col1, col2, col3 FROM t2 ORDER BY col1 LIMIT 10;
SELECT col1, col2, col3 FROM t2 ORDER BY col1 DESC LIMIT 10;

--echo # Cleanup
--let restart_parameters="restart:"
--source include/restart_mysqld.inc

--source ../include/drop_schema.inc
--force-rmdir $CLONE_DATADIR

--echo # Uninstall clone
UNINSTALL PLUGIN clone;