Skip to content

Commit

Permalink
Log meta data event before rows query event
Browse files Browse the repository at this point in the history
Summary: Log meta data event before logging the rows query event for a statement

Reviewed By: yashtc

Differential Revision: D5593957

fbshipit-source-id: 13c1167
  • Loading branch information
abhinav04sharma authored and facebook-github-bot committed Aug 9, 2017
1 parent 8b97349 commit eb7b1df
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sql/binlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8438,16 +8438,21 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
binlog_cache_data *cache_data=
cache_mngr->get_binlog_cache_data(is_transactional);

if (binlog_rows_query && this->query())
bool write_rows_query= binlog_rows_query && this->query();
if (write_rows_query)
{
/* Write the Rows_query_log_event into binlog before the table map */
Rows_query_log_event
rows_query_ev(this, this->query(), this->query_length());
if ((error= cache_data->write_event(this, &rows_query_ev)))
if ((error= cache_data->write_event(this, &rows_query_ev,
opt_binlog_trx_meta_data)))
DBUG_RETURN(error);
}

if ((error= cache_data->write_event(this, &the_event,
// write meta data only if not written
// before rows query event
!write_rows_query &&
opt_binlog_trx_meta_data)))
DBUG_RETURN(error);

Expand Down

0 comments on commit eb7b1df

Please sign in to comment.