mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merge of 5.1-main into 5.1-maria. Myisam->Maria change propagation will follow.
There were so many changes into mtr (this is the new mtr coming) that I rather copied mtr from 6.0-main here (at least this one knows how to run Maria tests). I also fixed suite/maria tests to be accepted by the new mtr. mysys/thr_mutex.c: adding DBUG_PRINT here, so that we can locate where the warning is issued.
This commit is contained in:
@ -950,6 +950,26 @@ bool multi_delete::send_eof()
|
||||
TRUNCATE TABLE
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
Row-by-row truncation if the engine does not support table recreation.
|
||||
Probably a InnoDB table.
|
||||
*/
|
||||
|
||||
static bool mysql_truncate_by_delete(THD *thd, TABLE_LIST *table_list)
|
||||
{
|
||||
bool error, save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
DBUG_ENTER("mysql_truncate_by_delete");
|
||||
table_list->lock_type= TL_WRITE;
|
||||
mysql_init_select(thd->lex);
|
||||
thd->clear_current_stmt_binlog_row_based();
|
||||
error= mysql_delete(thd, table_list, NULL, NULL, HA_POS_ERROR, LL(0), TRUE);
|
||||
ha_autocommit_or_rollback(thd, error);
|
||||
end_trans(thd, error ? ROLLBACK : COMMIT);
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Optimize delete of all rows by doing a full generate of the table
|
||||
This will work even if the .ISM and .ISD tables are destroyed
|
||||
@ -992,6 +1012,9 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
|
||||
share->db.str,
|
||||
share->table_name.str, 1))))
|
||||
(void) rm_temporary_table(table_type, path);
|
||||
else
|
||||
thd->thread_specific_used= TRUE;
|
||||
|
||||
free_table_share(share);
|
||||
my_free((char*) table,MYF(0));
|
||||
/*
|
||||
@ -1060,27 +1083,6 @@ end:
|
||||
DBUG_RETURN(error);
|
||||
|
||||
trunc_by_del:
|
||||
/* Probably InnoDB table */
|
||||
ulonglong save_options= thd->options;
|
||||
bool save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
|
||||
table_list->lock_type= TL_WRITE;
|
||||
thd->options&= ~(OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
|
||||
ha_enable_transaction(thd, FALSE);
|
||||
mysql_init_select(thd->lex);
|
||||
thd->clear_current_stmt_binlog_row_based();
|
||||
|
||||
/* Delete all rows from table */
|
||||
error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
|
||||
HA_POS_ERROR, LL(0), TRUE);
|
||||
ha_enable_transaction(thd, TRUE);
|
||||
/*
|
||||
Safety, in case the engine ignored ha_enable_transaction(FALSE)
|
||||
above. Also clears thd->transaction.*.
|
||||
*/
|
||||
error= ha_autocommit_or_rollback(thd, error);
|
||||
ha_commit(thd);
|
||||
thd->options= save_options;
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
error= mysql_truncate_by_delete(thd, table_list);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
Reference in New Issue
Block a user