Blackhole : Specified key was too long; max key length is 1000 bytes

Bug #1733049 reported by Nickolay Ihalainen
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Fix Released
High
Vlad Lesin
5.6
Fix Released
High
Vlad Lesin
5.7
Fix Released
High
Vlad Lesin

Bug Description

With innodb_large_prefix=1 blackhole storage engine is incompatible with innodb table definitions,
thus adding new indexes breaking slave.

mysqltest: At line 3: query 'ALTER TABLE t ADD KEY (c)' failed: 1071: Specified key was too long; max key length is 1000 bytes

ihanick@dev percona-server]$ git diff
diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h
index df10e7d..e265ccf 100644
--- a/storage/blackhole/ha_blackhole.h
+++ b/storage/blackhole/ha_blackhole.h
@@ -66,7 +66,7 @@ public:
   /* The following defines can be increased if necessary */
 #define BLACKHOLE_MAX_KEY 64 /* Max allowed keys */
 #define BLACKHOLE_MAX_KEY_SEG 16 /* Max segments for key */
-#define BLACKHOLE_MAX_KEY_LENGTH 1000
+#define BLACKHOLE_MAX_KEY_LENGTH 10000
   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; }
[ihanick@dev percona-server]$ cat mysql-test/t/blackhole_max_key_len.test
--source include/have_blackhole.inc
CREATE TABLE t(c varchar(255)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ENGINE=blackhole;
ALTER TABLE t ADD KEY (c);
DROP TABLE t;[ihanick@dev percona-server]$ cat mysql-test/r/blackhole_max_key_len.result
CREATE TABLE t(c varchar(255)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ENGINE=blackhole;
ALTER TABLE t ADD KEY (c);
DROP TABLE t;
ihanick@dev percona-server]$ cat mysql-test/r/blackhole_max_key_len.result
CREATE TABLE t(c varchar(255)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ENGINE=blackhole;
ALTER TABLE t ADD KEY (c);
DROP TABLE t;

tags: added: low-hanging-fruit
tags: added: upstream
tags: added: contribution
Revision history for this message
Vlad Lesin (vlad-lesin) wrote :

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 implemented for blackhole now.

https://github.com/vlad-lesin/percona-server/tree/blackhole-max-key-length-5.5-gca
https://github.com/vlad-lesin/percona-server/tree/blackhole-max-key-length-5.6-gca
https://github.com/vlad-lesin/percona-server/tree/blackhole-max-key-length-5.7-gca

no longer affects: percona-server/8.0
Revision history for this message
Vlad Lesin (vlad-lesin) wrote :
Revision history for this message
Vlad Lesin (vlad-lesin) wrote :

As http://bugs.mysql.com/bug.php?id=53588 was not opened at the moment of contribution, the new bug report is created https://bugs.mysql.com/bug.php?id=89265 co contribute.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1126

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.