diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-11-06 08:41:48 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-11-06 08:41:48 +0200 |
commit | 32062cc61cd00e4cd3b7939c8a09f9c3ac34ec76 (patch) | |
tree | 098d64b7c988bab8cca25b0f716d92f6f7e72ed9 /storage/heap | |
parent | af9649c722810eb1754953eb406a84ec876ce693 (diff) | |
parent | bae21bfb5de17328c33c3da8d191c6d3af14ae02 (diff) | |
download | mariadb-git-32062cc61cd00e4cd3b7939c8a09f9c3ac34ec76.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'storage/heap')
-rw-r--r-- | storage/heap/hp_create.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index ed669069b96..dcfff4e8e9f 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB Corporation. +/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. + Copyright (c) 2010, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -98,7 +98,14 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, /* fall through */ case HA_KEYTYPE_VARTEXT1: keyinfo->flag|= HA_VAR_LENGTH_KEY; - length+= 2; + /* + For BTREE algorithm, key length, greater than or equal + to 255, is packed on 3 bytes. + */ + if (keyinfo->algorithm == HA_KEY_ALG_BTREE) + length+= size_to_store_key_length(keyinfo->seg[j].length); + else + length+= 2; /* Save number of bytes used to store length */ keyinfo->seg[j].bit_start= 1; break; @@ -107,7 +114,14 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, /* fall_through */ case HA_KEYTYPE_VARTEXT2: keyinfo->flag|= HA_VAR_LENGTH_KEY; - length+= 2; + /* + For BTREE algorithm, key length, greater than or equal + to 255, is packed on 3 bytes. + */ + if (keyinfo->algorithm == HA_KEY_ALG_BTREE) + length+= size_to_store_key_length(keyinfo->seg[j].length); + else + length+= 2; /* Save number of bytes used to store length */ keyinfo->seg[j].bit_start= 2; /* |