You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2017/10/24 20:14:25 UTC
[04/50] [abbrv] ambari git commit: AMBARI-22216. Ambari Schema
Upgrade Failed during Ambari Upgrade (configuration: 2.5.2.0 -> 2.6.0.0
upgrade) (dlysnichenko)
AMBARI-22216. Ambari Schema Upgrade Failed during Ambari Upgrade (configuration: 2.5.2.0 -> 2.6.0.0 upgrade) (dlysnichenko)
(cherry picked from commit c2937e8be749052f649f2f901e8ae64ca55eaa2c)
Change-Id: I2e681720530eb12a79295f3406d7b5e6a6587a4d
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/427e692e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/427e692e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/427e692e
Branch: refs/heads/AMBARI-2.6.0.0
Commit: 427e692ebbae79d34ae473dd9c2c803fa9624f84
Parents: 08e55df
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Oct 19 18:56:31 2017 +0300
Committer: Zuul <re...@hortonworks.com>
Committed: Thu Oct 19 21:51:38 2017 -0700
----------------------------------------------------------------------
.../java/org/apache/ambari/server/orm/DBAccessorImpl.java | 8 ++++++--
.../org/apache/ambari/server/upgrade/UpgradeCatalog260.java | 6 ++++++
2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/427e692e/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 09316be..391a6f5 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
@@ -956,8 +956,12 @@ public class DBAccessorImpl implements DBAccessor {
@Override
public void dropTable(String tableName) throws SQLException {
- String query = dbmsHelper.getDropTableStatement(tableName);
- executeQuery(query);
+ if (tableExists(tableName)){
+ String query = dbmsHelper.getDropTableStatement(tableName);
+ executeQuery(query);
+ } else {
+ LOG.warn("{} table doesn't exists, skipping", tableName);
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/427e692e/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
index 6f37985..96ce807 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
@@ -155,6 +155,8 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog {
public static final String FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID = "FK_servicedesiredstate_desired_stack_id";
public static final String FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID = "FK_hostcomponentdesiredstate_desired_stack_id";
public static final String FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID = "FK_hostcomponentstate_current_stack_id";
+ public static final String FK_UPGRADE_FROM_REPO_VERSION_ID = "FK_upgrade_from_repo_version_id";
+ public static final String FK_UPGRADE_TO_REPO_VERSION_ID = "FK_upgrade_to_repo_version_id";
/**
@@ -213,8 +215,12 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog {
* {@value #FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID}
* {@value #FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID}
* {@value #FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID}
+ * {@value #FK_UPGRADE_FROM_REPO_VERSION_ID}
+ * {@value #FK_UPGRADE_TO_REPO_VERSION_ID}
*/
private void dropBrokenFK() throws SQLException {
+ dbAccessor.dropFKConstraint(UPGRADE_TABLE, FK_UPGRADE_FROM_REPO_VERSION_ID);
+ dbAccessor.dropFKConstraint(UPGRADE_TABLE, FK_UPGRADE_TO_REPO_VERSION_ID);
dbAccessor.dropFKConstraint(SERVICE_COMPONENT_DESIRED_STATE_TABLE, FK_SERVICECOMPONENTDESIREDSTATE_DESIRED_STACK_ID);
dbAccessor.dropFKConstraint(SERVICE_DESIRED_STATE_TABLE, FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID);
dbAccessor.dropFKConstraint(HOST_COMPONENT_DESIRED_STATE_TABLE, FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID);