Skip to content

Commit eb7b1df

Browse files
Log meta data event before rows query event
Summary: Log meta data event before logging the rows query event for a statement Reviewed By: yashtc Differential Revision: D5593957 fbshipit-source-id: 13c1167
1 parent 8b97349 commit eb7b1df

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sql/binlog.cc

+7-2
Original file line numberDiff line numberDiff line change
@@ -8438,16 +8438,21 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
84388438
binlog_cache_data *cache_data=
84398439
cache_mngr->get_binlog_cache_data(is_transactional);
84408440

8441-
if (binlog_rows_query && this->query())
8441+
bool write_rows_query= binlog_rows_query && this->query();
8442+
if (write_rows_query)
84428443
{
84438444
/* Write the Rows_query_log_event into binlog before the table map */
84448445
Rows_query_log_event
84458446
rows_query_ev(this, this->query(), this->query_length());
8446-
if ((error= cache_data->write_event(this, &rows_query_ev)))
8447+
if ((error= cache_data->write_event(this, &rows_query_ev,
8448+
opt_binlog_trx_meta_data)))
84478449
DBUG_RETURN(error);
84488450
}
84498451

84508452
if ((error= cache_data->write_event(this, &the_event,
8453+
// write meta data only if not written
8454+
// before rows query event
8455+
!write_rows_query &&
84518456
opt_binlog_trx_meta_data)))
84528457
DBUG_RETURN(error);
84538458

0 commit comments

Comments
 (0)