-
Joao Gramacho authored
Problem ======= Replicating from older to newer MySQL server versions may lead to ER_PARSE_ERROR on replication applier threads because of, for example, the workload is creating a table using a name that on the older server version is now a reserved word. One common workaround fix for this issue DBAs/operators do is to apply the offending transaction manually (changing it enough to be applied without errors) and making the replication applier thread to skip the offending transaction already present on slaves relay log. When GTID_MODE is ON, the recommended way of making the replication applier to skip a transaction is to commit its GTID with an empty transactions (or with the replacement transaction), but GTID auto skip was not working for statements leading to ER_PARSE_ERROR. Analysis ======== GTID auto skip functionality depends on MySQL parser for: - Not skip "innocent" statements. Here, "innocent" includes SET, SHOW, SELECT, DO, USE, and empty query, unless it invokes a stored function. The reason we allow innocent statements to execute even within skipped transactions is that they can be useful for testing and debugging. E.g., we want to run SELECT @@session.gtid_owned to check that there is not a bug that makes the server acquire ownership. - Keep track of transaction boundaries. When applying a workload dumped from mysqlbinlog client program, even skipping statements from already applied transactions, the client session applying the workload must known if a statement is a DDL or a DML (if it is supposed to be wrapped with "BEGIN/COMMIT" or not). Fix === This patch will make the replication applier thread to ignore ER_PARSE_ERROR when applying query events if the transaction being applied is also being GTID auto skipped. Making workloads dumped from mysqlbinlog to also work with GTID auto skip when some statements lead to ER_PARSE_ERROR is too risk, as the GTID enforcement logic could not be guaranteed without having detailed information about the offending statement.
Joao Gramacho authoredProblem ======= Replicating from older to newer MySQL server versions may lead to ER_PARSE_ERROR on replication applier threads because of, for example, the workload is creating a table using a name that on the older server version is now a reserved word. One common workaround fix for this issue DBAs/operators do is to apply the offending transaction manually (changing it enough to be applied without errors) and making the replication applier thread to skip the offending transaction already present on slaves relay log. When GTID_MODE is ON, the recommended way of making the replication applier to skip a transaction is to commit its GTID with an empty transactions (or with the replacement transaction), but GTID auto skip was not working for statements leading to ER_PARSE_ERROR. Analysis ======== GTID auto skip functionality depends on MySQL parser for: - Not skip "innocent" statements. Here, "innocent" includes SET, SHOW, SELECT, DO, USE, and empty query, unless it invokes a stored function. The reason we allow innocent statements to execute even within skipped transactions is that they can be useful for testing and debugging. E.g., we want to run SELECT @@session.gtid_owned to check that there is not a bug that makes the server acquire ownership. - Keep track of transaction boundaries. When applying a workload dumped from mysqlbinlog client program, even skipping statements from already applied transactions, the client session applying the workload must known if a statement is a DDL or a DML (if it is supposed to be wrapped with "BEGIN/COMMIT" or not). Fix === This patch will make the replication applier thread to ignore ER_PARSE_ERROR when applying query events if the transaction being applied is also being GTID auto skipped. Making workloads dumped from mysqlbinlog to also work with GTID auto skip when some statements lead to ER_PARSE_ERROR is too risk, as the GTID enforcement logic could not be guaranteed without having detailed information about the offending statement.
Loading