Skip to content

Commit

Permalink
MDEV-11317: ! is_set()' or !is_set() || (m_status == DA_OK_BULK && …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
montywi committed Jan 8, 2017
1 parent eaf6b05 commit eed319b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
7 changes: 7 additions & 0 deletions mysql-test/suite/archive/discover.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
10 changes: 10 additions & 0 deletions mysql-test/suite/archive/discover.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
15 changes: 14 additions & 1 deletion mysql-test/valgrind.supp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 14 additions & 2 deletions sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
{
Expand Down

0 comments on commit eed319b

Please sign in to comment.