Commit e1ba1632 authored by unknown's avatar unknown
Browse files

bug#8151 - truncate leaves a transaction open

deadlock in MYSQL_LOG::new_file()
style fixes


mysql-test/r/innodb.result:
  one more test for truncate
mysql-test/t/innodb.test:
  one more test for truncate
sql/ha_innodb.cc:
  bug#8151 - truncate leaves a transaction open
sql/handler.cc:
  bug#8151 - truncate leaves a transaction open
sql/item.h:
  style fix
sql/item_cmpfunc.cc:
  style fix
sql/item_cmpfunc.h:
  style fix
sql/item_func.cc:
  style fix
sql/item_func.h:
  style fix
sql/log.cc:
  let new_file() to lock LOCK_index,
  don't check for prepared_xids in rotate_and_purge()
  increase thread_safe_increment when LOCK_log is taken
sql/log_event.cc:
  mysqlbinlog now prints a warning if binlog was not closed properly
sql/sql_class.h:
  comments
sql/sql_repl.cc:
  DBUG_ENTER tag corrected
parent 6ed8bf96
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -906,6 +906,7 @@ truncate table t1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
commit;
truncate table t1;
truncate table t1;
select * from t1;
a
insert into t1 values(1),(2);
@@ -924,6 +925,7 @@ a
1
2
truncate table t1;
truncate table t1;
insert into t1 values(1),(2);
delete from t1;
select * from t1;
@@ -1637,14 +1639,14 @@ t2 CREATE TABLE `t2` (
drop table t2, t1;
show status like "binlog_cache_use";
Variable_name	Value
Binlog_cache_use	152
Binlog_cache_use	154
show status like "binlog_cache_disk_use";
Variable_name	Value
Binlog_cache_disk_use	0
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name	Value
Binlog_cache_use	153
Binlog_cache_use	155
show status like "binlog_cache_disk_use";
Variable_name	Value
Binlog_cache_disk_use	1
@@ -1653,7 +1655,7 @@ delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name	Value
Binlog_cache_use	154
Binlog_cache_use	156
show status like "binlog_cache_disk_use";
Variable_name	Value
Binlog_cache_disk_use	1
+2 −0
Original line number Diff line number Diff line
@@ -591,6 +591,7 @@ insert into t1 values(1),(2);
truncate table t1;
commit;
truncate table t1;
truncate table t1;
select * from t1;
insert into t1 values(1),(2);
delete from t1;
@@ -605,6 +606,7 @@ truncate table t1;
insert into t1 values(1),(2);
select * from t1;
truncate table t1;
truncate table t1;
insert into t1 values(1),(2);
delete from t1;
select * from t1;
+0 −2
Original line number Diff line number Diff line
@@ -4256,8 +4256,6 @@ ha_innobase::delete_all_rows(void)
		goto fallback;
	}

	innobase_commit(thd, 1);

	error = convert_error_code_to_mysql(error, NULL);

	DBUG_RETURN(error);
+15 −2
Original line number Diff line number Diff line
@@ -1606,7 +1606,12 @@ int handler::rename_table(const char * from, const char * to)
}

/*
  Tell the handler to turn on or off transaction in the handler
  Tell the storage engine that it is allowed to "disable transaction" in the
  handler. It is a hint that ACID is not required - it is used in NDB for
  ALTER TABLE, for example, when data are copied to temporary table.
  A storage engine may treat this hint any way it likes. NDB for example
  starts to commit every now and then automatically.
  This hint can be safely ignored.
*/

int ha_enable_transaction(THD *thd, bool on)
@@ -1616,7 +1621,15 @@ int ha_enable_transaction(THD *thd, bool on)
  DBUG_ENTER("ha_enable_transaction");
  thd->transaction.on= on;
  if (on)
    ha_commit(thd);
  {
    /*
      Now all storage engines should have transaction handling enabled.
      But some may have it enabled all the time - "disabling" transactions
      is an optimization hint that storage engine is free to ignore.
      So, let's commit an open transaction (if any) now.
    */
    error= end_trans(thd, COMMIT);
  }
  DBUG_RETURN(error);
}

+5 −6
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ class DTCollation {
typedef bool (Item::*Item_processor)(byte *arg);
typedef Item* (Item::*Item_transformer) (byte *arg);

typedef void (*Item_cond_traverser) (const Item *item, void *arg);
typedef void (*Cond_traverser) (const Item *item, void *arg);

class Item {
  Item(const Item &);			/* Prevent use of these */
@@ -398,9 +398,8 @@ class Item {
    return (this->*transformer)(arg);
  }

   virtual void traverse_cond(Item_cond_traverser traverser, 
			      void *arg,
			      traverse_order order = POSTFIX)
   virtual void traverse_cond(Cond_traverser traverser,
                              void *arg, traverse_order order)
   {
     (*traverser)(this, arg);
   }
Loading