Hello Sergei,

On 17/07/20 1:46 pm, Sergei Golubchik wrote:
Hi, sujatha!

On Jul 17, sujatha wrote:
revision-id: 9b999e79a358de2c86ae44fe83cf6c62cff1d2ef (mariadb-10.3.21-180-g9b999e79a35)
parent(s): 73aa31fbfd793bdb597bb19c52118ab4e637f4bc
author: Sujatha
committer: Sujatha
timestamp: 2020-07-17 12:23:32 +0530
message:

MDEV-23108: Point in time recovery of binary log fails when sql_mode=ORACLE

Problem:
========
During point in time recovery of binary log syntax error is reported for
BEGIN statement and recovery fails.

Analysis:
=========
In MariaDB 10.3 and later, setting the sql_mode system variable to Oracle
allows the server to understand a subset of Oracle's PL/SQL language. When
sql_mode=ORACLE is set, it switches the parser from the MariaDB parser to
Oracle compatible parser. With this change 'BEGIN' is not considered as
'START TRANSACTION'. Hence the syntax error is reported.

Fix:
===
Add a new option to 'mysqlbinlog' tool named 'sql_mode_oracle'. When
'sql_mode_oracle' option is specified 'BEGIN' statements will be replaced
with 'START TRANSACTION' in the mysqlbinlog output.
Why not to print START TRANSACTION unconditionally? It worsk in all
modes, a user won't need to learn a new option.


There can be user applications that parse the mysqlbinlog output  for BEGIN,

they  may suffer if we change the expected BEGIN to something else. Hence

the current solution was chosen for GA versions. In 10.6 the BEGIN can be replaced

to START TRANSACTION unconditionally.


Thank you

S.Sujatha


Regards,
Sergei
VP of MariaDB Server Engineering
and security@mariadb.org