Commit 58c71ff
committed
BUG#37331118 Applier prepare error retry [compare_error]
The replication applier normally retries temporary errors occurring
while applying transactions. Such retry logic is not performed for
transactions containing row events where the STMT_END_F flag is missing.
For such events, the statement will instead be committed as an
additional step while applying the subsequent COMMIT query event when it
is detected that there are still locked tables. When committing the
statement, temporary errors are not handled properly.
This second patch fixes the handling of statement commit failure to
compare the returned error code in the same way as other failures. This
means that rather than attempting to commit the entire transaction (and
encountering an error indicating it has been rolled back), the applier
will now report the error and properly retry it as many times as
configured by the transaction retry settings.
In addition, the failure analysis capabilities are improved by extending
the error reporting to include all the warnings from the failed
statement commit, this is done in the same format and style as when
failing to apply row log events.
The effect of this change can be seen in the test implemented by the
prior patch:
- the error code that stops replication is now the error from failing
to commit the statement. Its also the same error code as when
same error occurs without missing STMT_END_F.
- the transaction retry attempt counter shows that the transaction was
retried several times.
Each retry attempt output two lines to the MySQL Server log files, first
line indicates that error occured when committing statement and includes
all warnings, the second line only contains the actual error:
<date> [Warning] [MY-010584] [Repl] Replica SQL for channel '':
Worker 1 failed executing transaction 'ANONYMOUS' at source log
binlog.000002, end_log_pos 711; Error in cleaning up after an event
preceding the commit; Got temporary error 266 'Time-out in NDB,
probably caused by deadlock' from NDB, Error_code: 1297; Lock wait
timeout exceeded; try restarting transaction, Error_code: 1205; Got
error 146 - 'Lock timed out; Retry transaction' during COMMIT,
Error_code: 1180; the group log file/position: binlog.000002
0, Error_code: MY-000001
<date> [Warning] [MY-010584] [Repl] Replica SQL for channel '':
Worker 1 failed executing transaction 'ANONYMOUS' at source log
binlog.000002, end_log_pos 711; Error 'Lock wait timeout exceeded;
try restarting transaction' on query. Default database: ''. Query:
'COMMIT', Error_code: MY-001205
Change-Id: I47337b8ae0841976219f70aa94d2861dd7b1ed6f1 parent ac6d59c commit 58c71ff
File tree
3 files changed
+23
-11
lines changed- mysql-test/suite/ndb_rpl
- r
- t
- sql
3 files changed
+23
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4452 | 4452 | | |
4453 | 4453 | | |
4454 | 4454 | | |
4455 | | - | |
| 4455 | + | |
| 4456 | + | |
| 4457 | + | |
4456 | 4458 | | |
4457 | 4459 | | |
4458 | 4460 | | |
| |||
4531 | 4533 | | |
4532 | 4534 | | |
4533 | 4535 | | |
| 4536 | + | |
| 4537 | + | |
| 4538 | + | |
| 4539 | + | |
| 4540 | + | |
| 4541 | + | |
| 4542 | + | |
| 4543 | + | |
| 4544 | + | |
| 4545 | + | |
4534 | 4546 | | |
4535 | 4547 | | |
4536 | 4548 | | |
4537 | | - | |
| 4549 | + | |
| 4550 | + | |
4538 | 4551 | | |
4539 | 4552 | | |
4540 | 4553 | | |
4541 | 4554 | | |
| 4555 | + | |
4542 | 4556 | | |
4543 | 4557 | | |
4544 | 4558 | | |
| |||
4581 | 4595 | | |
4582 | 4596 | | |
4583 | 4597 | | |
4584 | | - | |
4585 | | - | |
4586 | | - | |
| 4598 | + | |
4587 | 4599 | | |
4588 | 4600 | | |
4589 | 4601 | | |
| |||
0 commit comments