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