summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2017-11-30 00:41:43 +0300
committerDaniel Black <daniel@mariadb.org>2020-10-24 16:20:09 +1100
commit4fa6638031d968c955f224bf1d71ea1e80648ecf (patch)
tree1653c31b29d20fc1d7d84b7d54a42ca75c352dc6
parent94b493571a8ba8f30c97a5c30fc641171ca48e8a (diff)
downloadmariadb-git-bb-10.1-danielblack-MDEV-24017-blackhole-index-size.tar.gz
MDEV-24017: Blackhole : Specified key was too long; max key length is 1000 bytesbb-10.1-danielblack-MDEV-24017-blackhole-index-size
The maximum innodb key length is 3500 what is hardcoded in ha_innobase::max_supported_key_length()). The maximum number of innodb indexes is configured with MAX_INDEXES macro (see also MAX_KEY definition). The same is currently implemented for blackhole storage engine. Cherry picked from percona-server 0d90d81c3c507a6b1476246a405504f6e4ef9d4d Original lp bug 1733049 Reviewed-by: daniel@mariadb.org
-rw-r--r--mysql-test/r/blackhole.result6
-rw-r--r--mysql-test/t/blackhole.test16
-rw-r--r--storage/blackhole/ha_blackhole.h5
3 files changed, 25 insertions, 2 deletions
diff --git a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result
index 36f5459ff85..a7281c42ca7 100644
--- a/mysql-test/r/blackhole.result
+++ b/mysql-test/r/blackhole.result
@@ -24,3 +24,9 @@ SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
0
DROP TABLE t1;
End of 5.6 tests
+CREATE TABLE `t` (
+`a` varchar(3000) NOT NULL default '',
+PRIMARY KEY (`a`)
+) ENGINE=BLACKHOLE;
+DROP TABLE `t`;
+End of 10.1 tests
diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test
index 7f394e0f846..c80ceffef4c 100644
--- a/mysql-test/t/blackhole.test
+++ b/mysql-test/t/blackhole.test
@@ -38,3 +38,19 @@ SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
DROP TABLE t1;
--echo End of 5.6 tests
+
+#
+# MDEV-24017 / bug 53588 test case.
+#
+# Create long enough index (between 1000 and 3500). 1000 is the old value,
+# 3500 is innodb value (see ha_innobase::max_supported_key_length()). Without
+# the fix the test will fail with "Specified key was too long" error.
+#
+CREATE TABLE `t` (
+ `a` varchar(3000) NOT NULL default '',
+ PRIMARY KEY (`a`)
+) ENGINE=BLACKHOLE;
+
+DROP TABLE `t`;
+
+--echo End of 10.1 tests
diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h
index e34386ddf33..07275b8eec1 100644
--- a/storage/blackhole/ha_blackhole.h
+++ b/storage/blackhole/ha_blackhole.h
@@ -20,6 +20,7 @@
#include "thr_lock.h" /* THR_LOCK */
#include "handler.h" /* handler */
#include "table.h" /* TABLE_SHARE */
+#include "sql_const.h" /* MAX_KEY */
/*
Shared structure for correct LOCK operation
@@ -65,9 +66,9 @@ public:
HA_READ_ORDER | HA_KEYREAD_ONLY);
}
/* The following defines can be increased if necessary */
-#define BLACKHOLE_MAX_KEY 64 /* Max allowed keys */
+#define BLACKHOLE_MAX_KEY MAX_KEY /* Max allowed keys */
#define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */
-#define BLACKHOLE_MAX_KEY_LENGTH 1000
+#define BLACKHOLE_MAX_KEY_LENGTH 3500 /* Like in InnoDB */
uint max_supported_keys() const { return BLACKHOLE_MAX_KEY; }
uint max_supported_key_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }
uint max_supported_key_part_length() const { return BLACKHOLE_MAX_KEY_LENGTH; }