Commit c529846
Sujatha Sivakumar
Bug#16387720: BLOCKED WITH FLUSH TABLES WITH READ LOCK +
SHOW SLAVE STATUS
Problem:
=======
If a client thread on a slave does FLUSH TABLES WITH READ
LOCK; then master does some updates, SHOW SLAVE STATUS in
the same client will be blocked. If the blocked slave server
is killed and restarted when GTID's are enabled, one GTID
gets missed leaving the slave in an out of sync state.
Using 'relay-log-recovery=1' should do a crash safe slave
recovery but it is not happening.
Analysis:
========
RPL info tables "slave_master_info" and "slave_relay_log_info"
are used to store slave's thread's positions. When a FTWRL
is issued on slave this command blocks all operations on
tables. Hence when some update operations are done on master
the slave thread will be able to open the tables but while
closing, an internal commit operation will be blocked. These
blocked info tables make the "SHOW SLAVE STATUS" to hang.
When "relay-log-recovery=1" during crash recovery all the
partial written events will be discarded the master info
table is initialised with the information read from relay
log info table. The "Retrieved GTID" set should be cleared
so that partial read events are discarded and they are
fetched once again. Since this is not happening
"The Retried GTID" is considered to be executed and the
actual transaction is skipped.
Fix:
===
Info tables should be made independent of global read lock.
At the time of opening the RPL info tables the following
"MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK" flag is set to make
the info tables not to block when the FTWRL is in progress.
Hence a similar flag is introduced in "ha_commit_trans"
code which will allow commit to complete even if a global
read lock is active. This flag can be used to allow changes
to internal tables (e.g. slave status tables).
To fix the missing GTID issue using "relay-log-recovery"
option, during recovery process retrieved GTID set is cleared.1 parent 51baa21 commit c529846
6 files changed
Lines changed: 39 additions & 12 deletions
File tree
- mysql-test/suite/rpl/t
- sql
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
788 | 788 | | |
789 | 789 | | |
790 | 790 | | |
| 791 | + | |
| 792 | + | |
791 | 793 | | |
792 | 794 | | |
793 | | - | |
794 | | - | |
| 795 | + | |
| 796 | + | |
795 | 797 | | |
796 | 798 | | |
797 | 799 | | |
| |||
884 | 886 | | |
885 | 887 | | |
886 | 888 | | |
| 889 | + | |
| 890 | + | |
887 | 891 | | |
888 | 892 | | |
889 | | - | |
890 | | - | |
| 893 | + | |
| 894 | + | |
891 | 895 | | |
892 | 896 | | |
893 | 897 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1296 | 1296 | | |
1297 | 1297 | | |
1298 | 1298 | | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
1299 | 1304 | | |
1300 | 1305 | | |
1301 | 1306 | | |
| |||
1309 | 1314 | | |
1310 | 1315 | | |
1311 | 1316 | | |
1312 | | - | |
| 1317 | + | |
| 1318 | + | |
1313 | 1319 | | |
1314 | 1320 | | |
1315 | 1321 | | |
| |||
1379 | 1385 | | |
1380 | 1386 | | |
1381 | 1387 | | |
1382 | | - | |
| 1388 | + | |
1383 | 1389 | | |
1384 | 1390 | | |
1385 | 1391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3404 | 3404 | | |
3405 | 3405 | | |
3406 | 3406 | | |
3407 | | - | |
| 3407 | + | |
3408 | 3408 | | |
3409 | 3409 | | |
3410 | 3410 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
160 | 165 | | |
161 | 166 | | |
162 | 167 | | |
163 | 168 | | |
164 | 169 | | |
165 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
166 | 177 | | |
167 | 178 | | |
168 | 179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
491 | 498 | | |
492 | 499 | | |
493 | 500 | | |
| |||
0 commit comments