ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amag...@apache.org
Subject [16/50] ambari git commit: AMBARI-22213. "ambari-server upgrade" failed on db schema [Upgrade] (dlysnichenko)
Date Tue, 17 Oct 2017 14:58:32 GMT
AMBARI-22213. "ambari-server upgrade" failed on db schema [Upgrade] (dlysnichenko)


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

Branch: refs/heads/branch-feature-AMBARI-22008
Commit: b86f53fbe1c940811c3e49d658aad870d1dd53da
Parents: a8caac3
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Thu Oct 12 13:57:24 2017 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Thu Oct 12 13:58:23 2017 +0300

----------------------------------------------------------------------
 .../apache/ambari/server/orm/DBAccessorImpl.java    | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b86f53fb/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
index 26670fc..faa58f2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java
@@ -1551,8 +1551,12 @@ public class DBAccessorImpl implements DBAccessor {
    */
   @Override
   public void clearTable(String tableName) throws SQLException {
-    String sqlQuery = "DELETE FROM " + convertObjectName(tableName);
-    executeQuery(sqlQuery);
+    if (tableExists(tableName)){
+      String sqlQuery = "DELETE FROM " + convertObjectName(tableName);
+      executeQuery(sqlQuery);
+    } else {
+      LOG.warn("{} table doesn't exists, skipping", tableName);
+    }
   }
 
   /**
@@ -1564,7 +1568,11 @@ public class DBAccessorImpl implements DBAccessor {
    */
   @Override
   public void clearTableColumn(String tableName, String columnName, Object value) throws
SQLException {
-    String sqlQuery = String.format("UPDATE %s SET %s = ?", convertObjectName(tableName),
convertObjectName(columnName));
-    executePreparedUpdate(sqlQuery, value);
+    if (tableExists(tableName)){
+      String sqlQuery = String.format("UPDATE %s SET %s = ?", convertObjectName(tableName),
convertObjectName(columnName));
+      executePreparedUpdate(sqlQuery, value);
+    } else {
+      LOG.warn("{} table doesn't exists, skipping", tableName);
+    }
   }
 }


Mime
View raw message