Skip to content

Commit 0ac1764

Browse files
author
Aditya A
committed
Bug#33327093 FK: assertion failure in row_MySQL_pad_col
Analysis -------- 1. The parent table has 3 column of datatype (i) int (PK) (ii) varchar (iii) a virtual column which is generated by varchar column. 2. The child table has a column which is referring to the primary key of the parent table. 3. There is a update in the parent table which changes the primary key and the varchar column, so it tries to build the update node to propagate to the child table. 4. While building the update node it is trying to build the update field for virtual column which is causing the crash. FIX === 1. The virtual column update should not be present in the update node, because no column in child table can have a foreign key relationship with a virtual column. 2. So skip the update to the virtual column when building the update node for child table Change-Id: Iff7d1f32c7c9d846453c587fc0c5b8604ec679ec
1 parent ebdc6a2 commit 0ac1764

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

storage/innobase/include/data0data.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1994, 2023, Oracle and/or its affiliates.
3+
Copyright (c) 1994, 2024, Oracle and/or its affiliates.
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License, version 2.0,
@@ -596,6 +596,10 @@ struct dfield_t{
596596
created.
597597
@return the cloned object. */
598598
dfield_t* clone(mem_heap_t* heap);
599+
600+
/** Checks if the field is virtual
601+
@return true if virtual else returns false. */
602+
bool is_virtual() const { return (type.is_virtual()); }
599603
};
600604

601605
/** Structure for an SQL data tuple of fields (logical record) */

storage/innobase/include/data0type.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1996, 2023, Oracle and/or its affiliates.
3+
Copyright (c) 1996, 2024, Oracle and/or its affiliates.
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License, version 2.0,
@@ -587,6 +587,8 @@ struct dtype_t{
587587
mbminlen=DATA_MBMINLEN(mbminmaxlen);
588588
mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */
589589
#endif /* !UNIV_HOTBACKUP */
590+
591+
bool is_virtual() const { return ((prtype & DATA_VIRTUAL) == DATA_VIRTUAL); }
590592
};
591593

592594
#ifndef UNIV_NONINL

storage/innobase/include/row0upd.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1996, 2023, Oracle and/or its affiliates.
3+
Copyright (c) 1996, 2024, Oracle and/or its affiliates.
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License, version 2.0,
@@ -460,6 +460,9 @@ struct upd_field_t{
460460
#endif /* !UNIV_HOTBACKUP */
461461
dfield_t new_val; /*!< new value for the column */
462462
dfield_t* old_v_val; /*!< old value for the virtual column */
463+
464+
bool is_virtual() const { return (new_val.is_virtual()); }
465+
463466
};
464467

465468

storage/innobase/row/row0ins.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1996, 2023, Oracle and/or its affiliates.
3+
Copyright (c) 1996, 2024, Oracle and/or its affiliates.
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License, version 2.0,
@@ -552,6 +552,11 @@ row_ins_cascade_calc_update_vec(
552552
const upd_field_t* parent_ufield
553553
= &parent_update->fields[j];
554554

555+
/* Skip if the updated field is virtual */
556+
if (parent_ufield->is_virtual()) {
557+
continue;
558+
}
559+
555560
if (parent_ufield->field_no == parent_field_no) {
556561

557562
ulint min_size;

0 commit comments

Comments
 (0)