1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Optimization (useful at least for the Maria engine): we disable

logging of insertions made by CREATE SELECT.


sql/sql_insert.cc:
  If error during the CREATE SELECT we drop the table, so no need for
  engines to do logging of the insertions (optimization). Engines
  require that disabling is done before locking and re-enabling is done
  before unlocking; as table creation and locking is done as one
  function (create_table_from_items()) we disable before calling
  this function and re-enable before unlocking, in send_eof() (called
  if success) and abort() (called if error).
  Question for reviewer: would it be better to do the disabling between
  creation and locking, so inside create_table_from_items(), given
  that this function is used only by CREATE SELECT?
This commit is contained in:
unknown
2007-09-24 10:24:51 +02:00
parent cfc49fdcb6
commit e57cccc65c

View File

@ -3458,6 +3458,13 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
thd->binlog_start_trans_and_stmt();
}
/*
If error during the CREATE SELECT we drop the table, so no need for
engines to do logging of insertions (optimization).
*/
if (ha_enable_transaction(thd, FALSE))
DBUG_RETURN(-1);
if (!(table= create_table_from_items(thd, create_info, create_table,
alter_info, &values,
&thd->extra_lock, hook_ptr)))
@ -3602,6 +3609,7 @@ bool select_create::send_eof()
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
ha_enable_transaction(thd, TRUE);
if (thd->extra_lock)
{
mysql_unlock_tables(thd, thd->extra_lock);
@ -3640,6 +3648,8 @@ void select_create::abort()
if (thd->current_stmt_binlog_row_based)
ha_rollback_stmt(thd);
ha_enable_transaction(thd, TRUE);
if (thd->extra_lock)
{
mysql_unlock_tables(thd, thd->extra_lock);