Below is the list of changes that have just been committed into a local
4.1 repository of mydev. When mydev does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2391 05/08/29 17:01:46 ingo@stripped +3 -0
Bug#11816 - Truncate table doesn't work with temporary innodb tables
Handle temporary tables like permanent tables: If the storage engine
cannot truncate, delete instead.
sql/sql_delete.cc
1.135 05/08/29 17:01:42 ingo@stripped +16 -13
Bug#11816 - Truncate table doesn't work with temporary innodb tables
Handle temporary tables like permanent tables: If the storage engine
cannot truncate, delete instead.
Replaced a numeric literal by its symbolic name.
mysql-test/t/innodb.test
1.72 05/08/29 17:01:42 ingo@stripped +18 -0
Bug#11816 - Truncate table doesn't work with temporary innodb tables
The test case.
mysql-test/r/innodb.result
1.102 05/08/29 17:01:42 ingo@stripped +16 -0
Bug#11816 - Truncate table doesn't work with temporary innodb tables
The test result.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: ingo
# Host: chilla.local
# Root: /home/mydev/mysql-4.1-4100
--- 1.134/sql/sql_delete.cc 2005-04-14 21:31:16 +02:00
+++ 1.135/sql/sql_delete.cc 2005-08-29 17:01:42 +02:00
@@ -617,6 +617,8 @@
TABLE *table= *table_ptr;
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
db_type table_type=table->db_type;
+ if (!ha_supports_generate(table_type))
+ goto trunc_by_del;
strmov(path,table->path);
*table_ptr= table->next; // Unlink table from list
close_temporary(table,0);
@@ -635,7 +637,7 @@
(void) sprintf(path,"%s/%s/%s%s",mysql_data_home,table_list->db,
table_list->real_name,reg_ext);
- fn_format(path,path,"","",4);
+ fn_format(path, path, "", "", MY_UNPACK_FILENAME);
if (!dont_send_ok)
{
@@ -647,18 +649,7 @@
DBUG_RETURN(-1);
}
if (!ha_supports_generate(table_type))
- {
- /* Probably InnoDB table */
- ulong save_options= thd->options;
- table_list->lock_type= TL_WRITE;
- thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
- ha_enable_transaction(thd, FALSE);
- error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
- HA_POS_ERROR, 0);
- ha_enable_transaction(thd, TRUE);
- thd->options= save_options;
- DBUG_RETURN(error);
- }
+ goto trunc_by_del;
if (lock_and_wait_for_table_name(thd, table_list))
DBUG_RETURN(-1);
}
@@ -693,4 +684,16 @@
VOID(pthread_mutex_unlock(&LOCK_open));
}
DBUG_RETURN(error ? -1 : 0);
+
+ trunc_by_del:
+ /* Probably InnoDB table */
+ ulong save_options= thd->options;
+ table_list->lock_type= TL_WRITE;
+ thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
+ ha_enable_transaction(thd, FALSE);
+ error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
+ HA_POS_ERROR, 0);
+ ha_enable_transaction(thd, TRUE);
+ thd->options= save_options;
+ DBUG_RETURN(error);
}
--- 1.101/mysql-test/r/innodb.result 2005-06-07 11:54:25 +02:00
+++ 1.102/mysql-test/r/innodb.result 2005-08-29 17:01:42 +02:00
@@ -1658,3 +1658,19 @@
3 NULL
DROP TABLE t2;
DROP TABLE t1;
+create temporary table t1 (a int) engine=innodb;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+a
+42
+drop table t1;
+create table t1 (a int) engine=innodb;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+a
+42
+drop table t1;
--- 1.71/mysql-test/t/innodb.test 2005-07-28 02:21:43 +02:00
+++ 1.72/mysql-test/t/innodb.test 2005-08-29 17:01:42 +02:00
@@ -1202,4 +1202,22 @@
DROP TABLE t2;
DROP TABLE t1;
+#
+# Bug#11816 - Truncate table doesn't work with temporary innodb tables
+# This is not an innodb bug, but we test it using innodb.
+#
+create temporary table t1 (a int) engine=innodb;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+drop table t1;
+# Show that it works with permanent tables too.
+create table t1 (a int) engine=innodb;
+insert into t1 values (4711);
+truncate t1;
+insert into t1 values (42);
+select * from t1;
+drop table t1;
+
# End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (ingo:1.2391) BUG#11816 | ingo | 29 Aug |