Bug #308
Host table is not created in ONE 2.0beta
Status: | Closed | Start date: | 08/06/2010 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | Ruben S. Montero | % Done: | 0% | |
Category: | Core & System | |||
Target version: | - | |||
Resolution: | fixed | Pull request: | ||
Affected Versions: |
Description
Hi,
I am using an SVN checkout of ONE and test the new mysql backend. It seems that the hosts table is not created properly on my system (openSUSE 11.3, 64 Bit, MySQL 5.1.46)
This error causes the following output:
one:/var/lib/mysql # onehost list
Error: [HostPoolInfo] Error getting HOST Pool
I had grep'ed for the SQL statement that is used for creating this table and executed it by hand:
mysql> CREATE TABLE IF NOT EXISTS host_pool (oid INTEGER PRIMARY KEY,host_name VARCHAR, state INTEGER, im_mad VARCHAR,vm_mad VARCHAR,tm_mad VARCHAR, last_mon_time INTEGER, cluster VARCHAR, UNIQUE );
ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes
As you can see MySQL returned an error. Adjusting some of the varchar sizes helped to solve the issue...
mysql> CREATE TABLE IF NOT EXISTS host_pool (oid INTEGER PRIMARY KEY,host_name VARCHAR, state INTEGER, im_mad VARCHAR,vm_mad VARCHAR,tm_mad VARCHAR, last_mon_time INTEGER, cluster VARCHAR, UNIQUE );
Query OK, 0 rows affected (0.02 sec)
Maybe it has something to do with the internal representation of varchar.
Kind regards
Stefan
Related issues
Associated revisions
bug #308: Only hostnames are now unique. Adjusted column sizes.
bug #308: Updated Host tests with new table definition
History
#1 Updated by Ruben S. Montero almost 11 years ago
Hi Stefan
What distro are you using? This error is because of the limit in the key length for MySQL tables. This can be set at compilation time for MySQL libs. We did not have any problems in our testing systems. However I get this error in Arch... We'll fix the length of the key for the Host table so it fits in the 1000bytes constraint.
Thanks
Ruben
#2 Updated by Ruben S. Montero almost 11 years ago
- Status changed from New to Closed
- Resolution set to fixed
Patch in one-2.0
#3 Updated by Stefan Freitag almost 11 years ago
Hi Ruben,
I use OpenNebula in combination with openSUSE 11.3 and am also pretty sure that the key length can be set when compiling MySQL ;-) Nevertheless, most people used the mysql packages provided by their linux distributions and in my case this caused the error.
Thanks for your reply,
Stefan