You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2015/06/17 20:56:04 UTC
ambari git commit: AMBARI-11977 Hive,
Hbase have required empty properties after ambari only upgrade from
1.7.0 to 2.1.0 (dsen)
Repository: ambari
Updated Branches:
refs/heads/trunk 97d796de3 -> 26f527e65
AMBARI-11977 Hive,Hbase have required empty properties after ambari only upgrade from 1.7.0 to 2.1.0 (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/26f527e6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/26f527e6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/26f527e6
Branch: refs/heads/trunk
Commit: 26f527e6523287db58219d552e98d5198be035e0
Parents: 97d796d
Author: Dmytro Sen <ds...@apache.org>
Authored: Wed Jun 17 21:55:33 2015 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Wed Jun 17 21:55:44 2015 +0300
----------------------------------------------------------------------
.../server/upgrade/AbstractUpgradeCatalog.java | 33 +++++++++++++++++-
.../server/upgrade/UpgradeCatalog210.java | 36 --------------------
2 files changed, 32 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/26f527e6/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
index 3fec278..466c857 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
@@ -43,6 +43,8 @@ import org.slf4j.LoggerFactory;
import javax.persistence.EntityManager;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -62,6 +64,10 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog {
protected Injector injector;
+ // map and list with constants, for filtration like in stack advisor
+ protected Map<String,List<String>> hiveAuthPropertyValueDependencies = new HashMap<String, List<String>>();
+ protected List<String> allHiveAuthPropertyValueDependecies = new ArrayList<String>();
+
/**
* Override variable in child's if table name was changed
*/
@@ -72,6 +78,8 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog {
* that require the name of the authenticated user
*/
protected static final String AUTHENTICATED_USER_NAME = "ambari-upgrade";
+ private static final String CONFIGURATION_TYPE_HIVE_SITE = "hive-site";
+ private static final String PROPERTY_HIVE_SERVER2_AUTHENTICATION = "hive.server2.authentication";
private static final Logger LOG = LoggerFactory.getLogger
(AbstractUpgradeCatalog.class);
@@ -83,6 +91,17 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog {
this.injector = injector;
injector.injectMembers(this);
registerCatalog(this);
+
+ hiveAuthPropertyValueDependencies.put("ldap", Arrays.asList("hive.server2.authentication.ldap.url",
+ "hive.server2.authentication.ldap.baseDN"));
+ hiveAuthPropertyValueDependencies.put("kerberos", Arrays.asList("hive.server2.authentication.kerberos.keytab",
+ "hive.server2.authentication.kerberos.principal"));
+ hiveAuthPropertyValueDependencies.put("pam", Arrays.asList("hive.server2.authentication.pam.services"));
+ hiveAuthPropertyValueDependencies.put("custom", Arrays.asList("hive.server2.custom.authentication.class"));
+
+ for (List<String> dependencies : hiveAuthPropertyValueDependencies.values()) {
+ allHiveAuthPropertyValueDependecies.addAll(dependencies);
+ }
}
/**
@@ -272,7 +291,19 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog {
}
protected boolean checkAccordingToStackAdvisor(PropertyInfo property, Cluster cluster) {
- //TODO: in future, we can add here general filters
+ if (allHiveAuthPropertyValueDependecies.contains(property.getName())) {
+ Config hiveSite = cluster.getDesiredConfigByType(CONFIGURATION_TYPE_HIVE_SITE);
+ if (hiveSite != null) {
+ String hiveAuthValue = hiveSite.getProperties().get(PROPERTY_HIVE_SERVER2_AUTHENTICATION);
+ if (hiveAuthValue != null) {
+ List<String> dependencies = hiveAuthPropertyValueDependencies.get(hiveAuthValue.toLowerCase());
+ if (dependencies != null) {
+ return dependencies.contains(property.getName());
+ }
+ }
+ }
+ return false;
+ }
return true;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/26f527e6/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
index 48c8d8d..fdb9adb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
@@ -111,8 +111,6 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
private static final String TOPOLOGY_HOST_REQUEST_TABLE = "topology_host_request";
private static final String TOPOLOGY_HOST_TASK_TABLE = "topology_host_task";
private static final String TOPOLOGY_LOGICAL_TASK_TABLE = "topology_logical_task";
- private static final String CONFIGURATION_TYPE_HIVE_SITE = "hive-site";
- private static final String PROPERTY_HIVE_SERVER2_AUTHENTICATION = "hive.server2.authentication";
// constants for stack table changes
private static final String STACK_ID_COLUMN_NAME = "stack_id";
@@ -124,11 +122,6 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
private static final DBColumnInfo CURRENT_STACK_ID_COLUMN = new DBColumnInfo(CURRENT_STACK_ID_COLUMN_NAME, Long.class, null, null, true);
private static final DBColumnInfo STACK_ID_COLUMN = new DBColumnInfo(STACK_ID_COLUMN_NAME, Long.class, null, null, true);
- // map and list with constants, for filtration like in stack advisor
- Map<String,List<String>> hiveAuthPropertyValueDependencies = new HashMap<String, List<String>>();
- List<String> allHiveAuthPropertyValueDependecies = new ArrayList<String>();
-
-
@Inject
DaoUtils daoUtils;
@@ -170,17 +163,6 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
daoUtils = injector.getInstance(DaoUtils.class);
osFamily = injector.getInstance(OsFamily.class);
-
- hiveAuthPropertyValueDependencies.put("ldap", Arrays.asList("hive.server2.authentication.ldap.url",
- "hive.server2.authentication.ldap.baseDN"));
- hiveAuthPropertyValueDependencies.put("kerberos", Arrays.asList("hive.server2.authentication.kerberos.keytab",
- "hive.server2.authentication.kerberos.principal"));
- hiveAuthPropertyValueDependencies.put("pam", Arrays.asList("hive.server2.authentication.pam.services"));
- hiveAuthPropertyValueDependencies.put("custom", Arrays.asList("hive.server2.custom.authentication.class"));
-
- for (List<String> dependencies : hiveAuthPropertyValueDependencies.values()) {
- allHiveAuthPropertyValueDependecies.addAll(dependencies);
- }
}
// ----- AbstractUpgradeCatalog --------------------------------------------
@@ -948,24 +930,6 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
removeStormRestApiServiceComponent();
}
- @Override
- protected boolean checkAccordingToStackAdvisor(PropertyInfo property, Cluster cluster) {
- if (allHiveAuthPropertyValueDependecies.contains(property.getName())) {
- Config hiveSite = cluster.getDesiredConfigByType(CONFIGURATION_TYPE_HIVE_SITE);
- if (hiveSite != null) {
- String hiveAuthValue = hiveSite.getProperties().get(PROPERTY_HIVE_SERVER2_AUTHENTICATION);
- if (hiveAuthValue != null) {
- List<String> dependencies = hiveAuthPropertyValueDependencies.get(hiveAuthValue.toLowerCase());
- if (dependencies != null) {
- return dependencies.contains(property.getName());
- }
- }
- }
- return false;
- }
- return true;
- }
-
/**
* Delete STORM_REST_API component if HDP is upgraded past 2.2 and the
* Component still exists.