Skip to content

Commit eaf9d3d

Browse files
author
Alena Prokharchyk
committed
Catch all exceptions when change engine and row_format - can fail when table is full. Just skip as its not a critical fix
1 parent 66bb690 commit eaf9d3d

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

server/src/com/cloud/upgrade/dao/Upgrade301to302.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public void performDataMigration(Connection conn) {
7575
dropKeysIfExists(conn);
7676
updateSharedNetworks(conn);
7777
fixLastHostIdKey(conn);
78+
changeEngine(conn);
7879
}
7980

8081
@Override
@@ -188,4 +189,39 @@ private void fixLastHostIdKey(Connection conn) {
188189
}
189190
}
190191
}
192+
193+
private void changeEngine(Connection conn) {
194+
s_logger.debug("Fixing engine and row_format for op_lock and op_nwgrp_work tables");
195+
PreparedStatement pstmt = null;
196+
try {
197+
pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`op_lock` ENGINE=MEMORY, ROW_FORMAT = FIXED");
198+
pstmt.executeUpdate();
199+
pstmt.close();
200+
} catch (Exception e) {
201+
s_logger.debug("Failed do execute the statement " + pstmt + ", moving on as it's not critical fix");
202+
} finally {
203+
try {
204+
if (pstmt != null) {
205+
pstmt.close();
206+
}
207+
} catch (SQLException e) {
208+
}
209+
}
210+
211+
try {
212+
pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`op_nwgrp_work` ENGINE=MEMORY, ROW_FORMAT = FIXED");
213+
pstmt.executeUpdate();
214+
pstmt.close();
215+
} catch (Exception e) {
216+
s_logger.debug("Failed do execute the statement " + pstmt + ", moving on as it's not critical fix");
217+
} finally {
218+
try {
219+
if (pstmt != null) {
220+
pstmt.close();
221+
}
222+
} catch (SQLException e) {
223+
}
224+
}
225+
}
226+
191227
}

setup/db/db/schema-301to302.sql

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,5 @@ UPDATE `cloud`.`network_offerings` SET display_text='Offering for Isolated netwo
2727
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;
2828
UPDATE `cloud`.`network_offerings` SET display_text='Offering for Shared networks' WHERE name='DefaultSharedNetworkOffering' and `cloud`.`network_offerings`.default=1;
2929

30-
31-
32-
ALTER TABLE `cloud`.`op_lock` ENGINE=MEMORY, ROW_FORMAT = FIXED;
33-
ALTER TABLE `cloud`.`op_nwgrp_work` ENGINE=MEMORY, ROW_FORMAT = FIXED;
34-
3530
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '6.0.2', 50, 1);
3631
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('VMware', '5.0', 128, 0);

0 commit comments

Comments
 (0)