summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/include/row0upd.h22
-rw-r--r--storage/innobase/row/row0mysql.cc23
-rw-r--r--storage/innobase/row/row0upd.cc16
3 files changed, 60 insertions, 1 deletions
diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h
index 677af76c561..a367ae7d3eb 100644
--- a/storage/innobase/include/row0upd.h
+++ b/storage/innobase/include/row0upd.h
@@ -429,6 +429,28 @@ struct upd_t{
fields[n_fields++] = field;
}
+ void remove_element(ulint i)
+ {
+ ut_ad(n_fields > 0);
+ ut_ad(i < n_fields);
+ while (i < n_fields - 1) {
+ fields[i] = fields[i + 1];
+ i++;
+ }
+ n_fields--;
+ }
+
+ bool remove(const ulint field_no)
+ {
+ for (ulint i = 0; i < n_fields; ++i) {
+ if (field_no == fields[i].field_no) {
+ remove_element(i);
+ return true;
+ }
+ }
+ return false;
+ }
+
/** Determine if the given field_no is modified.
@return true if modified, false otherwise. */
bool is_modified(const ulint field_no) const
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 4a273cd635e..914641aecfd 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -69,6 +69,8 @@ Created 9/17/2000 Heikki Tuuri
#include <algorithm>
#include <deque>
#include <vector>
+// FIXME: remove
+#include <table.h>
#ifdef WITH_WSREP
#include "mysql/service_wsrep.h"
@@ -1441,6 +1443,27 @@ row_insert_for_mysql(
set_tuple_col_8(node->row, table->vers_start, trx->id,
node->vers_start_buf);
}
+ dict_index_t* clust_index = dict_table_get_first_index(table);
+ THD *thd= trx->mysql_thd;
+ TABLE *mysql_table = prebuilt->m_mysql_table;
+ mem_heap_t* local_heap = NULL;
+ for (ulint col_no = 0; col_no < dict_table_get_n_v_cols(table);
+ col_no++) {
+
+ const dict_v_col_t* v_col
+ = dict_table_get_nth_v_col(table, col_no);
+ for (ulint i = 0; i < unsigned{v_col->num_base}; i++) {
+ dict_col_t* base_col = v_col->base_col[i];
+ if (base_col->ind == table->vers_end) {
+ innobase_get_computed_value(
+ node->row, v_col, clust_index, &local_heap, table->heap, NULL, thd,
+ mysql_table, mysql_table->record[0], NULL, NULL, NULL);
+ }
+ }
+ }
+ if (local_heap) {
+ mem_heap_free(local_heap);
+ }
}
savept = trx_savept_take(trx);
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index b7d396bd5cb..41372c324b4 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -3503,5 +3503,19 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
}
dfield_set_data(&ufield->new_val, update->vers_sys_value, col->len);
-}
+ for (ulint col_no = 0; col_no < dict_table_get_n_v_cols(table);
+ col_no++) {
+ const dict_v_col_t* v_col
+ = dict_table_get_nth_v_col(table, col_no);
+ for (ulint i = 0; i < unsigned{v_col->num_base}; i++) {
+ dict_col_t* base_col = v_col->base_col[i];
+ if (base_col->ind == col->ind) {
+ /* Virtual column depends on system field value which we updated above.
+ Remove it from update vector, so it is recalculated in row_upd_store_v_row() (see !update branch). */
+ update->remove(v_col->v_pos);
+ break;
+ }
+ }
+ }
+}