From 571df6618a1c0c0f3063667e87b91aeb11dbe3bf Mon Sep 17 00:00:00 2001 From: qichang Date: Wed, 12 Mar 2025 20:21:03 +0800 Subject: [PATCH] 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