Commit 6b63e4ad authored by Thirunarayanan Balathandayuthapani's avatar Thirunarayanan Balathandayuthapani Committed by Marko Mäkelä

Bug #23219499 CONCURRENT UPDATE DOESN'T APPLY IN VIRTUAL INDEX DURING TABLE REBUILD

Problem:
=======
Concurrent update dml statement doesn't reflect in virtual index during
inplace table rebuild. It results mismatch value in virutal index and
clustered index. Deleting the table content tries to search the mismatch
value in virtual index but it can't find the value. During log update
apply phase, virtual information is being ignored while constructing
the new entry.

Solution:
=========
In row_log_update_apply phase, build the entry with virtual column
information. So that it can reflect in newly constructed virtual index.

Reviewed-by: Jimmy Yang<jimmy.yang@oracle.com>
RB: 14974
parent 698e37d6
......@@ -6455,15 +6455,6 @@ ha_innobase::inplace_alter_table(
ctx->add_autoinc, ctx->sequence, ctx->skip_pk_sort,
ctx->m_stage, add_v, eval_table);
if (s_templ) {
ut_ad(ctx->need_rebuild() || ctx->num_to_add_vcol > 0
|| rebuild_templ);
dict_free_vc_templ(s_templ);
UT_DELETE(s_templ);
ctx->new_table->vc_templ = old_templ;
}
#ifndef DBUG_OFF
oom:
#endif /* !DBUG_OFF */
......@@ -6479,6 +6470,15 @@ ha_innobase::inplace_alter_table(
onlineddl_rowlog_pct_used = 0;
onlineddl_pct_progress = 0;
if (s_templ) {
ut_ad(ctx->need_rebuild() || ctx->num_to_add_vcol > 0
|| rebuild_templ);
dict_free_vc_templ(s_templ);
UT_DELETE(s_templ);
ctx->new_table->vc_templ = old_templ;
}
DEBUG_SYNC_C("inplace_after_index_build");
DBUG_EXECUTE_IF("create_index_fail",
......@@ -7732,11 +7732,31 @@ commit_try_rebuild(
if (ctx->online) {
DEBUG_SYNC_C("row_log_table_apply2_before");
dict_vcol_templ_t* s_templ = NULL;
if (ctx->new_table->n_v_cols > 0) {
s_templ = UT_NEW_NOKEY(
dict_vcol_templ_t());
s_templ->vtempl = NULL;
innobase_build_v_templ(
altered_table, ctx->new_table, s_templ,
NULL, true);
ctx->new_table->vc_templ = s_templ;
}
error = row_log_table_apply(
ctx->thr, user_table, altered_table,
static_cast<ha_innobase_inplace_ctx*>(
ha_alter_info->handler_ctx)->m_stage);
if (s_templ) {
ut_ad(ctx->need_rebuild());
dict_free_vc_templ(s_templ);
UT_DELETE(s_templ);
ctx->new_table->vc_templ = NULL;
}
ulint err_key = thr_get_trx(ctx->thr)->error_key_num;
switch (error) {
......
......@@ -2195,8 +2195,9 @@ row_log_table_apply_update(
goto func_exit_committed;
}
dtuple_t* entry = row_build_index_entry(
row, NULL, index, heap);
/** It allows to create tuple with virtual column information. */
dtuple_t* entry = row_build_index_entry_low(
row, NULL, index, heap, ROW_BUILD_FOR_INSERT);
upd_t* update = row_upd_build_difference_binary(
index, entry, btr_pcur_get_rec(&pcur), cur_offsets,
false, NULL, heap, dup->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