MDEV-17215 Assertion `rw_lock_own(dict_operation_lock, RW_LOCK_S)

			|| node->vcol_info.is_used()' failed

- Purge thread can acquire mdl lock while initializing the mysql template.
Set the vcol_info information before acquiring mdl lock.

- Purge thread doesn't need to use the virtual column info even though it is
requested. In that case, reset the virtual column info.
parent 0f709912
...@@ -21458,13 +21458,12 @@ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table) ...@@ -21458,13 +21458,12 @@ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table)
} }
/** Get the computed value by supplying the base column values. /** Get the computed value by supplying the base column values.
@param[in,out] table table whose virtual column template to be built */ @param[in,out] table table whose virtual column
void template to be built */
innobase_init_vc_templ( TABLE* innobase_init_vc_templ(dict_table_t* table)
dict_table_t* table)
{ {
if (table->vc_templ != NULL) { if (table->vc_templ != NULL) {
return; return NULL;
} }
table->vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); table->vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t());
...@@ -21473,12 +21472,13 @@ innobase_init_vc_templ( ...@@ -21473,12 +21472,13 @@ innobase_init_vc_templ(
ut_ad(mysql_table); ut_ad(mysql_table);
if (!mysql_table) { if (!mysql_table) {
return; return NULL;
} }
mutex_enter(&dict_sys->mutex); mutex_enter(&dict_sys->mutex);
innobase_build_v_templ(mysql_table, table, table->vc_templ, NULL, true); innobase_build_v_templ(mysql_table, table, table->vc_templ, NULL, true);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
return mysql_table;
} }
/** Change dbname and table name in table->vc_templ. /** Change dbname and table name in table->vc_templ.
......
...@@ -915,10 +915,9 @@ innobase_get_computed_value( ...@@ -915,10 +915,9 @@ innobase_get_computed_value(
dict_foreign_t* foreign); dict_foreign_t* foreign);
/** Get the computed value by supplying the base column values. /** Get the computed value by supplying the base column values.
@param[in,out] table the table whose virtual column template to be built */ @param[in,out] table the table whose virtual column
void template to be built */
innobase_init_vc_templ( TABLE* innobase_init_vc_templ(dict_table_t* table);
dict_table_t* table);
/** Change dbname and table name in table->vc_templ. /** Change dbname and table name in table->vc_templ.
@param[in,out] table the table whose virtual column template @param[in,out] table the table whose virtual column template
......
...@@ -375,6 +375,13 @@ row_purge_poss_sec( ...@@ -375,6 +375,13 @@ row_purge_poss_sec(
ut_ad(mtr.has_committed()); ut_ad(mtr.has_committed());
/* If the virtual column info is not used then reset the virtual column
info. */
if (node->vcol_info.is_requested()
&& !node->vcol_info.is_used()) {
node->vcol_info.reset();
}
if (store_cur && !row_purge_restore_vsec_cur( if (store_cur && !row_purge_restore_vsec_cur(
node, index, sec_pcur, sec_mtr, is_tree)) { node, index, sec_pcur, sec_mtr, is_tree)) {
return false; return false;
...@@ -1017,8 +1024,10 @@ row_purge_parse_undo_rec( ...@@ -1017,8 +1024,10 @@ row_purge_parse_undo_rec(
goto try_again; goto try_again;
} }
/* Initialize the template for the table */ node->vcol_info.set_requested();
innobase_init_vc_templ(node->table); node->vcol_info.set_used();
node->vcol_info.set_table(innobase_init_vc_templ(node->table));
node->vcol_info.set_used();
} }
clust_index = dict_table_get_first_index(node->table); clust_index = dict_table_get_first_index(node->table);
......
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