mirror of https://github.com/apache/cloudstack.git
Merge pull request #1517 from shapeblue/mysql-5.7-upgradefix
engine/schema: fix upgrade path to work with MySQL 5.7Found this issue when using MySQL 5.7 with Ubuntu 16.04. The upgrade path fix removes an invalid `IGNORE` param that is deprecated now, in the upgrade path we run the alter statement to add an index only if it does not exist so we're good. For MySQL 5.7, we'll also need to update the docs at some point to include `server-id` along with other parameters. Some of the SQL statements used throughout engine/schema don't adhere to SQL 99 standard which is enforced by default in MySQL 5.7, therefore the following sql-mode (for backward compatibility with mysql 5.6 modes) will be necessary for anyone willing to use MySQL 5.7 (until we fix codebase wide raw and generated sql statements to be SQL99 compliant): sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_ENGINE_SUBSTITUTION" server-id = 1 innodb_rollback_on_timeout=1 innodb_lock_wait_timeout=600 max_connections=350 log-bin=mysql-bin binlog-format = 'ROW' /cc @swill @jburwell @agneya2001 @wido @DaanHoogland and others * pr/1517: engine/schema: fix upgrade path to work with MySQL 5.7 Signed-off-by: Will Stevens <williamstevens@gmail.com>
This commit is contained in:
commit
ad138a15d7
|
|
@ -1297,7 +1297,7 @@ public class Upgrade410to420 implements DbUpgrade {
|
|||
s_logger.debug("Index already exists on host_details - not adding new one");
|
||||
} else {
|
||||
// add the index
|
||||
try(PreparedStatement pstmtUpdate = conn.prepareStatement("ALTER IGNORE TABLE `cloud`.`host_details` ADD INDEX `fk_host_details__host_id` (`host_id`)");) {
|
||||
try(PreparedStatement pstmtUpdate = conn.prepareStatement("ALTER TABLE `cloud`.`host_details` ADD INDEX `fk_host_details__host_id` (`host_id`)");) {
|
||||
pstmtUpdate.executeUpdate();
|
||||
s_logger.debug("Index did not exist on host_details - added new one");
|
||||
}catch (SQLException e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue