mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into mysql.com:/users/mkindahl/bk/b15923-mysql-5.1-new
This commit is contained in:
@ -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;
|
||||||
|
@ -21,6 +21,6 @@ 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
|
||||||
rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
|
rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
|
||||||
mysqlslap : Bug#16167
|
mysqlslap : Bug#16167
|
||||||
|
@ -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,20 @@ 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;
|
||||||
|
/*
|
||||||
|
If all rows shall be deleted, we always log this statement-based
|
||||||
|
(see [binlog], below), so we set this flag and test it below.
|
||||||
|
*/
|
||||||
|
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 +203,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 +303,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))
|
||||||
{
|
{
|
||||||
@ -299,14 +319,14 @@ cleanup:
|
|||||||
thd->clear_error();
|
thd->clear_error();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If 'handler::delete_all_rows()' was called, we replicate
|
[binlog]: If 'handler::delete_all_rows()' was called, we
|
||||||
statement-based; otherwise, 'ha_delete_row()' was used to
|
replicate statement-based; otherwise, 'ha_delete_row()' was
|
||||||
delete specific rows which we might log row-based.
|
used to 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,
|
||||||
thd->query, thd->query_length,
|
thd->query, thd->query_length,
|
||||||
transactional_table, FALSE);
|
transactional_table, FALSE);
|
||||||
|
Reference in New Issue
Block a user