summaryrefslogtreecommitdiff
path: root/sql/sql_lex.h
diff options
context:
space:
mode:
authorVenkatesh Duggirala <venkatesh.duggirala@oracle.com>2015-11-19 13:59:27 +0530
committerVenkatesh Duggirala <venkatesh.duggirala@oracle.com>2015-11-19 13:59:27 +0530
commitbb56c30ad750465ab140477a1042cb34e714dcc5 (patch)
tree5190a46fbef1571e1b87de093108859553b57818 /sql/sql_lex.h
parent63dc9c3f42858e0f855abb875f37cb096cf3ae27 (diff)
downloadmariadb-git-bb56c30ad750465ab140477a1042cb34e714dcc5.tar.gz
Bug#17047208 REPLICATION DIFFERENCE FOR MULTIPLE TRIGGERS
Problem & Analysis: If DML invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column, that DML has to be marked as 'unsafe' statement. If the tables are locked in the transaction prior to DML statement (using LOCK TABLES), then the same statement is not marked as 'unsafe' statement. The logic of checking whether unsafeness is protected with if (!thd->locked_tables_mode). Hence if we lock the tables prior to DML statement, it is *not* entering into this if condition. Hence the statement is not marked as unsafe statement. Fix: Irrespective of locked_tables_mode value, the unsafeness check should be done. Now with this patch, the code is moved out to 'decide_logging_format()' function where all these checks are happening and also with out 'if(!thd->locked_tables_mode)'. Along with the specified test case in the bug scenario (BINLOG_STMT_UNSAFE_AUTOINC_COLUMNS), we also identified that other cases BINLOG_STMT_UNSAFE_AUTOINC_NOT_FIRST, BINLOG_STMT_UNSAFE_WRITE_AUTOINC_SELECT, BINLOG_STMT_UNSAFE_INSERT_TWO_KEYS are also protected with thd->locked_tables_mode which is not right. All of those checks also moved to 'decide_logging_format()' function.
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r--sql/sql_lex.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index c5886b3c142..867997feb39 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1362,6 +1362,11 @@ public:
return get_stmt_unsafe_flags() != 0;
}
+ inline bool is_stmt_unsafe(enum_binlog_stmt_unsafe unsafe)
+ {
+ return binlog_stmt_flags & (1 << unsafe);
+ }
+
/**
Flag the current (top-level) statement as unsafe.
The flag will be reset after the statement has finished.