This function writes a table map to the binary log. Note that in order to keep the signature uniform with related methods, we use a redundant parameter to indicate whether a transactional table was changed or not. Sometimes it will write a Rows_query_log_event into binary log before the table map too. @param table a pointer to the table. @param is_transactional @c tru
| 7977 | or the Rows_query log event. |
| 7978 | */ |
| 7979 | int THD::binlog_write_table_map(TABLE *table, bool is_transactional, |
| 7980 | bool binlog_rows_query) |
| 7981 | { |
| 7982 | int error; |
| 7983 | DBUG_ENTER("THD::binlog_write_table_map"); |
| 7984 | DBUG_PRINT("enter", ("table: 0x%lx (%s: #%llu)", |
| 7985 | (long) table, table->s->table_name.str, |
| 7986 | table->s->table_map_id.id())); |
| 7987 | |
| 7988 | /* Pre-conditions */ |
| 7989 | DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open()); |
| 7990 | DBUG_ASSERT(table->s->table_map_id.is_valid()); |
| 7991 | |
| 7992 | Table_map_log_event |
| 7993 | the_event(this, table, table->s->table_map_id, is_transactional); |
| 7994 | |
| 7995 | binlog_start_trans_and_stmt(this, &the_event); |
| 7996 | |
| 7997 | binlog_cache_mngr *const cache_mngr= thd_get_cache_mngr(this); |
| 7998 | |
| 7999 | binlog_cache_data *cache_data= |
| 8000 | cache_mngr->get_binlog_cache_data(is_transactional); |
| 8001 | |
| 8002 | if (binlog_rows_query && this->query()) |
| 8003 | { |
| 8004 | /* Write the Rows_query_log_event into binlog before the table map */ |
| 8005 | Rows_query_log_event |
| 8006 | rows_query_ev(this, this->query(), this->query_length()); |
| 8007 | if ((error= cache_data->write_event(this, &rows_query_ev))) |
| 8008 | DBUG_RETURN(error); |
| 8009 | } |
| 8010 | |
| 8011 | if ((error= cache_data->write_event(this, &the_event))) |
| 8012 | DBUG_RETURN(error); |
| 8013 | |
| 8014 | binlog_table_maps++; |
| 8015 | DBUG_RETURN(0); |
| 8016 | } |
| 8017 | |
| 8018 | /** |
| 8019 | This function retrieves a pending row event from a cache which is |
nothing calls this directly
no test coverage detected