From c63ea0a240df0c5af2802b424d70083bbfd0e919 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Mon, 25 Apr 2016 14:47:22 +0530 Subject: [PATCH] engine/schema: fix upgrade path to work with MySQL 5.7 Found this issue when using MySQL 5.7 with Ubuntu 16.04 with following settings: 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' Signed-off-by: Rohit Yadav --- engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java index b816fdc9fc3..7d67d2eb6ab 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java @@ -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) {