ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject ambari git commit: AMBARI-11104. Upgrade 2.0.0->2.0.1 on oracle database failed (dlysnichenko)
Date Wed, 13 May 2015 13:24:45 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.maint 11695e4fe -> b1f340337


AMBARI-11104. Upgrade 2.0.0->2.0.1 on oracle database failed (dlysnichenko)


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

Branch: refs/heads/branch-2.0.maint
Commit: b1f3403372e9f2ec74011c6c09a7dcfb2e676fa1
Parents: 11695e4
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Wed May 13 16:23:53 2015 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Wed May 13 16:23:53 2015 +0300

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog200.java       | 21 +++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b1f34033/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
index 1b22c89..ffd4bba 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java
@@ -177,6 +177,21 @@ public class UpgradeCatalog200 extends AbstractUpgradeCatalog {
   }
 
   /**
+   * Analog for List<String>.contains
+   * @param s string element to be searched
+   * @param l collection of strings
+   * @return result of contains operation
+   */
+  public boolean containsCaseInsensitive(String s, List<String> l){
+    for (String listItem : l){
+      if (listItem.equalsIgnoreCase(s)){
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
    * Execute all of the alert DDL updates.
    *
    * @throws AmbariException
@@ -220,16 +235,16 @@ public class UpgradeCatalog200 extends AbstractUpgradeCatalog {
     columns.add(new DBColumnInfo("version",         String.class,  255,   null, false));
     columns.add(new DBColumnInfo("display_name",    String.class,  128,   null, false));
     columns.add(new DBColumnInfo("upgrade_package", String.class,  255,   null, false));
-    columns.add(new DBColumnInfo("repositories",    char[].class,  null,  null, false));
+    columns.add(new DBColumnInfo("repositories", char[].class, null, null, false));
     dbAccessor.createTable("repo_version", columns, "repo_version_id");
 
     addSequence("repo_version_id_seq", 0);
 
     List<String> indexes = dbAccessor.getIndexesList("repo_version", true);
-    if (!indexes.contains("uq_repo_version_display_name")) {
+    if (!containsCaseInsensitive("uq_repo_version_display_name", indexes)) {
       dbAccessor.executeQuery("ALTER TABLE repo_version ADD CONSTRAINT UQ_repo_version_display_name
UNIQUE (display_name)");
     }
-    if (!indexes.contains("uq_repo_version_stack_version")) {
+    if (!containsCaseInsensitive("uq_repo_version_stack_version", indexes)) {
       dbAccessor.executeQuery("ALTER TABLE repo_version ADD CONSTRAINT UQ_repo_version_stack_version
UNIQUE (stack, version)");
     }
 


Mime
View raw message