mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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: === At preset 'BEGIN' query is generated from 'Gtid_log_event::print'. The current session specific 'sql_mode' information is not present as part of 'Gtid_log_event'. If it was available then, mysqlbinlog tool can make use of 'sql_mode == ORACLE' and can output "START TRANSACTION" in this particular mode and for other sql_modes it will write "BEGIN" as part of output. Since it is not available 'mysqlbinlog' tool will output all 'BEGIN' statements as 'START TRANSACTION' irrespective of 'sql_mode'.
This commit is contained in:
@@ -81,7 +81,7 @@ c08 TEXT
|
||||
# at #
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-2 trans
|
||||
/*!100001 SET @@session.gtid_seq_no=2*//*!*/;
|
||||
BEGIN
|
||||
START TRANSACTION
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
@@ -107,7 +107,7 @@ COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-3 trans
|
||||
/*!100001 SET @@session.gtid_seq_no=3*//*!*/;
|
||||
BEGIN
|
||||
START TRANSACTION
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
@@ -133,7 +133,7 @@ COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-4 trans
|
||||
/*!100001 SET @@session.gtid_seq_no=4*//*!*/;
|
||||
BEGIN
|
||||
START TRANSACTION
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
@@ -159,7 +159,7 @@ COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-5 trans
|
||||
/*!100001 SET @@session.gtid_seq_no=5*//*!*/;
|
||||
BEGIN
|
||||
START TRANSACTION
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
@@ -213,7 +213,7 @@ COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX GTID 0-1-6 trans
|
||||
/*!100001 SET @@session.gtid_seq_no=6*//*!*/;
|
||||
BEGIN
|
||||
START TRANSACTION
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
@@ -296,7 +296,7 @@ ROLLBACK/*!*/;
|
||||
# Number of rows: 3
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Rotate to master-bin.000002 pos: 4
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
|
||||
BEGIN/*!*/;
|
||||
START TRANSACTION/*!*/;
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO `test`.`t1`
|
||||
### SET
|
||||
@@ -331,7 +331,7 @@ BEGIN/*!*/;
|
||||
COMMIT
|
||||
/*!*/;
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
|
||||
BEGIN/*!*/;
|
||||
START TRANSACTION/*!*/;
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE `test`.`t1`
|
||||
### WHERE
|
||||
@@ -374,7 +374,7 @@ BEGIN/*!*/;
|
||||
COMMIT
|
||||
/*!*/;
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
|
||||
BEGIN/*!*/;
|
||||
START TRANSACTION/*!*/;
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM `test`.`t1`
|
||||
### WHERE
|
||||
@@ -389,7 +389,7 @@ BEGIN/*!*/;
|
||||
COMMIT
|
||||
/*!*/;
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
|
||||
BEGIN/*!*/;
|
||||
START TRANSACTION/*!*/;
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM `test`.`t1`
|
||||
### WHERE
|
||||
@@ -404,7 +404,7 @@ BEGIN/*!*/;
|
||||
COMMIT
|
||||
/*!*/;
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Xid = #
|
||||
BEGIN/*!*/;
|
||||
START TRANSACTION/*!*/;
|
||||
#010909 9:46:40 server id 1 end_log_pos # CRC32 XXX Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM `test`.`t1`
|
||||
### WHERE
|
||||
|
Reference in New Issue
Block a user