Skip to content

Commit

Permalink
MDEV-25047: SIGSEGV in mach_read_from_n_little_endian
Browse files Browse the repository at this point in the history
Virtual column fields are not found in prebuilt data type, so we should
match InnoDB fields with `get_innobase_type_from_mysql_type` method.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
  • Loading branch information
mkaruza authored and Jan Lindström committed Apr 1, 2021
1 parent 453bac0 commit f93e087
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
19 changes: 19 additions & 0 deletions mysql-test/suite/galera/r/galera_virtual_blob.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE t (f INT GENERATED ALWAYS AS (a+b)VIRTUAL,a INT,b INT,h BLOB);
INSERT INTO t (a,b)VALUES(0,0), (0,0), (0,0), (0,0), (0,0);
SELECT * from t;
f a b h
0 0 0 NULL
0 0 0 NULL
0 0 0 NULL
0 0 0 NULL
0 0 0 NULL
connection node_2;
SELECT * from t;
f a b h
0 0 0 NULL
0 0 0 NULL
0 0 0 NULL
0 0 0 NULL
0 0 0 NULL
connection node_1;
DROP TABLE t;
10 changes: 10 additions & 0 deletions mysql-test/suite/galera/t/galera_virtual_blob.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--source include/galera_cluster.inc

CREATE TABLE t (f INT GENERATED ALWAYS AS (a+b)VIRTUAL,a INT,b INT,h BLOB);
INSERT INTO t (a,b)VALUES(0,0), (0,0), (0,0), (0,0), (0,0);
SELECT * from t;

--connection node_2
SELECT * from t;
--connection node_1
DROP TABLE t;
5 changes: 4 additions & 1 deletion storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8874,6 +8874,8 @@ wsrep_calc_row_hash(
for (uint i = 0; i < table->s->fields; i++) {
byte null_byte=0;
byte true_byte=1;
ulint col_type;
ulint is_unsigned;

const Field* field = table->field[i];
if (!field->stored_in_db()) {
Expand All @@ -8882,8 +8884,9 @@ wsrep_calc_row_hash(

ptr = (const byte*) row + get_field_offset(table, field);
len = field->pack_length();
col_type = get_innobase_type_from_mysql_type(&is_unsigned, field);

switch (prebuilt->table->cols[i].mtype) {
switch (col_type) {

case DATA_BLOB:
ptr = row_mysql_read_blob_ref(&len, ptr, len);
Expand Down

0 comments on commit f93e087

Please sign in to comment.