diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-10-25 17:06:18 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-10-25 17:08:36 +0300 |
commit | 31366c6c93ef6b3fb182c0984e03bd9b2d2a8d5e (patch) | |
tree | 1afb5155a4c68a9141488d6949d8bf1003fa92f8 /storage/innobase | |
parent | e548d92b23a6b9582dec37c26461ddceec4589ca (diff) | |
download | mariadb-git-31366c6c93ef6b3fb182c0984e03bd9b2d2a8d5e.tar.gz |
MDEV-17548 Incorrect access to off-page column for indexed virtual column
row_build_index_entry_low(): ext does not contain virtual columns.
row_upd_store_v_row(): Copy virtual column values
This is based on the following fix in MySQL 5.7.24:
commit 4ec2158bec73f1582501c4b3e3de250fed9edc9a
Author: Sachin Agarwal <sachin.z.agarwal@oracle.com>
Date: Fri Aug 24 14:44:13 2018 +0530
Bug #27968952 INNODB CRASH/CORRUPTION WITH TEXT PREFIX INDEXES
Problem:
There are two problems:
1. If there is one secondary index on extenally
stored column and another seconday index on virtual column (whose
base column is not externally stored). then while updating seconday
index on vitrual column, virtual column data is replaced by
externally stoared column.
2. In row update operation, node->row contains
shallow copy of virtual data fields. While building an update vector
containing all the fields to be modified, compute virtual column.
which may causes change in virtual data fields in node->row.
In both the above cases, while updating seconday index on virtual
column, couldn't find the row and hit an explicite assert inside
ROW_NOT_FOUND.
Fix:
1. Added check if column is virtual then its ext flag should be ZERO
and virtual column data will not be replaced by offset column data.
2. Deep copy of virtual data fields for node->row.
RB: #20382
Reviewed by : Jimmy.Yang@oracle.com
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/row/row0row.cc | 4 | ||||
-rw-r--r-- | storage/innobase/row/row0upd.cc | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc index ad4991fb4e9..4c88130334e 100644 --- a/storage/innobase/row/row0row.cc +++ b/storage/innobase/row/row0row.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -295,7 +295,7 @@ row_build_index_entry_low( stored off-page. */ ut_ad(col->ord_part); - if (ext) { + if (ext && !col->is_virtual()) { /* See if the column is stored externally. */ const byte* buf = row_ext_lookup(ext, col_no, &len); diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 171e06894ca..28658428e98 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -2157,6 +2157,7 @@ row_upd_store_v_row( } dfield_copy_data(dfield, upd_field->old_v_val); + dfield_dup(dfield, node->heap); break; } @@ -2177,6 +2178,7 @@ row_upd_store_v_row( update->old_vrow, col_no); dfield_copy_data(dfield, vfield); + dfield_dup(dfield, node->heap); } } else { /* Need to compute, this happens when |