diff options
author | mkaruza <mario.karuza@galeracluster.com> | 2021-03-31 11:29:51 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-04-01 07:35:00 +0300 |
commit | f93e087d745a0c24e30aa144c0f9d34fa042e21b (patch) | |
tree | aa438a6b64ad4b3dd12b4ee90d20b7496b862b11 | |
parent | 453bac08c265046f2aba4589c5a7f2f8287cb352 (diff) | |
download | mariadb-git-f93e087d745a0c24e30aa144c0f9d34fa042e21b.tar.gz |
MDEV-25047: SIGSEGV in mach_read_from_n_little_endianbb-10.2-MDEV-25047
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>
-rw-r--r-- | mysql-test/suite/galera/r/galera_virtual_blob.result | 19 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_virtual_blob.test | 10 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 5 |
3 files changed, 33 insertions, 1 deletions
diff --git a/mysql-test/suite/galera/r/galera_virtual_blob.result b/mysql-test/suite/galera/r/galera_virtual_blob.result new file mode 100644 index 00000000000..91952b1d52d --- /dev/null +++ b/mysql-test/suite/galera/r/galera_virtual_blob.result @@ -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; diff --git a/mysql-test/suite/galera/t/galera_virtual_blob.test b/mysql-test/suite/galera/t/galera_virtual_blob.test new file mode 100644 index 00000000000..a10e3025668 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_virtual_blob.test @@ -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; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 445103e0550..fc876e6f753 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -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()) { @@ -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); |