Commit 30e23524 authored by unknown's avatar unknown

Bug#15923 (Test ps_7ndb cause master crash):

  Always logging statements of the form "DELETE FROM x" statement-based.


mysql-test/r/binlog_row_mix_innodb_myisam.result:
  Result change.
mysql-test/t/disabled.def:
  Enabling test ps_7ndb
sql/sql_delete.cc:
  Always logging statements of the form "DELETE FROM x" statement-based,
  not only when delete_all_rows() actually worked.
parent a74472c8
...@@ -262,21 +262,22 @@ master-bin.000001 209 Write_rows 1 # ...@@ -262,21 +262,22 @@ master-bin.000001 209 Write_rows 1 #
master-bin.000001 243 Table_map 1 # test.t1 master-bin.000001 243 Table_map 1 # test.t1
master-bin.000001 282 Write_rows 1 # master-bin.000001 282 Write_rows 1 #
master-bin.000001 316 Xid 1 # COMMIT /* xid= */ master-bin.000001 316 Xid 1 # COMMIT /* xid= */
master-bin.000001 343 Table_map 1 # test.t1 master-bin.000001 343 Query 1 # use `test`; delete from t1
master-bin.000001 382 Delete_rows 1 # master-bin.000001 420 Xid 1 # COMMIT /* xid= */
master-bin.000001 421 Xid 1 # COMMIT /* xid= */ master-bin.000001 447 Query 1 # use `test`; delete from t2
master-bin.000001 448 Query 1 # use `test`; alter table t2 type=MyISAM master-bin.000001 524 Xid 1 # COMMIT /* xid= */
master-bin.000001 537 Table_map 1 # test.t1 master-bin.000001 551 Query 1 # use `test`; alter table t2 type=MyISAM
master-bin.000001 576 Write_rows 1 # master-bin.000001 640 Table_map 1 # test.t1
master-bin.000001 610 Xid 1 # COMMIT /* xid= */ master-bin.000001 679 Write_rows 1 #
master-bin.000001 637 Table_map 1 # test.t2 master-bin.000001 713 Xid 1 # COMMIT /* xid= */
master-bin.000001 676 Write_rows 1 # master-bin.000001 740 Table_map 1 # test.t2
master-bin.000001 710 Query 1 # use `test`; drop table t1,t2 master-bin.000001 779 Write_rows 1 #
master-bin.000001 789 Query 1 # use `test`; create table t0 (n int) master-bin.000001 813 Query 1 # use `test`; drop table t1,t2
master-bin.000001 875 Table_map 1 # test.t0 master-bin.000001 892 Query 1 # use `test`; create table t0 (n int)
master-bin.000001 914 Write_rows 1 # master-bin.000001 978 Table_map 1 # test.t0
master-bin.000001 948 Table_map 1 # test.t0 master-bin.000001 1017 Write_rows 1 #
master-bin.000001 987 Write_rows 1 # master-bin.000001 1051 Table_map 1 # test.t0
master-bin.000001 1021 Query 1 # use `test`; create table t2 (n int) engine=innodb master-bin.000001 1090 Write_rows 1 #
master-bin.000001 1124 Query 1 # use `test`; create table t2 (n int) engine=innodb
do release_lock("lock1"); do release_lock("lock1");
drop table t0,t2; drop table t0,t2;
...@@ -23,5 +23,5 @@ innodb_concurrent : Results are not deterministic, Elliot will fix (BUG#3300) ...@@ -23,5 +23,5 @@ innodb_concurrent : Results are not deterministic, Elliot will fix (BUG#3300)
subselect : Bug#15706 subselect : Bug#15706
type_time : Bug#15805 type_time : Bug#15805
#rpl000002 : Bug#15920 Temporary tables are not binlogged in SBR #rpl000002 : Bug#15920 Temporary tables are not binlogged in SBR
ps_7ndb : Bug#15923 Core dump in RBR mode when executing test suite #ps_7ndb : Bug#15923 Core dump in RBR mode when executing test suite
sp_trans : Bug#15924 Code dump in RBR mode when executing test suite sp_trans : Bug#15924 Code dump in RBR mode when executing test suite
...@@ -40,7 +40,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -40,7 +40,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
ha_rows deleted; ha_rows deleted;
uint usable_index= MAX_KEY; uint usable_index= MAX_KEY;
SELECT_LEX *select_lex= &thd->lex->select_lex; SELECT_LEX *select_lex= &thd->lex->select_lex;
bool ha_delete_row_bypassed= 0; bool ha_delete_all_rows= 0;
DBUG_ENTER("mysql_delete"); DBUG_ENTER("mysql_delete");
if (open_and_lock_tables(thd, table_list)) if (open_and_lock_tables(thd, table_list))
...@@ -79,17 +79,16 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -79,17 +79,16 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
!(table->triggers && table->triggers->has_delete_triggers())) !(table->triggers && table->triggers->has_delete_triggers()))
{ {
ha_rows const maybe_deleted= table->file->records; ha_rows const maybe_deleted= table->file->records;
ha_delete_all_rows= 1;
if (!(error=table->file->delete_all_rows())) if (!(error=table->file->delete_all_rows()))
{ {
error= -1; // ok error= -1; // ok
deleted= maybe_deleted; deleted= maybe_deleted;
ha_delete_row_bypassed= 1;
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));
ha_delete_row_bypassed= 1;
error=0; error=0;
goto cleanup; goto cleanup;
} }
...@@ -200,6 +199,16 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -200,6 +199,16 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
init_ftfuncs(thd, select_lex, 1); init_ftfuncs(thd, select_lex, 1);
thd->proc_info="updating"; thd->proc_info="updating";
will_batch= !table->file->start_bulk_delete(); will_batch= !table->file->start_bulk_delete();
/*
Save the thread options before clearing the OPTION_BIN_LOG,
effectively disabling the binary log (unless it was already
disabled, of course).
*/
ulonglong const saved_options= thd->options;
if (ha_delete_all_rows)
thd->options&= ~static_cast<ulonglong>(OPTION_BIN_LOG);
while (!(error=info.read_record(&info)) && !thd->killed && while (!(error=info.read_record(&info)) && !thd->killed &&
!thd->net.report_error) !thd->net.report_error)
{ {
...@@ -290,6 +299,13 @@ cleanup: ...@@ -290,6 +299,13 @@ cleanup:
delete select; delete select;
transactional_table= table->file->has_transactions(); transactional_table= table->file->has_transactions();
/*
Restore the saved value of the OPTION_BIN_LOG bit in the thread
options before executing binlog_query() below.
*/
thd->options|= (saved_options & OPTION_BIN_LOG);
/* See similar binlogging code in sql_update.cc, for comments */ /* See similar binlogging code in sql_update.cc, for comments */
if ((error < 0) || (deleted && !transactional_table)) if ((error < 0) || (deleted && !transactional_table))
{ {
...@@ -304,7 +320,7 @@ cleanup: ...@@ -304,7 +320,7 @@ cleanup:
delete specific rows which we might log row-based. delete specific rows which we might log row-based.
*/ */
THD::enum_binlog_query_type const THD::enum_binlog_query_type const
query_type(ha_delete_row_bypassed ? query_type(ha_delete_all_rows ?
THD::STMT_QUERY_TYPE : THD::STMT_QUERY_TYPE :
THD::ROW_QUERY_TYPE); THD::ROW_QUERY_TYPE);
int log_result= thd->binlog_query(query_type, int log_result= thd->binlog_query(query_type,
......
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