Skip to content

Commit aa8a31d

Browse files
Aditya Adr-m
authored andcommitted
Bug #22990029 GCOLS: INCORRECT BEHAVIOR AFTER DATA INSERTED WITH IGNORE KEYWORD
PROBLEM ------- 1. We are inserting a base column entry which causes an invalid value by the function provided to generate virtual column,but we go ahead and insert this due to ignore keyword. 2. We then delete this record, making this record delete marked in innodb. If we try to insert another record with the same pk as the deleted record and if the rec is not purged ,then we try to undelete mark this record and try to build a update vector with previous and updated value and while calculating the value of virtual column we get error from server that we cannot calculate this from base column. Innodb assumes that innobase_get_computed_value() Should always return a valid value for the base column present in the row. The failure of this call was not handled ,so we were crashing. FIX
1 parent e32305e commit aa8a31d

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

storage/innobase/include/row0upd.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2018, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
@@ -219,6 +219,7 @@ the equal ordering fields. NOTE: we compare the fields as binary strings!
219219
@param[in] heap memory heap from which allocated
220220
@param[in,out] mysql_table NULL, or mysql table object when
221221
user thread invokes dml
222+
@param[out] error error number in case of failure
222223
@return own: update vector of differing fields, excluding roll ptr and
223224
trx id */
224225
upd_t*
@@ -230,8 +231,9 @@ row_upd_build_difference_binary(
230231
bool no_sys,
231232
trx_t* trx,
232233
mem_heap_t* heap,
233-
TABLE* mysql_table)
234-
MY_ATTRIBUTE((nonnull(1,2,3,7), warn_unused_result));
234+
TABLE* mysql_table,
235+
dberr_t* error)
236+
MY_ATTRIBUTE((nonnull(1,2,3,7,9), warn_unused_result));
235237
/***********************************************************//**
236238
Replaces the new column values stored in the update vector to the index entry
237239
given. */

storage/innobase/row/row0ins.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ row_ins_clust_index_entry_by_modify(
326326
{
327327
const rec_t* rec;
328328
upd_t* update;
329-
dberr_t err;
329+
dberr_t err = DB_SUCCESS;
330330
btr_cur_t* cursor = btr_pcur_get_btr_cur(pcur);
331331
TABLE* mysql_table = NULL;
332332
ut_ad(dict_index_is_clust(cursor->index));
@@ -349,7 +349,11 @@ row_ins_clust_index_entry_by_modify(
349349

350350
update = row_upd_build_difference_binary(
351351
cursor->index, entry, rec, NULL, true,
352-
thr_get_trx(thr), heap, mysql_table);
352+
thr_get_trx(thr), heap, mysql_table, &err);
353+
if (err != DB_SUCCESS) {
354+
return(err);
355+
}
356+
353357
if (mode != BTR_MODIFY_TREE) {
354358
ut_ad((mode & ~BTR_ALREADY_S_LATCHED) == BTR_MODIFY_LEAF);
355359

storage/innobase/row/row0log.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,10 @@ row_log_table_apply_update(
20422042
row, NULL, index, heap, ROW_BUILD_NORMAL);
20432043
upd_t* update = row_upd_build_difference_binary(
20442044
index, entry, btr_pcur_get_rec(&pcur), cur_offsets,
2045-
false, NULL, heap, dup->table);
2045+
false, NULL, heap, dup->table, &error);
2046+
if (error != DB_SUCCESS) {
2047+
goto func_exit;
2048+
}
20462049

20472050
if (!update->n_fields) {
20482051
/* Nothing to do. */

storage/innobase/row/row0upd.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,8 +1036,9 @@ the equal ordering fields. NOTE: we compare the fields as binary strings!
10361036
@param[in] heap memory heap from which allocated
10371037
@param[in] mysql_table NULL, or mysql table object when
10381038
user thread invokes dml
1039+
@param[out] error error number in case of failure
10391040
@return own: update vector of differing fields, excluding roll ptr and
1040-
trx id */
1041+
trx id,if error is not equal to DB_SUCCESS, return NULL */
10411042
upd_t*
10421043
row_upd_build_difference_binary(
10431044
dict_index_t* index,
@@ -1047,7 +1048,8 @@ row_upd_build_difference_binary(
10471048
bool no_sys,
10481049
trx_t* trx,
10491050
mem_heap_t* heap,
1050-
TABLE* mysql_table)
1051+
TABLE* mysql_table,
1052+
dberr_t* error)
10511053
{
10521054
upd_field_t* upd_field;
10531055
dfield_t* dfield;
@@ -1159,6 +1161,10 @@ row_upd_build_difference_binary(
11591161
update->old_vrow, col, index,
11601162
&v_heap, heap, NULL, thd, mysql_table, record,
11611163
NULL, NULL, NULL);
1164+
if (vfield == NULL) {
1165+
*error = DB_COMPUTE_VALUE_FAILED;
1166+
return(NULL);
1167+
}
11621168

11631169
if (!dfield_data_is_binary_equal(
11641170
dfield, vfield->len,

0 commit comments

Comments
 (0)