Commit d2a867cd authored by Monty's avatar Monty

MDEV-32532 Assertion failure in ddl_log_increment_phase_no_lock upon ..

The reason for the bug was that spider plugin does some ALTER TABLE
commands before recovery is done, which was not expected.

Fixed by resetting the ddl_log lists in create_ddl_log()
parent 0b2fd01e
......@@ -181,6 +181,8 @@ static constexpr unsigned DDL_LOG_BACKUP_OFFSET_POS= 8;
/* Sum of the above variables */
static constexpr unsigned DDL_LOG_HEADER_SIZE= 4+2+2+1;
static void ddl_log_free_lists();
/**
Sync the ddl log file.
......@@ -734,6 +736,7 @@ static bool create_ddl_log()
char file_name[FN_REFLEN];
DBUG_ENTER("create_ddl_log");
ddl_log_free_lists();
global_ddl_log.open= 0;
global_ddl_log.created= 1;
global_ddl_log.num_entries= 0;
......@@ -2826,24 +2829,11 @@ int ddl_log_execute_recovery()
}
/**
Release all memory allocated to the ddl log and delete the ddl log
*/
void ddl_log_release()
static void ddl_log_free_lists()
{
char file_name[FN_REFLEN];
DDL_LOG_MEMORY_ENTRY *free_list;
DDL_LOG_MEMORY_ENTRY *used_list;
DBUG_ENTER("ddl_log_release");
DDL_LOG_MEMORY_ENTRY *free_list= global_ddl_log.first_free;
DDL_LOG_MEMORY_ENTRY *used_list= global_ddl_log.first_used;
if (!global_ddl_log.initialized)
DBUG_VOID_RETURN;
global_ddl_log.initialized= 0;
free_list= global_ddl_log.first_free;
used_list= global_ddl_log.first_used;
while (used_list)
{
DDL_LOG_MEMORY_ENTRY *tmp= used_list->next_log_entry;
......@@ -2856,6 +2846,25 @@ void ddl_log_release()
my_free(free_list);
free_list= tmp;
}
global_ddl_log.first_free= global_ddl_log.first_used= 0;
}
/**
Release all memory allocated to the ddl log and delete the ddl log
*/
void ddl_log_release()
{
char file_name[FN_REFLEN];
DBUG_ENTER("ddl_log_release");
if (!global_ddl_log.initialized)
DBUG_VOID_RETURN;
global_ddl_log.initialized= 0;
ddl_log_free_lists();
my_free(global_ddl_log.file_entry_buf);
global_ddl_log.file_entry_buf= 0;
close_ddl_log();
......
# restart: --plugin-load-add=ha_spider
#
# MDEV-32532 Assertion failure in ddl_log_increment_phase_no_lock upon
# partition operations with spider plugin loaded
#
CREATE TABLE t1 (a INT) PARTITION BY HASH (a) PARTITIONS 2;
ALTER TABLE t1 REBUILD PARTITION p0;
drop table t1;
#
# End of 10.10
#
uninstall plugin spider;
--source include/have_partition.inc
--let $restart_parameters= --plugin-load-add=ha_spider
--source include/restart_mysqld.inc
--echo #
--echo # MDEV-32532 Assertion failure in ddl_log_increment_phase_no_lock upon
--echo # partition operations with spider plugin loaded
--echo #
CREATE TABLE t1 (a INT) PARTITION BY HASH (a) PARTITIONS 2;
ALTER TABLE t1 REBUILD PARTITION p0;
drop table t1;
--echo #
--echo # End of 10.10
--echo #
uninstall plugin spider;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment