diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-03-11 09:26:42 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-03-11 09:26:42 +0200 |
commit | 22d2df8c6bd00c5f232b959197da95c9eba3120e (patch) | |
tree | 18be5bfcde0f706233e8a1da8226ce5fc54cb8b4 /sql/sql_class.cc | |
parent | 77c184df7c056da7364e606ac977cc2d3cd826ad (diff) | |
parent | 1766a18e06a056155031dabefb88ce7f201ad921 (diff) | |
download | mariadb-git-22d2df8c6bd00c5f232b959197da95c9eba3120e.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 7ed58555be1..4b557fbbafc 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -5927,6 +5927,10 @@ int THD::decide_logging_format(TABLE_LIST *tables) bool is_write= FALSE; // If any write tables bool has_read_tables= FALSE; // If any read only tables bool has_auto_increment_write_tables= FALSE; // Write with auto-increment + /* true if it's necessary to switch current statement log format from + STATEMENT to ROW if binary log format is MIXED and autoincrement values + are changed in the statement */ + bool has_unsafe_stmt_autoinc_lock_mode= false; /* If a write table that doesn't have auto increment part first */ bool has_write_table_auto_increment_not_first_in_pk= FALSE; bool has_auto_increment_write_tables_not_first= FALSE; @@ -6048,6 +6052,8 @@ int THD::decide_logging_format(TABLE_LIST *tables) has_auto_increment_write_tables_not_first= found_first_not_own_table; if (share->next_number_keypart != 0) has_write_table_auto_increment_not_first_in_pk= true; + has_unsafe_stmt_autoinc_lock_mode= + table->file->autoinc_lock_mode_stmt_unsafe(); } } @@ -6058,7 +6064,8 @@ int THD::decide_logging_format(TABLE_LIST *tables) table->file->ht) multi_write_engine= TRUE; if (share->non_determinstic_insert && - !(sql_command_flags[lex->sql_command] & CF_SCHEMA_CHANGE)) + (sql_command_flags[lex->sql_command] & CF_CAN_GENERATE_ROW_EVENTS + && !(sql_command_flags[lex->sql_command] & CF_SCHEMA_CHANGE))) has_write_tables_with_unsafe_statements= true; trans= table->file->has_transactions(); @@ -6115,6 +6122,9 @@ int THD::decide_logging_format(TABLE_LIST *tables) if (has_write_tables_with_unsafe_statements) lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); + if (has_unsafe_stmt_autoinc_lock_mode) + lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_AUTOINC_LOCK_MODE); + /* A query that modifies autoinc column in sub-statement can make the master and slave inconsistent. |