-
Notifications
You must be signed in to change notification settings - Fork 12
MySQL 8 - ERROR 1071 (42000) in file: 'create_db_tables.sql': Specified key was too long; max key length is 1000 bytes #16
Comments
We also need to consider the following use case:
In this case, the user should be able to update the schema without receiving errors. |
Hi @bourtemb, edit: I've just tried the following, and it is working fine on ubuntu:xenial:
|
Yes, we can.
Good to know that there is no problem in this case. Could you please try the same as you did with the latest MySQL server version (8.x) instead of latest MariaDB latest stable version? |
I've tried the same with
Note that my database is empty (i.e. there are no devices/servers/etc.) |
I've also looked a bit into the key size issue. Key size limit is 1000 bytes for MyISAM tables in both MySQL [1] (see Column Prefix) and MariaDB [2]. In a few tables index is created for a CREATE TABLE IF NOT EXISTS property_hist (
id bigint unsigned NOT NULL default '0',
date timestamp NOT NULL,
object varchar(255) NOT NULL default '',
name varchar(255) NOT NULL default '',
count int(11) NOT NULL default '0',
value text,
KEY index_id (id),
KEY index_object (object),
KEY index_name (name)
) ENGINE=MyISAM; In
Proposed workaround was to use We have at least two other options:
So in the example table above we will have: KEY index_id (id),
KEY index_object (object(100)),
KEY index_name (name(100))
) ENGINE=MyISAM; I suggest to go with the last option (index on prefix) but I don't know how long the index should be (probably there will be impact on performance / memory consumption). Why is the issue only visible on MySQL and not on MariaDB?
MariaDB truncates index by default (
Whereas MySQL throws an error:
|
Just checked mysql 5.7 from ubuntu:xenial repos. It uses latin1 (with 1-byte characters) by default:
|
Yeah. It looks like they changed all the character set default values to utf8mb4 in MySQL 8.0.1. There is a workaround explained in MySQL 8.0.1 changes web page:
|
Shall we then update |
Good question... In the future, I think it would be interesting to support different character sets in Tango (in the DB, in the tools) for the people using Tango in some countries using characters not included in latin1 characters set. |
Ok! I'll do some tests and send a PR tomorrow. Still, I think it would be good to document this somewhere, as some people may not use config file distributed with Tango. |
Thanks
I agree. This should be documented in the install section of the doc (README/INSTALL file?). |
Btw why do you prefer to change charset globally for all databases instead of setting it only for |
I just reported in the comment what MySQL was suggesting as workaround to get easily the same behaviour as before. It was not really a preference. |
MySQL 8.0.16 does not recognize following options:
MariaDB 10.3.15 does not like:
Were there any reports of this? If no, then it looks like no one is using that file anyway. Also, there are some more differences in default charset between MySQL and MariaDB.
If we still want to provide my.cnf then I think we should reduce it to a bare minimum (i.e. just keep options that are mandatory for Tango to work) and then let users to unclude it in their config files. Users could then configure their database as they see fit (or keep the defaults). |
There have been many changes in recent MySQL versions so one will have to look at all these options and understand whether we really need them or not. Maybe @taurel can help us and tell us on what options he remembers are critical for a Tango Database? |
default_table_type have been replaced with default-storage-engine option so we could already replace that. |
I've tried to check what happened to those options:
We would need to address these at least:
|
Does that mean we will drop support for older MySQL / MariaDB versions? Which versions will be supported? |
I think default is probably fine.
I am not sure... We need to see whether we need this feature, whether it has been replaced by something else...
I agree with you. It looks like we don't need this option. What we need to know/understand is: are there any options which are really essential for a Tango Database to run smoothly?
We don't really drop support... The user is free to use this file or not... And if a user has already a Tango database running on a very old MySQL version, then he already configured his database for his version of MySQL so he will not use this file coming from the distribution again. |
After talking with @taurel, it seems like we don't really need this file anymore. If we remove it, we will need to update configure.ac and cppserver/database/Makefile.am in the TangoSourceDistribution so it is no longer taken into account. |
So, do you propose to remove the file and simply update documentation that we recommend to use:
Or do we keep the file but remove everything except charset configuration? |
I'm in favour of removing the file and updating the documentation. |
I second that. I'll make a PR for TangoDatabase and for TangoSourceDistribution. We can then wait a bit for the others to share their opinions. |
As specified in the README, the current recommended work-around for this issue is to configure MySQL 8 to use a character set with character <= 3 bytes. [mysqld] I'm closing this issue. If someone has a better solution, please do not hesitate to re-open and comment. |
* Update cpptango to release 9.3.3 * Update assets/README... ... to show changes between 9.2.5a and 9.3.3 * Update assets/TANGO_CHANGES for 9.3.3 Minimal text explanation in this version. * Update TangoAccessControl to Release 2.14 * Update to latest available release versions Update AtkPanel to Release 5.8 Update JSSHTerminal to Release 1.13 Update tango_admin to Release 1.14 * Fix missing separator error in common_target.opt Fix the following error (a tab was missing): common_target.opt:166: *** missing separator. * Update build.xml Use copy ant task instead of deprecated copydir task * Cleanup POGO (#20) Remove obsolete POGO templates Remove pogo-6 * Update astor to release 7.2.5 * rename atkpanel to ATKPanel in java applications (fixes #25) (#27) * Pass correct arguments to TangoRestServer (fixes #24) (#26) * Remove zmq.hpp (#23) (#28) * Add logback configuration file (#21) (#29) * Merge liblog4tango into libtango (change to convenience lib) (#30) (#31) Change log4tango into a libtool convenience library. liblog4tango.so is no longer generated, but log4tango objects are still compiled and are now linked into libtango.so * Update README * Remove my.cnf config file (tango-controls/TangoDatabase#16) (#35) * Remove log4tango from tango.pc & makefiles; add dummy liblog4tango.so (#33) * Add CMake opt files (#34) (#36) Add cmake_common_target.opt and cmake_tango.opt to the distribution in order to be able to generate CMakeLists.txt files for Device Servers from Pogo. * Compile with -std=c++0x when using g++ < 6.1 * Update to latest available release versions (#37) Update to latest available release versions Update Jive to Release 7.22 Update ATK to Release 9.3.6 Update Pogo to Release 9.6.23 Update rest-server to Release 1.14 Update TangoDatabase to Release 5.11 Update JTango to 9.5.14
A problem has been reported on the forum when using MySQL community 8.
https://www.tango-controls.org/community/forum/c/general/installation/tango-9-windows-demo-installation-problem/?page=1#post-3999
It looks like a workaround can be to edit create_db.sql.in and to replace the following line
CREATE DATABASE tango;
with
CREATE DATABASE tango DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
Workaround found on https://stackoverflow.com/questions/20014106/how-to-create-this-table-1071-specified-key-was-too-long-max-key-length-is/42497309
Deeper investigations are needed to see if this workaround is the right approach and if it works with MariaDB and older MySQL versions.
The text was updated successfully, but these errors were encountered: