diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2021-11-02 11:26:35 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2021-11-02 11:26:35 +0300 |
commit | 8ce5635a3eb2c744136c9f19d49297406db94d46 (patch) | |
tree | 2755eda85e542c10d32cf3c8468aa7f34efb0d64 /mysql-test/suite/maria | |
parent | d0b611a76d91a5b6dbbc8fab792d7daaaaa862f5 (diff) | |
download | mariadb-git-8ce5635a3eb2c744136c9f19d49297406db94d46.tar.gz |
MDEV-22284 Aria table key read crash because wrong index usedbb-10.2-midenok2
When restoring lastinx last_key.keyinfo must be updated as well. The
good example is in _ma_check_index().
The point of failure is extra(HA_EXTRA_NO_KEYREAD) in
ha_maria::get_auto_increment():
1. extra(HA_EXTRA_KEYREAD) saves lastinx;
2. maria_rkey() changes index, so the lastinx and last_key.keyinfo;
3. extra(HA_EXTRA_NO_KEYREAD) restores lastinx but not
last_key.keyinfo.
So we have discrepancy between lastinx and last_key.keyinfo after 3.
Diffstat (limited to 'mysql-test/suite/maria')
-rw-r--r-- | mysql-test/suite/maria/maria.result | 11 | ||||
-rw-r--r-- | mysql-test/suite/maria/maria.test | 13 |
2 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index 1e85ee8b50c..f34e7ce8e5d 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -2850,3 +2850,14 @@ insert into t1 values (8,'0'); ERROR HY000: Table 't1' was locked with a READ lock and can't be updated unlock tables; drop table t1; +# +# MDEV-22284 Aria table key read crash because wrong index used +# +create table t1 ( +a int auto_increment, +b int, c int, +key(c, a), unique(b) +) engine aria +partition by hash (b); +replace into t1 values (1, 0, 0), (2, 0, 0), (0, 0, 0); +drop table t1; diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test index 6de2c5dccbc..cd392faaeef 100644 --- a/mysql-test/suite/maria/maria.test +++ b/mysql-test/suite/maria/maria.test @@ -2093,3 +2093,16 @@ aria_page_checksum=$default_checksum, aria_log_file_size=$default_log_file_size; --enable_result_log --enable_query_log + +--echo # +--echo # MDEV-22284 Aria table key read crash because wrong index used +--echo # +create table t1 ( + a int auto_increment, + b int, c int, + key(c, a), unique(b) +) engine aria +partition by hash (b); +replace into t1 values (1, 0, 0), (2, 0, 0), (0, 0, 0); +# cleanup +drop table t1; |