Fixed MDEV-3890: Server crash inserting record on a temporary table after truncating it
The problem was that a temporary table was re-created as a non-temporary table. mysql-test/suite/maria/truncate.result: Added test cases mysql-test/suite/maria/truncate.test: Added test cases sql/sql_truncate.cc: Mark that table to be created is a temporary table storage/maria/ha_maria.cc: Ensure that temporary tables are not transactional.
This commit is contained in:
parent
32151409c1
commit
ea1d5943c5
@ -35,3 +35,15 @@ select count(*) from t1;
|
|||||||
count(*)
|
count(*)
|
||||||
0
|
0
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
CREATE TEMPORARY TABLE t1 ( i int) ENGINE=aria;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TEMPORARY TABLE `t1` (
|
||||||
|
`i` int(11) DEFAULT NULL
|
||||||
|
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
|
||||||
|
TRUNCATE TABLE t1;
|
||||||
|
INSERT INTO t1 (i) VALUES (1);
|
||||||
|
lock table t1 write;
|
||||||
|
truncate table t1;
|
||||||
|
unlock tables;
|
||||||
|
drop table t1;
|
||||||
|
@ -45,3 +45,16 @@ select * from t1;
|
|||||||
truncate t1;
|
truncate t1;
|
||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# MDEV-3890
|
||||||
|
# Server crash inserting record on a temporary table after truncating it
|
||||||
|
#
|
||||||
|
CREATE TEMPORARY TABLE t1 ( i int) ENGINE=aria;
|
||||||
|
SHOW CREATE TABLE t1;
|
||||||
|
TRUNCATE TABLE t1;
|
||||||
|
INSERT INTO t1 (i) VALUES (1);
|
||||||
|
lock table t1 write;
|
||||||
|
truncate table t1;
|
||||||
|
unlock tables;
|
||||||
|
drop table t1;
|
||||||
|
@ -263,6 +263,7 @@ static bool recreate_temporary_table(THD *thd, TABLE *table)
|
|||||||
DBUG_ENTER("recreate_temporary_table");
|
DBUG_ENTER("recreate_temporary_table");
|
||||||
|
|
||||||
memset(&create_info, 0, sizeof(create_info));
|
memset(&create_info, 0, sizeof(create_info));
|
||||||
|
create_info.options|= HA_LEX_CREATE_TMP_TABLE;
|
||||||
|
|
||||||
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
|
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
|
||||||
|
|
||||||
|
@ -3042,7 +3042,10 @@ int ha_maria::create(const char *name, register TABLE *table_arg,
|
|||||||
ha_create_info->transactional != HA_CHOICE_NO);
|
ha_create_info->transactional != HA_CHOICE_NO);
|
||||||
|
|
||||||
if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
||||||
|
{
|
||||||
create_flags|= HA_CREATE_TMP_TABLE;
|
create_flags|= HA_CREATE_TMP_TABLE;
|
||||||
|
create_info.transactional= 0;
|
||||||
|
}
|
||||||
if (ha_create_info->options & HA_CREATE_KEEP_FILES)
|
if (ha_create_info->options & HA_CREATE_KEEP_FILES)
|
||||||
create_flags|= HA_CREATE_KEEP_FILES;
|
create_flags|= HA_CREATE_KEEP_FILES;
|
||||||
if (options & HA_OPTION_PACK_RECORD)
|
if (options & HA_OPTION_PACK_RECORD)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user