Skip to content

Commit eed319b

Browse files
committed
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
1 parent eaf6b05 commit eed319b

File tree

4 files changed

+45
-3
lines changed

4 files changed

+45
-3
lines changed

mysql-test/suite/archive/discover.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,10 @@ flush tables;
139139
create table t1 (a int) engine=archive;
140140
ERROR 42S01: Table 't1' already exists
141141
drop table t1;
142+
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
143+
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
144+
DROP TABLE t1;
145+
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
146+
SELECT * FROM t1;
147+
pk
148+
DROP TABLE t1;

mysql-test/suite/archive/discover.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,13 @@ flush tables;
132132
create table t1 (a int) engine=archive;
133133
drop table t1;
134134

135+
#
136+
# MDEV-11317: Error in deleting non existing .frm for tables with disocvery
137+
#
138+
139+
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
140+
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
141+
DROP TABLE t1;
142+
CREATE OR REPLACE TABLE t1 ( pk INT AUTO_INCREMENT PRIMARY KEY ) ENGINE = ARCHIVE;
143+
SELECT * FROM t1;
144+
DROP TABLE t1;

mysql-test/valgrind.supp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,23 @@
353353
Memcheck:Leak
354354
fun:memalign
355355
...
356-
fun:call_init
356+
fun:call_init*
357+
fun:_dl_init
358+
}
359+
360+
# This one is on OpenSuse 10.3 with gcc 5.4
361+
{
362+
memory "loss" from _dl_init 2
363+
Memcheck:Leak
364+
fun:malloc
365+
fun:pool
366+
...
367+
fun:call_init*
357368
fun:_dl_init
358369
}
359370

371+
372+
360373
#
361374
# dlclose can allocate memory for error message, the memory will be
362375
# freed by dlerror or other dl* function.

sql/sql_table.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,7 +2497,19 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
24972497
int frm_delete_error, trigger_drop_error= 0;
24982498
/* Delete the table definition file */
24992499
strmov(end,reg_ext);
2500-
frm_delete_error= mysql_file_delete(key_file_frm, path, MYF(MY_WME));
2500+
if (table_type && table_type != view_pseudo_hton &&
2501+
table_type->discover_table)
2502+
{
2503+
/*
2504+
Table type is using discovery and may not need a .frm file.
2505+
Delete it silently if it exists
2506+
*/
2507+
(void) mysql_file_delete(key_file_frm, path, MYF(0));
2508+
frm_delete_error= 0;
2509+
}
2510+
else
2511+
frm_delete_error= mysql_file_delete(key_file_frm, path,
2512+
MYF(MY_WME));
25012513
if (frm_delete_error)
25022514
frm_delete_error= my_errno;
25032515
else
@@ -2513,7 +2525,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
25132525
else if (frm_delete_error && if_exists)
25142526
thd->clear_error();
25152527
}
2516-
non_tmp_error= error ? TRUE : non_tmp_error;
2528+
non_tmp_error|= MY_TEST(error);
25172529
}
25182530
if (error)
25192531
{

0 commit comments

Comments
 (0)