From 4d8abb5c7d76cc4f4671dfdcf3a3e7139dfbaf47 Mon Sep 17 00:00:00 2001 From: qiuyang19960521 Date: Thu, 13 Mar 2025 20:09:02 +0800 Subject: [PATCH 1/2] fix(error message): inplace algorithm error description information --- storage/ctc/ha_ctc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/ctc/ha_ctc.cc b/storage/ctc/ha_ctc.cc index 396bf2c..d6241df 100644 --- a/storage/ctc/ha_ctc.cc +++ b/storage/ctc/ha_ctc.cc @@ -4005,7 +4005,7 @@ enum_alter_inplace_result ha_ctc::check_if_supported_inplace_alter( // alter table add column containing stored generated column: json_array() as default if (ha_alter_info->handler_flags & Alter_inplace_info::ADD_STORED_GENERATED_COLUMN) { - ha_alter_info->unsupported_reason = my_get_err_msg(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON); + ha_alter_info->unsupported_reason = "Cannot add stored generated column"; return HA_ALTER_INPLACE_NOT_SUPPORTED; } @@ -4045,7 +4045,7 @@ enum_alter_inplace_result ha_ctc::check_if_supported_inplace_alter( bool is_nullable = ha_alter_info->alter_info->create_list[add_column_idx]->is_nullable; // NOT NULL bool is_have_default_val = ha_alter_info->alter_info->create_list[add_column_idx]->constant_default == nullptr ? false : true; if (!is_nullable && !is_have_default_val) { - ha_alter_info->unsupported_reason = my_get_err_msg(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON); + ha_alter_info->unsupported_reason = "Field is not NULL and not having default value"; return HA_ALTER_INPLACE_NOT_SUPPORTED; } } -- Gitee From 571df6618a1c0c0f3063667e87b91aeb11dbe3bf Mon Sep 17 00:00:00 2001 From: qichang Date: Wed, 12 Mar 2025 20:21:03 +0800 Subject: [PATCH 2/2] fix virtual column update --- storage/ctc/datatype_cnvrtr.cc | 4 ++-- storage/ctc/ha_ctc.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/ctc/datatype_cnvrtr.cc b/storage/ctc/datatype_cnvrtr.cc index 13300d3..86c6b7e 100644 --- a/storage/ctc/datatype_cnvrtr.cc +++ b/storage/ctc/datatype_cnvrtr.cc @@ -835,7 +835,7 @@ void cal_gcol_cnts_for_update(Field **field, uint column_id, uint32_t *virtual_g *virtual_gcol_cnt = 0; for (uint i = 0; i < column_id; i++) { Field *mysql_field = *(field + i); - if (mysql_field->is_gcol()) { + if (mysql_field->is_virtual_gcol()) { *virtual_gcol_cnt += 1; } } @@ -1686,7 +1686,7 @@ int mysql_record_to_cantian_record(const TABLE &table, record_buf_info_t *record bool is_update = fields != nullptr; bool has_gcol = table.has_gcol(); uint n_fields = is_update ? fields->size() : table.s->fields; - // Count the number of generated columns + // Only count the number of virtual generated columns uint32 virtual_gcol_cnt = 0; if (has_gcol) { cal_gcol_cnts_for_update(table.field, n_fields, &virtual_gcol_cnt); diff --git a/storage/ctc/ha_ctc.cc b/storage/ctc/ha_ctc.cc index 8abc376..53e1b12 100644 --- a/storage/ctc/ha_ctc.cc +++ b/storage/ctc/ha_ctc.cc @@ -2874,9 +2874,9 @@ EXTER_ATTACK int ha_ctc::update_row(const uchar *old_data, uchar *new_data) { uint16_t serial_column_offset = 0; ha_statistic_increment(&System_status_var::ha_update_count); - vector upd_fields; bool update_primary_key = m_tch.change_data_capture && check_if_update_primary_key(table); + // Get the column_ids to be updated, including virtual generated/stored columns. for (uint16_t i = 0; i < table->write_set->n_bits; i++) { if (update_primary_key || bitmap_is_set(table->write_set, i)) { upd_fields.push_back(i); -- Gitee