Skip to content
/ server Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions mysql-test/suite/atomic/frm.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# MDEV-37795 - MariaDB start up spits DDL_LOG: Got error 1033
#
connect ddl1, localhost, root;
CREATE TABLE t1(v VECTOR(5) NOT NULL, VECTOR INDEX(v));
SET debug_sync='writefile_after_create_before_write SIGNAL ready1 WAIT_FOR ever';
ALTER TABLE t1 ADD COLUMN b INT, ALGORITHM=COPY;
connect ddl2, localhost, root;
SET debug_sync='writefile_after_create_before_write SIGNAL ready2 WAIT_FOR ever';
CREATE TABLE t2(v VECTOR(5) NOT NULL, VECTOR INDEX(v));
connection default;
SET debug_sync='now WAIT_FOR ready1';
SET debug_sync='now WAIT_FOR ready2';
# restart
DROP TABLE t1;
DROP TABLE t2;
ERROR 42S02: Unknown table 'test.t2'
SET debug_sync='RESET';
disconnect ddl1;
disconnect ddl2;
db.opt
28 changes: 28 additions & 0 deletions mysql-test/suite/atomic/frm.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
source include/have_debug_sync.inc;

--echo #
--echo # MDEV-37795 - MariaDB start up spits DDL_LOG: Got error 1033
--echo #
connect(ddl1, localhost, root);
CREATE TABLE t1(v VECTOR(5) NOT NULL, VECTOR INDEX(v));
SET debug_sync='writefile_after_create_before_write SIGNAL ready1 WAIT_FOR ever';
send ALTER TABLE t1 ADD COLUMN b INT, ALGORITHM=COPY;

connect(ddl2, localhost, root);
SET debug_sync='writefile_after_create_before_write SIGNAL ready2 WAIT_FOR ever';
send CREATE TABLE t2(v VECTOR(5) NOT NULL, VECTOR INDEX(v));

connection default;
SET debug_sync='now WAIT_FOR ready1';
SET debug_sync='now WAIT_FOR ready2';
let $shutdown_timeout=0;
source include/restart_mysqld.inc;

DROP TABLE t1;
error ER_BAD_TABLE_ERROR;
DROP TABLE t2;
SET debug_sync='RESET';
disconnect ddl1;
disconnect ddl2;
let $datadir=`select @@datadir`;
list_files $datadir/test;
13 changes: 11 additions & 2 deletions sql/ddl_log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -919,9 +919,11 @@ class ddl_log_error_handler : public Internal_error_handler
int unhandled_errors;
int first_error;
bool only_ignore_non_existing_errors;
bool ignore_corrupt_frm_error;

ddl_log_error_handler() : handled_errors(0), unhandled_errors(0),
first_error(0), only_ignore_non_existing_errors(0)
first_error(0), only_ignore_non_existing_errors(0),
ignore_corrupt_frm_error(false)
{}

bool handle_condition(THD *,
Expand All @@ -935,7 +937,8 @@ class ddl_log_error_handler : public Internal_error_handler
if (non_existing_table_error(sql_errno) ||
(!only_ignore_non_existing_errors &&
(sql_errno == EE_LINK ||
sql_errno == EE_DELETE || sql_errno == ER_TRG_NO_DEFINER)))
sql_errno == EE_DELETE || sql_errno == ER_TRG_NO_DEFINER)) ||
(ignore_corrupt_frm_error && sql_errno == ER_NOT_FORM_FILE))
{
handled_errors++;
return TRUE;
Expand Down Expand Up @@ -1799,7 +1802,11 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
if (ddl_log_entry->flags == 0)
{
if (hton)
{
no_such_table_handler.ignore_corrupt_frm_error= true;
error= execute_drop_table(thd, hton, &db, &table, path.str);
no_such_table_handler.ignore_corrupt_frm_error= false;
}
else
error= ha_delete_table_force(thd, path.str, &db, &table);
}
Expand Down Expand Up @@ -2273,9 +2280,11 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
*/
if (likely(hton))
{
no_such_table_handler.ignore_corrupt_frm_error= true;
error= execute_drop_table(thd, hton, &ddl_log_entry->from_db,
&ddl_log_entry->from_name,
ddl_log_entry->tmp_name.str);
no_such_table_handler.ignore_corrupt_frm_error= false;
}
(void) update_phase(entry_pos, DDL_ALTER_TABLE_PHASE_INIT);
}
Expand Down
1 change: 1 addition & 0 deletions sql/discover.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ int writefile(const char *path, const char *db, const char *table,
}
else
{
DEBUG_SYNC(current_thd, "writefile_after_create_before_write");
error= (int)mysql_file_write(file, data, len, MYF(MY_WME | MY_NABP));

if (!error && !tmp_table && opt_sync_frm)
Expand Down