|
| 1 | +CREATE TABLE user(id int primary key, j int) ENGINE=InnoDB; |
| 2 | +CREATE TABLE user_session(id int primary key, fk1 int, fk2 int) ENGINE=InnoDB; |
| 3 | +alter table user_session add foreign key (fk1) references user(id); |
| 4 | +INSERT INTO user values (1,0), (2,0), (3,0), (4,0); |
| 5 | +INSERT INTO user_session values (1,1,1); |
| 6 | +connect node_1_u, 127.0.0.1, root, , test, $NODE_MYPORT_1; |
| 7 | +connect node_1_i, 127.0.0.1, root, , test, $NODE_MYPORT_1; |
| 8 | +connect node_2_i, 127.0.0.1, root, , test, $NODE_MYPORT_2; |
| 9 | +"Phase 1: plain SQL statements" |
| 10 | +connection node_1; |
| 11 | +connection node_1_u; |
| 12 | +begin; |
| 13 | +update user set j = j + 1 WHERE id > 0; |
| 14 | +connection node_1_i; |
| 15 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 16 | +insert into user_session(id,fk1,fk2) values (2, 2, 2); |
| 17 | +connection node_1; |
| 18 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 19 | +connection node_2_i; |
| 20 | +insert into user_session(id,fk1,fk2) values (2, 2, 3); |
| 21 | +connection node_1; |
| 22 | +set debug_sync='now SIGNAL cont_ins'; |
| 23 | +connection node_1_i; |
| 24 | +connection node_1_u; |
| 25 | +commit; |
| 26 | +connection node_1; |
| 27 | +truncate user_session; |
| 28 | +set debug_sync = reset; |
| 29 | +connection node_1_u; |
| 30 | +begin; |
| 31 | +update user set j = j + 1 WHERE id > 0; |
| 32 | +connection node_1_i; |
| 33 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 34 | +insert into user_session(id,fk1,fk2) values (2, 2, 2); |
| 35 | +connection node_1; |
| 36 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 37 | +connection node_2_i; |
| 38 | +insert into user_session(id,fk1,fk2) values (2, 2, 3); |
| 39 | +connection node_1; |
| 40 | +set debug_sync='now SIGNAL cont_ins'; |
| 41 | +connection node_1_i; |
| 42 | +connection node_1_u; |
| 43 | +commit; |
| 44 | +connection node_1; |
| 45 | +truncate user_session; |
| 46 | +set debug_sync = reset; |
| 47 | +connection node_1_u; |
| 48 | +begin; |
| 49 | +update user set j = j + 1 WHERE id > 0; |
| 50 | +connection node_1_i; |
| 51 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 52 | +insert into user_session(id,fk1,fk2) values (2, 2, 2); |
| 53 | +connection node_1; |
| 54 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 55 | +connection node_2_i; |
| 56 | +insert into user_session(id,fk1,fk2) values (2, 2, 3); |
| 57 | +connection node_1; |
| 58 | +set debug_sync='now SIGNAL cont_ins'; |
| 59 | +connection node_1_i; |
| 60 | +connection node_1_u; |
| 61 | +commit; |
| 62 | +connection node_1; |
| 63 | +truncate user_session; |
| 64 | +set debug_sync = reset; |
| 65 | +connection node_1_u; |
| 66 | +begin; |
| 67 | +update user set j = j + 1 WHERE id > 0; |
| 68 | +connection node_1_i; |
| 69 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 70 | +insert into user_session(id,fk1,fk2) values (2, 2, 2); |
| 71 | +connection node_1; |
| 72 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 73 | +connection node_2_i; |
| 74 | +insert into user_session(id,fk1,fk2) values (2, 2, 3); |
| 75 | +connection node_1; |
| 76 | +set debug_sync='now SIGNAL cont_ins'; |
| 77 | +connection node_1_i; |
| 78 | +connection node_1_u; |
| 79 | +commit; |
| 80 | +connection node_1; |
| 81 | +truncate user_session; |
| 82 | +set debug_sync = reset; |
| 83 | +connection node_1_u; |
| 84 | +begin; |
| 85 | +update user set j = j + 1 WHERE id > 0; |
| 86 | +connection node_1_i; |
| 87 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 88 | +insert into user_session(id,fk1,fk2) values (2, 2, 2); |
| 89 | +connection node_1; |
| 90 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 91 | +connection node_2_i; |
| 92 | +insert into user_session(id,fk1,fk2) values (2, 2, 3); |
| 93 | +connection node_1; |
| 94 | +set debug_sync='now SIGNAL cont_ins'; |
| 95 | +connection node_1_i; |
| 96 | +connection node_1_u; |
| 97 | +commit; |
| 98 | +connection node_1; |
| 99 | +truncate user_session; |
| 100 | +set debug_sync = reset; |
| 101 | +connection node_1_u; |
| 102 | +begin; |
| 103 | +update user set j = j + 1 WHERE id > 0; |
| 104 | +connection node_1_i; |
| 105 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 106 | +insert into user_session(id,fk1,fk2) values (2, 2, 2); |
| 107 | +connection node_1; |
| 108 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 109 | +connection node_2_i; |
| 110 | +insert into user_session(id,fk1,fk2) values (2, 2, 3); |
| 111 | +connection node_1; |
| 112 | +set debug_sync='now SIGNAL cont_ins'; |
| 113 | +connection node_1_i; |
| 114 | +connection node_1_u; |
| 115 | +commit; |
| 116 | +connection node_1; |
| 117 | +truncate user_session; |
| 118 | +set debug_sync = reset; |
| 119 | +connection node_1_u; |
| 120 | +begin; |
| 121 | +update user set j = j + 1 WHERE id > 0; |
| 122 | +connection node_1_i; |
| 123 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 124 | +insert into user_session(id,fk1,fk2) values (2, 2, 2); |
| 125 | +connection node_1; |
| 126 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 127 | +connection node_2_i; |
| 128 | +insert into user_session(id,fk1,fk2) values (2, 2, 3); |
| 129 | +connection node_1; |
| 130 | +set debug_sync='now SIGNAL cont_ins'; |
| 131 | +connection node_1_i; |
| 132 | +connection node_1_u; |
| 133 | +commit; |
| 134 | +connection node_1; |
| 135 | +truncate user_session; |
| 136 | +set debug_sync = reset; |
| 137 | +connection node_1_u; |
| 138 | +begin; |
| 139 | +update user set j = j + 1 WHERE id > 0; |
| 140 | +connection node_1_i; |
| 141 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 142 | +insert into user_session(id,fk1,fk2) values (2, 2, 2); |
| 143 | +connection node_1; |
| 144 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 145 | +connection node_2_i; |
| 146 | +insert into user_session(id,fk1,fk2) values (2, 2, 3); |
| 147 | +connection node_1; |
| 148 | +set debug_sync='now SIGNAL cont_ins'; |
| 149 | +connection node_1_i; |
| 150 | +connection node_1_u; |
| 151 | +commit; |
| 152 | +connection node_1; |
| 153 | +truncate user_session; |
| 154 | +set debug_sync = reset; |
| 155 | +connection node_1_u; |
| 156 | +begin; |
| 157 | +update user set j = j + 1 WHERE id > 0; |
| 158 | +connection node_1_i; |
| 159 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 160 | +insert into user_session(id,fk1,fk2) values (2, 2, 2); |
| 161 | +connection node_1; |
| 162 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 163 | +connection node_2_i; |
| 164 | +insert into user_session(id,fk1,fk2) values (2, 2, 3); |
| 165 | +connection node_1; |
| 166 | +set debug_sync='now SIGNAL cont_ins'; |
| 167 | +connection node_1_i; |
| 168 | +connection node_1_u; |
| 169 | +commit; |
| 170 | +connection node_1; |
| 171 | +truncate user_session; |
| 172 | +set debug_sync = reset; |
| 173 | +connection node_1_u; |
| 174 | +begin; |
| 175 | +update user set j = j + 1 WHERE id > 0; |
| 176 | +connection node_1_i; |
| 177 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 178 | +insert into user_session(id,fk1,fk2) values (2, 2, 2); |
| 179 | +connection node_1; |
| 180 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 181 | +connection node_2_i; |
| 182 | +insert into user_session(id,fk1,fk2) values (2, 2, 3); |
| 183 | +connection node_1; |
| 184 | +set debug_sync='now SIGNAL cont_ins'; |
| 185 | +connection node_1_i; |
| 186 | +connection node_1_u; |
| 187 | +commit; |
| 188 | +connection node_1; |
| 189 | +truncate user_session; |
| 190 | +set debug_sync = reset; |
| 191 | +"Phase 2: prepared statements" |
| 192 | +connection node_1_u; |
| 193 | +prepare upd from 'update user set j = j + 1 WHERE id > 0'; |
| 194 | +connection node_1_i; |
| 195 | +prepare ins1 from 'insert into user_session(id,fk1,fk2) values (2, 2, 2)'; |
| 196 | +connection node_2_i; |
| 197 | +prepare ins2 from 'insert into user_session(id,fk1,fk2) values (2, 2, 3)'; |
| 198 | +connection node_1; |
| 199 | +connection node_1_u; |
| 200 | +begin; |
| 201 | +execute upd; |
| 202 | +connection node_1_i; |
| 203 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 204 | +execute ins1; |
| 205 | +connection node_1; |
| 206 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 207 | +connection node_2_i; |
| 208 | +execute ins2; |
| 209 | +connection node_1; |
| 210 | +set debug_sync='now SIGNAL cont_ins'; |
| 211 | +connection node_1_i; |
| 212 | +connection node_1_u; |
| 213 | +commit; |
| 214 | +connection node_1; |
| 215 | +truncate user_session; |
| 216 | +set debug_sync = reset; |
| 217 | +connection node_1_u; |
| 218 | +begin; |
| 219 | +execute upd; |
| 220 | +connection node_1_i; |
| 221 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 222 | +execute ins1; |
| 223 | +connection node_1; |
| 224 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 225 | +connection node_2_i; |
| 226 | +execute ins2; |
| 227 | +connection node_1; |
| 228 | +set debug_sync='now SIGNAL cont_ins'; |
| 229 | +connection node_1_i; |
| 230 | +connection node_1_u; |
| 231 | +commit; |
| 232 | +connection node_1; |
| 233 | +truncate user_session; |
| 234 | +set debug_sync = reset; |
| 235 | +connection node_1_u; |
| 236 | +begin; |
| 237 | +execute upd; |
| 238 | +connection node_1_i; |
| 239 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 240 | +execute ins1; |
| 241 | +connection node_1; |
| 242 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 243 | +connection node_2_i; |
| 244 | +execute ins2; |
| 245 | +connection node_1; |
| 246 | +set debug_sync='now SIGNAL cont_ins'; |
| 247 | +connection node_1_i; |
| 248 | +connection node_1_u; |
| 249 | +commit; |
| 250 | +connection node_1; |
| 251 | +truncate user_session; |
| 252 | +set debug_sync = reset; |
| 253 | +connection node_1_u; |
| 254 | +begin; |
| 255 | +execute upd; |
| 256 | +connection node_1_i; |
| 257 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 258 | +execute ins1; |
| 259 | +connection node_1; |
| 260 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 261 | +connection node_2_i; |
| 262 | +execute ins2; |
| 263 | +connection node_1; |
| 264 | +set debug_sync='now SIGNAL cont_ins'; |
| 265 | +connection node_1_i; |
| 266 | +connection node_1_u; |
| 267 | +commit; |
| 268 | +connection node_1; |
| 269 | +truncate user_session; |
| 270 | +set debug_sync = reset; |
| 271 | +connection node_1_u; |
| 272 | +begin; |
| 273 | +execute upd; |
| 274 | +connection node_1_i; |
| 275 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 276 | +execute ins1; |
| 277 | +connection node_1; |
| 278 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 279 | +connection node_2_i; |
| 280 | +execute ins2; |
| 281 | +connection node_1; |
| 282 | +set debug_sync='now SIGNAL cont_ins'; |
| 283 | +connection node_1_i; |
| 284 | +connection node_1_u; |
| 285 | +commit; |
| 286 | +connection node_1; |
| 287 | +truncate user_session; |
| 288 | +set debug_sync = reset; |
| 289 | +connection node_1_u; |
| 290 | +begin; |
| 291 | +execute upd; |
| 292 | +connection node_1_i; |
| 293 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 294 | +execute ins1; |
| 295 | +connection node_1; |
| 296 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 297 | +connection node_2_i; |
| 298 | +execute ins2; |
| 299 | +connection node_1; |
| 300 | +set debug_sync='now SIGNAL cont_ins'; |
| 301 | +connection node_1_i; |
| 302 | +connection node_1_u; |
| 303 | +commit; |
| 304 | +connection node_1; |
| 305 | +truncate user_session; |
| 306 | +set debug_sync = reset; |
| 307 | +connection node_1_u; |
| 308 | +begin; |
| 309 | +execute upd; |
| 310 | +connection node_1_i; |
| 311 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 312 | +execute ins1; |
| 313 | +connection node_1; |
| 314 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 315 | +connection node_2_i; |
| 316 | +execute ins2; |
| 317 | +connection node_1; |
| 318 | +set debug_sync='now SIGNAL cont_ins'; |
| 319 | +connection node_1_i; |
| 320 | +connection node_1_u; |
| 321 | +commit; |
| 322 | +connection node_1; |
| 323 | +truncate user_session; |
| 324 | +set debug_sync = reset; |
| 325 | +connection node_1_u; |
| 326 | +begin; |
| 327 | +execute upd; |
| 328 | +connection node_1_i; |
| 329 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 330 | +execute ins1; |
| 331 | +connection node_1; |
| 332 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 333 | +connection node_2_i; |
| 334 | +execute ins2; |
| 335 | +connection node_1; |
| 336 | +set debug_sync='now SIGNAL cont_ins'; |
| 337 | +connection node_1_i; |
| 338 | +connection node_1_u; |
| 339 | +commit; |
| 340 | +connection node_1; |
| 341 | +truncate user_session; |
| 342 | +set debug_sync = reset; |
| 343 | +connection node_1_u; |
| 344 | +begin; |
| 345 | +execute upd; |
| 346 | +connection node_1_i; |
| 347 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 348 | +execute ins1; |
| 349 | +connection node_1; |
| 350 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 351 | +connection node_2_i; |
| 352 | +execute ins2; |
| 353 | +connection node_1; |
| 354 | +set debug_sync='now SIGNAL cont_ins'; |
| 355 | +connection node_1_i; |
| 356 | +connection node_1_u; |
| 357 | +commit; |
| 358 | +connection node_1; |
| 359 | +truncate user_session; |
| 360 | +set debug_sync = reset; |
| 361 | +connection node_1_u; |
| 362 | +begin; |
| 363 | +execute upd; |
| 364 | +connection node_1_i; |
| 365 | +set debug_sync='lock_wait_suspend_thread_enter SIGNAL ins_waiting WAIT_FOR cont_ins'; |
| 366 | +execute ins1; |
| 367 | +connection node_1; |
| 368 | +set debug_sync='now WAIT_FOR ins_waiting'; |
| 369 | +connection node_2_i; |
| 370 | +execute ins2; |
| 371 | +connection node_1; |
| 372 | +set debug_sync='now SIGNAL cont_ins'; |
| 373 | +connection node_1_i; |
| 374 | +connection node_1_u; |
| 375 | +commit; |
| 376 | +connection node_1; |
| 377 | +truncate user_session; |
| 378 | +set debug_sync = reset; |
| 379 | +connection node_1; |
| 380 | +drop table user_session,user; |
0 commit comments