Commit 739ac25
Venkatesh Duggirala
BUG#20928790 SHOW BINLOG EVENTS COMPLETELY LOCKS DOWN WRITES TO BINLOG, HENCE TRANSACTIONS.
Problem: While a `SHOW BINLOG EVENTS` is executing, any parallel transaction
is blocked.
Analysis:
========
In the good old days, replication was coded such that every access to the
binlog was protected by a mutex. So `Show binlog events` also acquires
LOCK_log mutex and loops through the file to print the events in order not
to get conflicts with any ongoing operations. While this operation is happening,
all binlog write operation which are trying to acquire LOCK_log mutex are blocked.
Hence all the parallel transactions are blocked.
When 'show binlog events' opens the file to read the events from it,
the file is locked and if there is parallel purge operation to delete
this file that operation will fail with a warning that "file 'xyz' was
not purged because it was being read by another thread". Hence
server does not require to acquire a lock while iterating through
the events in the file.
Fix:
====
Acquire LOCK_log only for the duration to calculate the log's end
position. LOCK_log should be acquired even while we are checking
whether the log is active log or not. Once 'end_pos' is calculated
for the given binary log, the events are displayed till that position.
Since we do not acquire LOCK_log (acquired only for less duration),
parallel transactions will not be blocked for large duration.1 parent a142352 commit 739ac25
4 files changed
Lines changed: 89 additions & 12 deletions
File tree
- mysql-test/suite/binlog
- r
- t
- sql
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2282 | 2282 | | |
2283 | 2283 | | |
2284 | 2284 | | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
2285 | 2304 | | |
2286 | 2305 | | |
2287 | 2306 | | |
2288 | 2307 | | |
2289 | 2308 | | |
2290 | 2309 | | |
2291 | 2310 | | |
2292 | | - | |
2293 | | - | |
2294 | 2311 | | |
2295 | 2312 | | |
2296 | 2313 | | |
| |||
2325 | 2342 | | |
2326 | 2343 | | |
2327 | 2344 | | |
| 2345 | + | |
2328 | 2346 | | |
2329 | 2347 | | |
2330 | 2348 | | |
| |||
2333 | 2351 | | |
2334 | 2352 | | |
2335 | 2353 | | |
2336 | | - | |
2337 | 2354 | | |
2338 | 2355 | | |
2339 | 2356 | | |
2340 | 2357 | | |
2341 | 2358 | | |
2342 | 2359 | | |
2343 | | - | |
| 2360 | + | |
2344 | 2361 | | |
2345 | 2362 | | |
2346 | 2363 | | |
2347 | 2364 | | |
2348 | 2365 | | |
2349 | 2366 | | |
2350 | | - | |
2351 | 2367 | | |
2352 | 2368 | | |
2353 | 2369 | | |
2354 | | - | |
2355 | 2370 | | |
2356 | 2371 | | |
2357 | 2372 | | |
| |||
3501 | 3516 | | |
3502 | 3517 | | |
3503 | 3518 | | |
3504 | | - | |
| 3519 | + | |
3505 | 3520 | | |
3506 | | - | |
| 3521 | + | |
| 3522 | + | |
3507 | 3523 | | |
3508 | | - | |
| 3524 | + | |
| 3525 | + | |
3509 | 3526 | | |
3510 | 3527 | | |
3511 | 3528 | | |
3512 | 3529 | | |
3513 | 3530 | | |
3514 | 3531 | | |
3515 | | - | |
| 3532 | + | |
3516 | 3533 | | |
3517 | 3534 | | |
3518 | 3535 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
666 | | - | |
| 666 | + | |
667 | 667 | | |
668 | 668 | | |
669 | 669 | | |
| |||
0 commit comments