MDEV-11317: ! is_set()' or !is_set() || (m_status == DA_OK_BULK && is_bulk_op())' fails in Diagnostics_area::set_ok_status on CREATE OR REPLACE with ARCHIVE table

Problem was with deleting non existing .frm file for a storage engine that
doesn't have .frm files (yet)

Fixed by not giving an error for non existing .frm files for storage engines
that are using discovery
Fixed also valgrind supression related to the given test case
This commit is contained in:
Monty 2017-01-08 17:51:36 +02:00
parent eaf6b053b8
commit eed319b6fb
4 changed files with 45 additions and 3 deletions

View file

@ -139,3 +139,10 @@ flush tables;
create table t1 (a int) engine=archive;
ERROR 42S01: Table 't1' already exists
drop table t1;
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
SELECT * FROM t1;
pk
DROP TABLE t1;

View file

@ -132,3 +132,13 @@ flush tables;
create table t1 (a int) engine=archive;
drop table t1;
#
# MDEV-11317: Error in deleting non existing .frm for tables with disocvery
#
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
SELECT * FROM t1;
DROP TABLE t1;

View file

@ -353,10 +353,23 @@
Memcheck:Leak
fun:memalign
...
fun:call_init
fun:call_init*
fun:_dl_init
}
# This one is on OpenSuse 10.3 with gcc 5.4
{
memory "loss" from _dl_init 2
Memcheck:Leak
fun:malloc
fun:pool
...
fun:call_init*
fun:_dl_init
}
#
# dlclose can allocate memory for error message, the memory will be
# freed by dlerror or other dl* function.

View file

@ -2497,7 +2497,19 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
int frm_delete_error, trigger_drop_error= 0;
/* Delete the table definition file */
strmov(end,reg_ext);
frm_delete_error= mysql_file_delete(key_file_frm, path, MYF(MY_WME));
if (table_type && table_type != view_pseudo_hton &&
table_type->discover_table)
{
/*
Table type is using discovery and may not need a .frm file.
Delete it silently if it exists
*/
(void) mysql_file_delete(key_file_frm, path, MYF(0));
frm_delete_error= 0;
}
else
frm_delete_error= mysql_file_delete(key_file_frm, path,
MYF(MY_WME));
if (frm_delete_error)
frm_delete_error= my_errno;
else
@ -2513,7 +2525,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
else if (frm_delete_error && if_exists)
thd->clear_error();
}
non_tmp_error= error ? TRUE : non_tmp_error;
non_tmp_error|= MY_TEST(error);
}
if (error)
{