You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2013/07/19 01:00:09 UTC

git commit: updated refs/heads/4.2 to ad112c8

Updated Branches:
  refs/heads/4.2 3fc43cf28 -> ad112c825


CLOUDSTACK-3612: fixed missing indexes in some cloud tables. In the bug those tables are addressed as table #4, table #5, and table #6


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ad112c82
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ad112c82
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ad112c82

Branch: refs/heads/4.2
Commit: ad112c82540d3f6b85e1328b3bef702ccb220805
Parents: 3fc43cf
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Thu Jul 18 15:12:40 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Thu Jul 18 15:59:59 2013 -0700

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade410to420.java  | 52 ++++++++++++++++++++
 setup/db/db/schema-410to420.sql                 |  4 ++
 2 files changed, 56 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ad112c82/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index f89c862..f3170e2 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -92,6 +92,8 @@ public class Upgrade410to420 implements DbUpgrade {
         migrateVolumeHostRef(conn);
         migrateTemplateHostRef(conn);
         migrateSnapshotStoreRef(conn);
+        fixNiciraKeys(conn);
+        fixRouterKeys(conn);
     }
 
     private void fixBaremetalForeignKeys(Connection conn) {
@@ -1960,4 +1962,54 @@ public class Upgrade410to420 implements DbUpgrade {
             }
         }
     }
+    
+    private void fixNiciraKeys(Connection conn) {
+        //First drop the key if it exists.
+        List<String> keys = new ArrayList<String>();
+        s_logger.debug("Dropping foreign key fk_nicira_nvp_nic_map__nic from the table nicira_nvp_nic_map if it exists");
+        keys.add("fk_nicira_nvp_nic_map__nic");
+        DbUpgradeUtils.dropKeysIfExist(conn, "nicira_nvp_nic_map", keys, true);
+
+        //Now add foreign key.
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`nicira_nvp_nic_map` ADD CONSTRAINT `fk_nicira_nvp_nic_map__nic` FOREIGN KEY (`nic`) REFERENCES `nics` (`uuid`) ON DELETE CASCADE");
+            pstmt.executeUpdate();
+            s_logger.debug("Added foreign key fk_nicira_nvp_nic_map__nic to the table nicira_nvp_nic_map");
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to add foreign key fk_nicira_nvp_nic_map__nic to the table nicira_nvp_nic_map", e);
+        } finally {
+            try {
+                if (pstmt != null) {
+                    pstmt.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+    }
+    
+    private void fixRouterKeys(Connection conn) {
+        //First drop the key if it exists.
+        List<String> keys = new ArrayList<String>();
+        s_logger.debug("Dropping foreign key fk_router_network_ref__router_id from the table router_network_ref if it exists");
+        keys.add("fk_router_network_ref__router_id");
+        DbUpgradeUtils.dropKeysIfExist(conn, "router_network_ref", keys, true);
+
+        //Now add foreign key.
+        PreparedStatement pstmt = null;
+        try {
+            pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`router_network_ref` ADD CONSTRAINT `fk_router_network_ref__router_id` FOREIGN KEY (`router_id`) REFERENCES `domain_router` (`id`) ON DELETE CASCADE");
+            pstmt.executeUpdate();
+            s_logger.debug("Added foreign key fk_router_network_ref__router_id to the table router_network_ref");
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to add foreign key fk_router_network_ref__router_id to the table router_network_ref", e);
+        } finally {
+            try {
+                if (pstmt != null) {
+                    pstmt.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ad112c82/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 705d630..4086f2f 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -2240,3 +2240,7 @@ CREATE VIEW `cloud`.`project_view` AS
             and resource_tags.resource_type = 'Project'
             left join
         `cloud`.`project_account` pacct ON projects.id = pacct.project_id;
+
+        
+ALTER TABLE `cloud`.`sync_queue` MODIFY `queue_size` smallint(6) NOT NULL DEFAULT '0' COMMENT 'number of items being processed by the queue';
+ALTER TABLE `cloud`.`sync_queue` MODIFY `queue_size_limit` smallint(6) NOT NULL DEFAULT '1' COMMENT 'max number of items the queue can process concurrently';
\ No newline at end of file