在Windows上使用Sonar和MySQL 5.6进行架构设置失败

时间:2013-02-11 11:10:06

标签: mysql sonarqube

我在Windows机器上安装了Sonar 3.4.1和Mysql 5.6.10。

我创建了一个mysql架构“sonar”,并将其所有权限授予用户“sonar”。我已配置声纳来使用此用户。我按照the codehaus sonar page上的说明执行了此操作。

启动声纳时,它开始在架构中创建表。在某些时候发生错误,指出“指定密钥太长;最大密钥长度为767字节”(最后的完整错误消息)。

根据this question,索引长度在mysql中是有限的。因为记录了这一点,我希望Sonar不会创建超过限制的索引。显然它试图这样做。

我是否错过了一些重要配置,还是两个版本的声纳和mysql不兼容?我该怎么做才能让它与这些版本一起使用?

完整的错误消息:

INFO   | jvm 1    | 2013/02/11 11:28:25 | 
INFO   | jvm 1    | 2013/02/11 11:28:25 | ==  CreateProperties: migrating ===============================================
INFO   | jvm 1    | 2013/02/11 11:28:25 | -- create_table("properties")
INFO   | jvm 1    | 2013/02/11 11:28:25 |    -> 0.0320s
INFO   | jvm 1    | 2013/02/11 11:28:25 |    -> 0 rows
INFO   | jvm 1    | 2013/02/11 11:28:25 | -- add_index(:properties, :prop_key, {:name=>"properties_key"})
2013.02.11 11:28:25 ERROR jruby.rack  unable to create shared application instance
org.jruby.rack.RackInitializationException: An error has occurred, all later migrations canceled:

ActiveRecord::JDBCError: Specified key was too long; max key length is 767 bytes: CREATE  INDEX `properties_key` ON `properties` (`prop_key`)
    from D:/Programs/sonar-3.4.1/war/sonar-server/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
[stacktrace omitted]
org.jruby.exceptions.RaiseException: (StandardError) An error has occurred, all later migrations canceled:

ActiveRecord::JDBCError: Specified key was too long; max key length is 767 bytes: CREATE  INDEX `properties_key` ON `properties` (`prop_key`)
2013.02.11 11:28:25 ERROR jruby.rack  Error: application initialization failed
org.jruby.rack.RackInitializationException: An error has occurred, all later migrations canceled:

ActiveRecord::JDBCError: Specified key was too long; max key length is 767 bytes: CREATE  INDEX `properties_key` ON `properties` (`prop_key`)
    from D:/Programs/sonar-3.4.1/war/sonar-server/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
[stacktrace omitted]
org.jruby.exceptions.RaiseException: (StandardError) An error has occurred, all later migrations canceled:

ActiveRecord::JDBCError: Specified key was too long; max key length is 767 bytes: CREATE  INDEX `properties_key` ON `properties` (`prop_key`)
INFO   | jvm 1    | 2013/02/11 11:28:25 | 2013-02-11 11:28:25.421:INFO::Started SelectChannelConnector@0.0.0.0:9000

1 个答案:

答案 0 :(得分:2)

你是对的,一些索引的创建长度大于最大限制。问题是MySQL 5.6不再以静默方式截断索引。似乎没有预料到这种行为(请参阅http://dev.mysql.com/doc/refman/5.6/en/innodb-restrictions.html和错误http://bugs.mysql.com/bug.php?id=68453)。

所有这一切都说Sonar 3.5通过创建具有正确长度的索引来解决此问题(请参阅http://jira.codehaus.org/browse/SONAR-4137)。