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:27 UTC

git commit: updated refs/heads/master to ca1f8a6

Updated Branches:
  refs/heads/master 226bed7ec -> ca1f8a663


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

Conflicts:
	setup/db/db/schema-410to420.sql


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

Branch: refs/heads/master
Commit: ca1f8a663265e848562981a174ff68202df9f92f
Parents: 226bed7
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 16:00:19 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ca1f8a66/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 e37ccd5..2303ca8 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -98,6 +98,8 @@ public class Upgrade410to420 implements DbUpgrade {
         migrateVolumeHostRef(conn);
         migrateTemplateHostRef(conn);
         migrateSnapshotStoreRef(conn);
+        fixNiciraKeys(conn);
+        fixRouterKeys(conn);
     }
 
     private void fixBaremetalForeignKeys(Connection conn) {
@@ -1846,4 +1848,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/ca1f8a66/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 3d4b835..c8ec726 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -2240,6 +2240,11 @@ CREATE VIEW `cloud`.`project_view` AS
             and resource_tags.resource_type = 'Project'
             left join
         `cloud`.`project_account` pacct ON projects.id = pacct.project_id;
+
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.max.conn', '4096', 'Load Balancer(haproxy) maximum number of concurrent connections(global max)');
 
 ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `concurrent_connections` int(10) unsigned COMMENT 'Load Balancer(haproxy) maximum number of concurrent connections(global max)';
+
+        
+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';