summaryrefslogtreecommitdiff
path: root/storage/maria
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-09-04 23:19:07 +0200
committerSergei Golubchik <serg@mariadb.org>2018-09-22 00:22:09 +0200
commit3d65d0db1611f3aea3e1bcde22949351f3b89661 (patch)
treeed24c843c558bdb906306bac6b19221500c55c7d /storage/maria
parentfc70f21e0a874a535cd640695a60ecc76fb9aef2 (diff)
downloadmariadb-git-3d65d0db1611f3aea3e1bcde22949351f3b89661.tar.gz
MDEV-9137 MariaDB Crash on Query Using Aria Engine
Two bugs in Aria, related to 2-level fulltext indexes: * REPAIR calculated the key number incorrectly * CHECK copied the key into last_key too early and checking the second-level btree was overwriting it
Diffstat (limited to 'storage/maria')
-rw-r--r--storage/maria/ma_check.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 198df72a1d6..d6379dc4d91 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -891,8 +891,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if (level > param->max_level)
param->max_level=level;
- if (_ma_get_keynr(share, anc_page->buff) !=
- (uint) (keyinfo - share->keyinfo))
+ if (_ma_get_keynr(share, anc_page->buff) != keyinfo->key_nr)
_ma_check_print_error(param, "Page at %s is not marked for index %u",
llstr(anc_page->pos, llbuff),
(uint) (keyinfo - share->keyinfo));
@@ -916,7 +915,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
info->last_key.keyinfo= tmp_key.keyinfo= keyinfo;
info->lastinx= ~0; /* Safety */
tmp_key.data= tmp_key_buff;
- for ( ;; )
+ for ( ;; _ma_copy_key(&info->last_key, &tmp_key))
{
if (nod_flag)
{
@@ -998,7 +997,6 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
tmp_key.data);
}
}
- _ma_copy_key(&info->last_key, &tmp_key);
(*key_checksum)+= maria_byte_checksum(tmp_key.data, tmp_key.data_length);
record= _ma_row_pos_from_key(&tmp_key);
@@ -5728,8 +5726,7 @@ static int sort_insert_key(MARIA_SORT_PARAM *sort_param,
a_length= share->keypage_header + nod_flag;
key_block->end_pos= anc_buff + share->keypage_header;
bzero(anc_buff, share->keypage_header);
- _ma_store_keynr(share, anc_buff, (uint) (sort_param->keyinfo -
- share->keyinfo));
+ _ma_store_keynr(share, anc_buff, sort_param->keyinfo->key_nr);
lastkey=0; /* No previous key in block */
}
else