1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Manual merge and some fixes.

mysql-test/include/varchar.inc:
  Manual merge between 5.1 and maria.
  
  Added a comment.
mysql-test/r/maria.result:
  Temporary fix.
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Manual merge.
mysql-test/suite/binlog/t/binlog_unsafe.test:
  Manual merge.
sql/handler.h:
  Manual merge + fix.
sql/item.h:
  Manual merge + fix.
sql/log.cc:
  Manual merge + fix.
sql/sql_insert.cc:
  Manual merge + fix. A commit was done when using
  create table ... select from for transactional tables
  other than maria, when an error occurred and
  transaction should have been aborted.
This commit is contained in:
unknown
2008-05-14 09:50:16 +03:00
parent 663f971b8d
commit e771ee75e7
8 changed files with 34 additions and 19 deletions

View File

@@ -3533,15 +3533,17 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
engines to do logging of insertions (optimization). We don't do it for
temporary tables (yet) as re-enabling causes an undesirable commit.
*/
if (((thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) == 0) &&
ha_enable_transaction(thd, FALSE))
DBUG_RETURN(-1);
if (!(table= create_table_from_items(thd, create_info, create_table,
alter_info, &values,
&extra_lock, hook_ptr)))
DBUG_RETURN(-1); // abort() deletes table
if (((thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) == 0) &&
!create_info->table_existed &&
ha_enable_transaction(thd, FALSE))
DBUG_RETURN(-1);
if (extra_lock)
{
DBUG_ASSERT(m_plock == NULL);
@@ -3682,7 +3684,8 @@ bool select_create::send_eof()
abort();
else
{
if ((thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) == 0)
if ((thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) == 0 &&
!create_info->table_existed)
ha_enable_transaction(thd, TRUE);
/*
Do an implicit commit at end of statement for non-temporary
@@ -3712,9 +3715,6 @@ void select_create::abort()
{
DBUG_ENTER("select_create::abort");
if ((thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) == 0)
ha_enable_transaction(thd, TRUE);
/*
In select_insert::abort() we roll back the statement, including
truncating the transaction cache of the binary log. To do this, we
@@ -3731,11 +3731,13 @@ void select_create::abort()
log state.
*/
tmp_disable_binlog(thd);
if ((thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) == 0 &&
!create_info->table_existed)
ha_enable_transaction(thd, TRUE);
select_insert::abort();
thd->transaction.stmt.modified_non_trans_table= FALSE;
reenable_binlog(thd);
if (m_plock)
{
mysql_unlock_tables(thd, *m_plock);