summaryrefslogtreecommitdiff
path: root/storage/heap/hp_create.c
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-10-27 20:46:18 +0200
committerSergei Golubchik <serg@mariadb.org>2018-10-27 20:46:38 +0200
commit37ab7e45963627f3c1ea2dd43d5b305de37bb16f (patch)
treee07ada7fbde72c438f2a6a6c162e050caf1950f9 /storage/heap/hp_create.c
parent30c3d6db328d73f1b30be537aceb55d37936fdb9 (diff)
parent893ebb739e24637985892da1555f2e6f1a8ac5b6 (diff)
downloadmariadb-git-37ab7e45963627f3c1ea2dd43d5b305de37bb16f.tar.gz
Merge branch '5.5' into 10.0
Diffstat (limited to 'storage/heap/hp_create.c')
-rw-r--r--storage/heap/hp_create.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c
index 29c031c466c..21d266f78e5 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;
/*