| 1 |
RESET MASTER; |
| 2 |
CREATE TABLE t1(c1 INT AUTO_INCREMENT PRIMARY KEY, c2 VARCHAR(200)) |
| 3 |
PARTITION BY HASH (c1) PARTITIONS 4; |
| 4 |
INSERT INTO t1 VALUES(1, ""), (2, ""), (3, ""),(4, ""); |
| 5 |
# |
| 6 |
# Verify INSERT after ANALYZE TABLE logs correct last_committed |
| 7 |
# |
| 8 |
[connection admin_conn] |
| 9 |
SET debug_sync = "waiting_in_the_middle_of_flush_stage SIGNAL admin_ready |
| 10 |
WAIT_FOR admin_continue"; |
| 11 |
ANALYZE TABLE t1;; |
| 12 |
[connection insert_conn] |
| 13 |
SET debug_sync = "now WAIT_FOR admin_ready"; |
| 14 |
SET debug_sync = "bgc_after_enrolling_for_flush_stage SIGNAL insert_ready |
| 15 |
WAIT_FOR insert_continue"; |
| 16 |
INSERT INTO t1(c2) VALUES("ANALYZE TABLE t1;"); |
| 17 |
[connection default] |
| 18 |
SET debug_sync = "now WAIT_FOR insert_ready"; |
| 19 |
SET debug_sync = "now SIGNAL admin_continue,insert_continue"; |
| 20 |
[connection admin_conn] |
| 21 |
Table Op Msg_type Msg_text |
| 22 |
test.t1 analyze status OK |
| 23 |
[connection insert_conn] |
| 24 |
SET debug_sync = "RESET"; |
| 25 |
include/include/assert_logical_timestamps.inc [3 4] |
| 26 |
# |
| 27 |
# Verify INSERT after OPTIMIZE TABLE logs correct last_committed |
| 28 |
# |
| 29 |
[connection admin_conn] |
| 30 |
SET debug_sync = "waiting_in_the_middle_of_flush_stage SIGNAL admin_ready |
| 31 |
WAIT_FOR admin_continue"; |
| 32 |
OPTIMIZE TABLE t1;; |
| 33 |
[connection insert_conn] |
| 34 |
SET debug_sync = "now WAIT_FOR admin_ready"; |
| 35 |
SET debug_sync = "bgc_after_enrolling_for_flush_stage SIGNAL insert_ready |
| 36 |
WAIT_FOR insert_continue"; |
| 37 |
INSERT INTO t1(c2) VALUES("OPTIMIZE TABLE t1;"); |
| 38 |
[connection default] |
| 39 |
SET debug_sync = "now WAIT_FOR insert_ready"; |
| 40 |
SET debug_sync = "now SIGNAL admin_continue,insert_continue"; |
| 41 |
[connection admin_conn] |
| 42 |
Table Op Msg_type Msg_text |
| 43 |
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead |
| 44 |
test.t1 optimize status OK |
| 45 |
[connection insert_conn] |
| 46 |
SET debug_sync = "RESET"; |
| 47 |
include/include/assert_logical_timestamps.inc [5 6] |
| 48 |
# |
| 49 |
# Verify INSERT after REPAIR TABLE logs correct last_committed |
| 50 |
# |
| 51 |
[connection admin_conn] |
| 52 |
SET debug_sync = "waiting_in_the_middle_of_flush_stage SIGNAL admin_ready |
| 53 |
WAIT_FOR admin_continue"; |
| 54 |
REPAIR TABLE t1;; |
| 55 |
[connection insert_conn] |
| 56 |
SET debug_sync = "now WAIT_FOR admin_ready"; |
| 57 |
SET debug_sync = "bgc_after_enrolling_for_flush_stage SIGNAL insert_ready |
| 58 |
WAIT_FOR insert_continue"; |
| 59 |
INSERT INTO t1(c2) VALUES("REPAIR TABLE t1;"); |
| 60 |
[connection default] |
| 61 |
SET debug_sync = "now WAIT_FOR insert_ready"; |
| 62 |
SET debug_sync = "now SIGNAL admin_continue,insert_continue"; |
| 63 |
[connection admin_conn] |
| 64 |
Table Op Msg_type Msg_text |
| 65 |
test.t1 repair status OK |
| 66 |
[connection insert_conn] |
| 67 |
SET debug_sync = "RESET"; |
| 68 |
include/include/assert_logical_timestamps.inc [7 8] |
| 69 |
# |
| 70 |
# Verify INSERT after ALTER TABLE ... REPAIR TABLE logs correct |
| 71 |
# last_committed |
| 72 |
# |
| 73 |
[connection admin_conn] |
| 74 |
SET debug_sync = "waiting_in_the_middle_of_flush_stage SIGNAL admin_ready |
| 75 |
WAIT_FOR admin_continue"; |
| 76 |
ALTER TABLE t1 REPAIR PARTITION p0;; |
| 77 |
[connection insert_conn] |
| 78 |
SET debug_sync = "now WAIT_FOR admin_ready"; |
| 79 |
SET debug_sync = "bgc_after_enrolling_for_flush_stage SIGNAL insert_ready |
| 80 |
WAIT_FOR insert_continue"; |
| 81 |
INSERT INTO t1(c2) VALUES("ALTER TABLE t1 REPAIR PARTITION p0;"); |
| 82 |
[connection default] |
| 83 |
SET debug_sync = "now WAIT_FOR insert_ready"; |
| 84 |
SET debug_sync = "now SIGNAL admin_continue,insert_continue"; |
| 85 |
[connection admin_conn] |
| 86 |
Table Op Msg_type Msg_text |
| 87 |
test.t1 repair status OK |
| 88 |
[connection insert_conn] |
| 89 |
SET debug_sync = "RESET"; |
| 90 |
include/include/assert_logical_timestamps.inc [9 10] |
| 91 |
# |
| 92 |
# Verify INSERT after ALTER TABLE ... OPTIMIZE TABLE logs correct |
| 93 |
# last_committed |
| 94 |
# |
| 95 |
[connection admin_conn] |
| 96 |
SET debug_sync = "waiting_in_the_middle_of_flush_stage SIGNAL admin_ready |
| 97 |
WAIT_FOR admin_continue"; |
| 98 |
ALTER TABLE t1 OPTIMIZE PARTITION p1;; |
| 99 |
[connection insert_conn] |
| 100 |
SET debug_sync = "now WAIT_FOR admin_ready"; |
| 101 |
SET debug_sync = "bgc_after_enrolling_for_flush_stage SIGNAL insert_ready |
| 102 |
WAIT_FOR insert_continue"; |
| 103 |
INSERT INTO t1(c2) VALUES("ALTER TABLE t1 OPTIMIZE PARTITION p1;"); |
| 104 |
[connection default] |
| 105 |
SET debug_sync = "now WAIT_FOR insert_ready"; |
| 106 |
SET debug_sync = "now SIGNAL admin_continue,insert_continue"; |
| 107 |
[connection admin_conn] |
| 108 |
Table Op Msg_type Msg_text |
| 109 |
test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. |
| 110 |
test.t1 optimize status OK |
| 111 |
[connection insert_conn] |
| 112 |
SET debug_sync = "RESET"; |
| 113 |
include/include/assert_logical_timestamps.inc [11 12] |
| 114 |
# |
| 115 |
# Verify INSERT after ALTER TABLE ... ANALYZE TABLE logs correct |
| 116 |
# last_committed |
| 117 |
# |
| 118 |
[connection admin_conn] |
| 119 |
SET debug_sync = "waiting_in_the_middle_of_flush_stage SIGNAL admin_ready |
| 120 |
WAIT_FOR admin_continue"; |
| 121 |
ALTER TABLE t1 ANALYZE PARTITION p2;; |
| 122 |
[connection insert_conn] |
| 123 |
SET debug_sync = "now WAIT_FOR admin_ready"; |
| 124 |
SET debug_sync = "bgc_after_enrolling_for_flush_stage SIGNAL insert_ready |
| 125 |
WAIT_FOR insert_continue"; |
| 126 |
INSERT INTO t1(c2) VALUES("ALTER TABLE t1 ANALYZE PARTITION p2;"); |
| 127 |
[connection default] |
| 128 |
SET debug_sync = "now WAIT_FOR insert_ready"; |
| 129 |
SET debug_sync = "now SIGNAL admin_continue,insert_continue"; |
| 130 |
[connection admin_conn] |
| 131 |
Table Op Msg_type Msg_text |
| 132 |
test.t1 analyze status OK |
| 133 |
[connection insert_conn] |
| 134 |
SET debug_sync = "RESET"; |
| 135 |
include/include/assert_logical_timestamps.inc [13 14] |
| 136 |
# |
| 137 |
# Verify the statements the following statement in different commit |
| 138 |
# window logs correct last_committed |
| 139 |
# |
| 140 |
INSERT INTO t1(c2) VALUES("use max_comitted as last_committed"); |
| 141 |
include/include/assert_logical_timestamps.inc [2 3] |
| 142 |
# |
| 143 |
# Verify binlog rotation doesn't effect the correctness of last_committed |
| 144 |
# |
| 145 |
FLUSH BINARY LOGS; |
| 146 |
[connection admin_conn] |
| 147 |
SET debug_sync = "waiting_in_the_middle_of_flush_stage SIGNAL admin_ready |
| 148 |
WAIT_FOR admin_continue"; |
| 149 |
REPAIR TABLE t1;; |
| 150 |
[connection insert_conn] |
| 151 |
SET debug_sync = "now WAIT_FOR admin_ready"; |
| 152 |
SET debug_sync = "bgc_after_enrolling_for_flush_stage SIGNAL insert_ready |
| 153 |
WAIT_FOR insert_continue"; |
| 154 |
INSERT INTO t1(c2) VALUES("REPAIR TABLE t1;"); |
| 155 |
[connection default] |
| 156 |
SET debug_sync = "now WAIT_FOR insert_ready"; |
| 157 |
SET debug_sync = "now SIGNAL admin_continue,insert_continue"; |
| 158 |
[connection admin_conn] |
| 159 |
Table Op Msg_type Msg_text |
| 160 |
test.t1 repair status OK |
| 161 |
[connection insert_conn] |
| 162 |
SET debug_sync = "RESET"; |
| 163 |
include/include/assert_logical_timestamps.inc [0 2] |
| 164 |
REPAIR TABLE t1; |
| 165 |
Table Op Msg_type Msg_text |
| 166 |
test.t1 repair status OK |
| 167 |
FLUSH BINARY LOGS; |
| 168 |
INSERT INTO t1(c2) VALUES("use 0 as last_committed"); |
| 169 |
include/include/assert_logical_timestamps.inc [0 1] |
| 170 |
# |
| 171 |
# Verify ALTER TABLE without [OPTIMIZE|REPAIR|ANALYZE] PARTITION and |
| 172 |
# INSERT on different table should be logged in same commit window |
| 173 |
# |
| 174 |
CREATE TABLE t2(c1 INT); |
| 175 |
[connection admin_conn] |
| 176 |
SET debug_sync = "waiting_in_the_middle_of_flush_stage SIGNAL admin_ready |
| 177 |
WAIT_FOR admin_continue"; |
| 178 |
ALTER TABLE t2 ADD COLUMN c2 INT;; |
| 179 |
[connection insert_conn] |
| 180 |
SET debug_sync = "now WAIT_FOR admin_ready"; |
| 181 |
SET debug_sync = "bgc_after_enrolling_for_flush_stage SIGNAL insert_ready |
| 182 |
WAIT_FOR insert_continue"; |
| 183 |
INSERT INTO t1(c2) VALUES("ALTER TABLE t2 ADD COLUMN c2 INT;"); |
| 184 |
[connection default] |
| 185 |
SET debug_sync = "now WAIT_FOR insert_ready"; |
| 186 |
SET debug_sync = "now SIGNAL admin_continue,insert_continue"; |
| 187 |
[connection admin_conn] |
| 188 |
[connection insert_conn] |
| 189 |
SET debug_sync = "RESET"; |
| 190 |
include/include/assert_logical_timestamps.inc [2 4] |
| 191 |
DROP TABLE t1, t2; |