Catch all exceptions when change engine and row_format - can fail when table is full. Just skip as its not a critical fix

This commit is contained in:
Alena Prokharchyk 2012-04-24 15:47:50 -07:00
parent 66bb690b2d
commit eaf9d3d820
2 changed files with 36 additions and 5 deletions

View File

@ -75,6 +75,7 @@ public class Upgrade301to302 implements DbUpgrade {
dropKeysIfExists(conn);
updateSharedNetworks(conn);
fixLastHostIdKey(conn);
changeEngine(conn);
}
@Override
@ -188,4 +189,39 @@ public class Upgrade301to302 implements DbUpgrade {
}
}
}
private void changeEngine(Connection conn) {
s_logger.debug("Fixing engine and row_format for op_lock and op_nwgrp_work tables");
PreparedStatement pstmt = null;
try {
pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`op_lock` ENGINE=MEMORY, ROW_FORMAT = FIXED");
pstmt.executeUpdate();
pstmt.close();
} catch (Exception e) {
s_logger.debug("Failed do execute the statement " + pstmt + ", moving on as it's not critical fix");
} finally {
try {
if (pstmt != null) {
pstmt.close();
}
} catch (SQLException e) {
}
}
try {
pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`op_nwgrp_work` ENGINE=MEMORY, ROW_FORMAT = FIXED");
pstmt.executeUpdate();
pstmt.close();
} catch (Exception e) {
s_logger.debug("Failed do execute the statement " + pstmt + ", moving on as it's not critical fix");
} finally {
try {
if (pstmt != null) {
pstmt.close();
}
} catch (SQLException e) {
}
}
}
}

View File

@ -27,10 +27,5 @@ UPDATE `cloud`.`network_offerings` SET display_text='Offering for Isolated netwo
UPDATE `cloud`.`network_offerings` SET display_text='Offering for Isolated networks with no Source Nat service' WHERE name='DefaultIsolatedNetworkOffering' and `cloud`.`network_offerings`.default=1;
UPDATE `cloud`.`network_offerings` SET display_text='Offering for Shared networks' WHERE name='DefaultSharedNetworkOffering' and `cloud`.`network_offerings`.default=1;
ALTER TABLE `cloud`.`op_lock` ENGINE=MEMORY, ROW_FORMAT = FIXED;
ALTER TABLE `cloud`.`op_nwgrp_work` ENGINE=MEMORY, ROW_FORMAT = FIXED;
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '6.0.2', 50, 1);
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('VMware', '5.0', 128, 0);