Commit 8713ccb9 authored by Luis Soares's avatar Luis Soares

BUG#51251: Wrong binlogging in case of TRUNCATE <temporary InnoDB table>

Incremental commit based on previous patch.
Addresses reviewer comments to move reseting of 
thd->current_stmt_binlog_row_based to after binlog_query
takes place.
parent 48d65a64
...@@ -148,12 +148,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -148,12 +148,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
query_type= THD::STMT_QUERY_TYPE; query_type= THD::STMT_QUERY_TYPE;
error= -1; // ok error= -1; // ok
deleted= maybe_deleted; deleted= maybe_deleted;
save_binlog_row_based= thd->current_stmt_binlog_row_based;
goto cleanup; goto cleanup;
} }
if (error != HA_ERR_WRONG_COMMAND) if (error != HA_ERR_WRONG_COMMAND)
{ {
table->file->print_error(error,MYF(0)); table->file->print_error(error,MYF(0));
error=0; error=0;
save_binlog_row_based= thd->current_stmt_binlog_row_based;
goto cleanup; goto cleanup;
} }
/* Handler didn't support fast delete; Delete rows one by one */ /* Handler didn't support fast delete; Delete rows one by one */
...@@ -348,7 +350,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -348,7 +350,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
else else
table->file->unlock_row(); // Row failed selection, release lock on it table->file->unlock_row(); // Row failed selection, release lock on it
} }
thd->current_stmt_binlog_row_based= save_binlog_row_based;
killed_status= thd->killed; killed_status= thd->killed;
if (killed_status != THD::NOT_KILLED || thd->is_error()) if (killed_status != THD::NOT_KILLED || thd->is_error())
error= 1; // Aborted error= 1; // Aborted
...@@ -434,6 +435,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -434,6 +435,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (thd->transaction.stmt.modified_non_trans_table) if (thd->transaction.stmt.modified_non_trans_table)
thd->transaction.all.modified_non_trans_table= TRUE; thd->transaction.all.modified_non_trans_table= TRUE;
} }
thd->current_stmt_binlog_row_based= save_binlog_row_based;
DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table); DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table);
free_underlaid_joins(thd, select_lex); free_underlaid_joins(thd, select_lex);
if (error < 0 || if (error < 0 ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment