summaryrefslogtreecommitdiff
path: root/storage/heap
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-10-23 15:59:24 +0200
committerSergei Golubchik <serg@mariadb.org>2018-10-23 15:59:24 +0200
commitf9e5195b40b4b6678b71fdac2b99442664037d36 (patch)
tree8da99e7722c1f587c93a65fdc2a465992ec68b82 /storage/heap
parent55fc3fb08830cfe8e55b45f5f0e1acf55d00cb4b (diff)
parentbac287c315b1792e7ae33f91add6a60292f9bae8 (diff)
downloadmariadb-git-f9e5195b40b4b6678b71fdac2b99442664037d36.tar.gz
Merge branch 'mysql/5.5' into 5.5
Diffstat (limited to 'storage/heap')
-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 1daca0beeb5..9bd0132664b 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, 2014, SkySQL Ab.
+/* 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;
/*