diff options
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/log.cc b/sql/log.cc index 06bb073134d..850b79998a1 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -6101,9 +6101,12 @@ bool THD::binlog_write_annotated_row(Log_event_writer *writer) Also write annotate events and start transactions. This is using the "tables_with_row_logging" list prepared by THD::binlog_prepare_for_row_logging + + Atomic CREATE OR REPLACE .. SELECT logs row events via temporary table, + so it is missed in locks. We write table map for that specially via cur_table. */ -bool THD::binlog_write_table_maps() +bool THD::binlog_write_table_maps(TABLE *cur_table) { bool with_annotate; MYSQL_LOCK *locks[2], **locks_end= locks; @@ -6156,6 +6159,16 @@ bool THD::binlog_write_table_maps() } } } + if (cur_table->s->tmp_table && cur_table->file->row_logging) + { + /* + This is a temporary table created with CREATE OR REPLACE ... SELECT. + As these types of tables are not locked, we have to write the bitmap + separately. + */ + if (binlog_write_table_map(cur_table, with_annotate)) + DBUG_RETURN(1); + } binlog_table_maps= 1; // Table maps written DBUG_RETURN(0); } |