summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2020-11-10 18:37:58 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-12-04 23:24:57 +0300
commit714f5eb33cba00093c5c28006a483480653ef214 (patch)
tree038190a28da3523032d8db1f20f2212a4a3b5a9a
parentce5c419e1473ab9f8698a432e1b8d51b6ed3f6ae (diff)
downloadmariadb-git-714f5eb33cba00093c5c28006a483480653ef214.tar.gz
DDL_TRY_LOG_ENTRY_CODE
-rw-r--r--sql/datadict.cc1
-rw-r--r--sql/sql_class.h1
-rw-r--r--sql/sql_partition.cc3
-rw-r--r--sql/sql_table.cc13
4 files changed, 13 insertions, 5 deletions
diff --git a/sql/datadict.cc b/sql/datadict.cc
index c69f7e70ebf..99fa48caca1 100644
--- a/sql/datadict.cc
+++ b/sql/datadict.cc
@@ -489,6 +489,7 @@ bool ddl_log_info::write_log_replace_delete_frm(const char *from_path,
ddl_log_entry.action_type= DDL_LOG_REPLACE_ACTION;
else
ddl_log_entry.action_type= DDL_LOG_DELETE_ACTION;
+ ddl_log_entry.entry_type= DDL_TRY_LOG_ENTRY_CODE;
ddl_log_entry.next_entry= first_entry ? first_entry->entry_pos : 0;
ddl_log_entry.handler_name= file_action;
ddl_log_entry.name= to_path;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 0aea96b9231..806ff552121 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -848,6 +848,7 @@ enum ddl_log_entry_code
*/
DDL_LOG_EXECUTE_CODE = 'e',
DDL_LOG_ENTRY_CODE = 'l',
+ DDL_TRY_LOG_ENTRY_CODE = 't',
DDL_IGNORE_LOG_ENTRY_CODE = 'i'
};
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index d8e613486d0..47b9a8c3ae7 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -6205,6 +6205,7 @@ static bool write_log_replace_delete_frm(ALTER_PARTITION_PARAM_TYPE *lpt,
ddl_log_entry.action_type= DDL_LOG_REPLACE_ACTION;
else
ddl_log_entry.action_type= DDL_LOG_DELETE_ACTION;
+ ddl_log_entry.entry_type= DDL_LOG_ENTRY_CODE;
ddl_log_entry.next_entry= next_entry;
ddl_log_entry.handler_name= reg_ext;
ddl_log_entry.name= to_path;
@@ -6245,6 +6246,7 @@ static bool write_log_changed_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
uint *next_entry, const char *path)
{
DDL_LOG_ENTRY ddl_log_entry;
+ ddl_log_entry.entry_type= DDL_LOG_ENTRY_CODE;
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
char tmp_path[FN_REFLEN + 1];
@@ -6344,6 +6346,7 @@ static bool write_log_dropped_partitions(ALTER_PARTITION_PARAM_TYPE *lpt,
bool temp_list)
{
DDL_LOG_ENTRY ddl_log_entry;
+ ddl_log_entry.entry_type= DDL_LOG_ENTRY_CODE;
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
char tmp_path[FN_REFLEN + 1];
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 51dbebd2a86..835a4c2906a 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -854,8 +854,10 @@ static uint read_ddl_log_header()
static void set_global_from_ddl_log_entry(const DDL_LOG_ENTRY *ddl_log_entry)
{
mysql_mutex_assert_owner(&LOCK_gdl);
+ DBUG_ASSERT(ddl_log_entry->entry_type == DDL_LOG_ENTRY_CODE ||
+ ddl_log_entry->entry_type == DDL_TRY_LOG_ENTRY_CODE);
global_ddl_log.file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]=
- (char)DDL_LOG_ENTRY_CODE;
+ (char) ddl_log_entry->entry_type;
global_ddl_log.file_entry_buf[DDL_LOG_ACTION_TYPE_POS]=
(char)ddl_log_entry->action_type;
global_ddl_log.file_entry_buf[DDL_LOG_PHASE_POS]= 0;
@@ -1054,7 +1056,8 @@ static bool deactivate_ddl_log_entry_no_lock(uint entry_no)
mysql_mutex_assert_owner(&LOCK_gdl);
if (!read_ddl_log_file_entry(entry_no))
{
- if (file_entry_buf[DDL_LOG_ENTRY_TYPE_POS] == DDL_LOG_ENTRY_CODE)
+ if (file_entry_buf[DDL_LOG_ENTRY_TYPE_POS] == DDL_LOG_ENTRY_CODE ||
+ file_entry_buf[DDL_LOG_ENTRY_TYPE_POS] == DDL_TRY_LOG_ENTRY_CODE)
{
/*
Log entry, if complete mark it done (IGNORE).
@@ -1390,15 +1393,15 @@ static bool execute_ddl_log_entry_no_lock(THD *thd, uint first_entry)
read_entry);
break;
}
- DBUG_ASSERT(ddl_log_entry.entry_type == DDL_LOG_ENTRY_CODE ||
- ddl_log_entry.entry_type == DDL_IGNORE_LOG_ENTRY_CODE);
+ DBUG_ASSERT(ddl_log_entry.entry_type != DDL_LOG_EXECUTE_CODE);
if (execute_ddl_log_action(thd, &ddl_log_entry))
{
/* Write to error log and continue with next log entry */
sql_print_error("Failed to execute action for entry = %u from ddl log",
read_entry);
- break;
+ if (ddl_log_entry.entry_type != DDL_TRY_LOG_ENTRY_CODE)
+ break; // TODO: do we need this break at all?
}
read_entry= ddl_log_entry.next_entry;
} while (read_entry);