Debian Codegraph @

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

raw
1 # Test clone with debug sync point to ensure concurrent operation and data in each stages
2
3 --source include/no_valgrind_without_big.inc
4 --source include/have_debug_sync.inc
5 --source include/count_sessions.inc
6
7 ## Install plugin
8 --let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new
9
10 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
11 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
12
13 ## Create test schema
14 --source ../include/create_schema.inc
15
16 ## Execute Clone while concurrent DMLs are in progress
17
18 # Insert 1k rows
19 call execute_dml(0, 0, 100, 100, 10, 0);
20
21 # Check base rows
22 SHOW CREATE TABLE t1;
23
24 SELECT count(*) from t1;
25 --skip_if_hypergraph # Runs out of memory due to different query plan.
26 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
27 --skip_if_hypergraph # Runs out of memory due to different query plan.
28 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
29
30 SHOW CREATE TABLE t2;
31 SELECT count(*) from t2;
32 --skip_if_hypergraph # Runs out of memory due to different query plan.
33 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
34 --skip_if_hypergraph # Runs out of memory due to different query plan.
35 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
36
37 --echo # In connection default - Cloning database
38 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml1 WAIT_FOR resume_clone1';
39 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_dml2 WAIT_FOR resume_clone2';
40 --source ../include/clone_command_send.inc
41
42 --echo # In connection con1 - Running Update Random [0 - 100 Key Range]
43 connect (con1,localhost,root,,);
44 SET DEBUG_SYNC = 'now WAIT_FOR start_dml1';
45 START TRANSACTION;
46 CALL execute_dml(1, 0, 100, 500, 50, 1);
47 COMMIT;
48 --echo # Flush all dirty buffers
49 SET GLOBAL innodb_buf_flush_list_now = 1;
50 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
51
52 SET DEBUG_SYNC = 'now WAIT_FOR start_dml2';
53 START TRANSACTION;
54 CALL execute_dml(1, 0, 100, 300, 50, 1);
55 COMMIT;
56 SET DEBUG_SYNC = 'now SIGNAL resume_clone2';
57
58 connection default;
59 --echo # In connection default - Cloning database
60 --reap
61
62 disconnect con1;
63
64 --echo # Restart cloned database
65 --replace_result $CLONE_DATADIR CLONE_DATADIR
66 --let restart_parameters="restart: --datadir=$CLONE_DATADIR"
67 --source include/restart_mysqld.inc
68
69 # Check table in cloned database
70 SHOW CREATE TABLE t1;
71 SELECT count(*) from t1;
72 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
73 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
74
75 SHOW CREATE TABLE t2;
76 SELECT count(*) from t2;
77 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
78 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
79
80 # Execute procedure to delete all rows and insert
81 call execute_dml(3, 0, 1, 1, 1, 0);
82 call execute_dml(0, 0, 100, 100, 10, 0);
83
84 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
85 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
86
87 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
88 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
89
90 #Cleanup
91 --let restart_parameters="restart:"
92 --source include/restart_mysqld.inc
93
94 --source ../include/drop_schema.inc
95
96 UNINSTALL PLUGIN clone;
97 SET DEBUG_SYNC = 'RESET';
98
99 --source include/wait_until_count_sessions.inc
100 --force-rmdir $CLONE_DATADIR