You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2017/07/06 17:43:29 UTC
ambari git commit: AMBARI-21411. Backend - Run EU/RU PreChecks during
a cross-stack upgrade (alejandro)
Repository: ambari
Updated Branches:
refs/heads/branch-feature-AMBARI-21348 fb53ed5dd -> 4e668ca68
AMBARI-21411. Backend - Run EU/RU PreChecks during a cross-stack upgrade (alejandro)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4e668ca6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4e668ca6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4e668ca6
Branch: refs/heads/branch-feature-AMBARI-21348
Commit: 4e668ca683e4aacd35aed9274662a749b930fa06
Parents: fb53ed5
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Thu Jun 29 16:33:00 2017 -0700
Committer: Alejandro Fernandez <af...@hortonworks.com>
Committed: Thu Jul 6 10:43:55 2017 -0700
----------------------------------------------------------------------
.../PreUpgradeCheckResourceProvider.java | 9 +++-
.../internal/UpgradeResourceProvider.java | 6 +--
.../ambari/server/state/UpgradeHelper.java | 29 ++++++-----
.../4.2.5/services/FLUME/metainfo.xml | 2 +-
.../4.2.5/services/JNBG/metainfo.xml | 26 ---------
.../4.2.5/services/OOZIE/metainfo.xml | 2 +-
.../4.2.5/services/R4ML/metainfo.xml | 37 -------------
.../4.2.5/services/SOLR/metainfo.xml | 55 --------------------
.../4.2.5/services/SYSTEMML/metainfo.xml | 37 -------------
.../4.2.5/services/TITAN/metainfo.xml | 40 --------------
.../PreUpgradeCheckResourceProviderTest.java | 12 +++--
.../ambari/server/state/UpgradeHelperTest.java | 6 ++-
12 files changed, 40 insertions(+), 221 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
index 7ccafb7..689942d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
@@ -47,6 +47,7 @@ import org.apache.ambari.server.state.CheckHelper;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.ServiceInfo;
+import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.UpgradeHelper;
import org.apache.ambari.server.state.stack.PrerequisiteCheck;
import org.apache.ambari.server.state.stack.UpgradePack;
@@ -78,6 +79,7 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider {
public static final String UPGRADE_CHECK_CHECK_TYPE_PROPERTY_ID = PropertyHelper.getPropertyId("UpgradeChecks", "check_type");
public static final String UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("UpgradeChecks", "cluster_name");
public static final String UPGRADE_CHECK_UPGRADE_TYPE_PROPERTY_ID = PropertyHelper.getPropertyId("UpgradeChecks", "upgrade_type");
+ public static final String UPGRADE_CHECK_TARGET_STACK_ID = PropertyHelper.getPropertyId("UpgradeChecks", "target_stack");
/**
* Optional parameter to specify the preferred Upgrade Pack to use.
*/
@@ -114,6 +116,7 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider {
UPGRADE_CHECK_CHECK_TYPE_PROPERTY_ID,
UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID,
UPGRADE_CHECK_UPGRADE_TYPE_PROPERTY_ID,
+ UPGRADE_CHECK_TARGET_STACK_ID,
UPGRADE_CHECK_UPGRADE_PACK_PROPERTY_ID,
UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID);
@@ -144,6 +147,7 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider {
for (Map<String, Object> propertyMap: propertyMaps) {
final String clusterName = propertyMap.get(UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID).toString();
+ StackId targetStack = new StackId(propertyMap.get(UPGRADE_CHECK_TARGET_STACK_ID).toString());
UpgradeType upgradeType = UpgradeType.ROLLING;
if (propertyMap.containsKey(UPGRADE_CHECK_UPGRADE_TYPE_PROPERTY_ID)) {
@@ -170,7 +174,7 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider {
if (propertyMap.containsKey(UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID)) {
String repositoryVersionId = propertyMap.get(UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID).toString();
- RepositoryVersionEntity repositoryVersionEntity = repositoryVersionDAO.findByStackNameAndVersion(stackName, repositoryVersionId);
+ RepositoryVersionEntity repositoryVersionEntity = repositoryVersionDAO.findByStackNameAndVersion(targetStack.getStackName(), repositoryVersionId);
// set some required properties on the check request
upgradeCheckRequest.setRepositoryVersion(repositoryVersionId);
upgradeCheckRequest.setTargetStackId(repositoryVersionEntity.getStackId());
@@ -184,7 +188,7 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider {
try{
// Hint: PreChecks currently executing only before UPGRADE direction
upgradePack = upgradeHelper.get().suggestUpgradePack(clusterName, sourceStackVersion,
- upgradeCheckRequest.getRepositoryVersion(), Direction.UPGRADE, upgradeType, preferredUpgradePackName);
+ upgradeCheckRequest.getRepositoryVersion(), Direction.UPGRADE, upgradeType, targetStack.getStackName(), preferredUpgradePackName);
} catch (AmbariException e) {
throw new SystemException(e.getMessage(), e);
}
@@ -222,6 +226,7 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider {
setResourceProperty(resource, UPGRADE_CHECK_CHECK_TYPE_PROPERTY_ID, prerequisiteCheck.getType(), requestedIds);
setResourceProperty(resource, UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID, prerequisiteCheck.getClusterName(), requestedIds);
setResourceProperty(resource, UPGRADE_CHECK_UPGRADE_TYPE_PROPERTY_ID, upgradeType, requestedIds);
+ setResourceProperty(resource, UPGRADE_CHECK_TARGET_STACK_ID, targetStack.getStackId(), requestedIds);
if (upgradeCheckRequest.getRepositoryVersion() != null) {
setResourceProperty(resource, UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID, upgradeCheckRequest.getRepositoryVersion(), requestedIds);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index 795e8d1..f33cc63 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -656,14 +656,14 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
/**
* Validates a singular API request.
*
- * @param requestMap
- * the map of properties
+ * @param upgradeContext details about the upgrade such as direction and type
* @return the validated upgrade pack
* @throws AmbariException
*/
private UpgradePack validateRequest(UpgradeContext upgradeContext) throws AmbariException {
Cluster cluster = upgradeContext.getCluster();
Direction direction = upgradeContext.getDirection();
+ String targetStackName = upgradeContext.getTargetStackId().getStackName();
Map<String, Object> requestMap = upgradeContext.getUpgradeRequest();
UpgradeType upgradeType = upgradeContext.getType();
RepositoryVersionEntity targetRepositoryVersion = upgradeContext.getTargetRepositoryVersion();
@@ -678,7 +678,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
String versionForUpgradePack = (String) requestMap.get(UPGRADE_FROM_VERSION);
UpgradePack pack = s_upgradeHelper.suggestUpgradePack(cluster.getClusterName(),
- versionForUpgradePack, version, direction, upgradeType, preferredUpgradePackName);
+ versionForUpgradePack, version, direction, upgradeType, targetStackName, preferredUpgradePackName);
// the validator will throw an exception if the upgrade request is not valid
UpgradeRequestValidator upgradeRequestValidator = buildValidator(upgradeType);
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
index 69663fb..fe6532d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
@@ -192,16 +192,17 @@ public class UpgradeHelper {
* @param upgradeToVersion Target stack version
* @param direction {@code Direction} of the upgrade
* @param upgradeType The {@code UpgradeType}
+ * @param targetStackName The destination target stack name.
* @param preferredUpgradePackName For unit test, need to prefer an upgrade pack since multiple matches can be found.
* @return {@code UpgradeType} object
* @throws AmbariException
*/
public UpgradePack suggestUpgradePack(String clusterName, String upgradeFromVersion, String upgradeToVersion,
- Direction direction, UpgradeType upgradeType, String preferredUpgradePackName) throws AmbariException {
+ Direction direction, UpgradeType upgradeType, String targetStackName, String preferredUpgradePackName) throws AmbariException {
// Find upgrade packs based on current stack. This is where to upgrade from
Cluster cluster = clusters.get().getCluster(clusterName);
- StackId stack = cluster.getCurrentStackVersion();
+ StackId currentStack = cluster.getCurrentStackVersion();
String repoVersion = upgradeToVersion;
@@ -210,21 +211,25 @@ public class UpgradeHelper {
repoVersion = upgradeFromVersion;
}
- RepositoryVersionEntity versionEntity = s_repoVersionDAO.get().findByStackNameAndVersion(stack.getStackName(), repoVersion);
+ Map<String, UpgradePack> packs = m_ambariMetaInfo.get().getUpgradePacks(currentStack.getStackName(), currentStack.getStackVersion());
+ UpgradePack pack = null;
+
+ if (StringUtils.isNotEmpty(preferredUpgradePackName) && packs.containsKey(preferredUpgradePackName)) {
+ pack = packs.get(preferredUpgradePackName);
+ }
+
+ RepositoryVersionEntity versionEntity = s_repoVersionDAO.get().findByStackNameAndVersion(targetStackName, repoVersion);
if (null == versionEntity) {
versionEntity = s_repoVersionDAO.get().findByVersion(repoVersion);
}
if (versionEntity == null) {
- throw new AmbariException(String.format("Repository version %s was not found", repoVersion));
+ throw new AmbariException(String.format("Repository version %s was not found for target stack %s", repoVersion, targetStackName));
}
- Map<String, UpgradePack> packs = m_ambariMetaInfo.get().getUpgradePacks(stack.getStackName(), stack.getStackVersion());
- UpgradePack pack = null;
-
- if (StringUtils.isNotEmpty(preferredUpgradePackName) && packs.containsKey(preferredUpgradePackName)) {
- pack = packs.get(preferredUpgradePackName);
- } else {
+ // Best-attempt at picking an upgrade pack assuming within the same stack whose target stack version matches.
+ // If multiple candidates are found, raise an exception.
+ if (null == pack) {
String repoStackId = versionEntity.getStackId().getStackId();
for (UpgradePack upgradePack : packs.values()) {
if (null != upgradePack.getTargetStack() && upgradePack.getTargetStack().equals(repoStackId) &&
@@ -242,8 +247,8 @@ public class UpgradeHelper {
}
if (null == pack) {
- throw new AmbariException(String.format("Unable to perform %s. Could not locate %s upgrade pack for version %s",
- direction.getText(false), upgradeType.toString(), repoVersion));
+ throw new AmbariException(String.format("Unable to perform %s. Could not locate %s upgrade pack for stack %s and version %s",
+ direction.getText(false), upgradeType.toString(), targetStackName, repoVersion));
}
return pack;
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml
index 99f1f79..4c774c8 100755
--- a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/FLUME/metainfo.xml
@@ -20,7 +20,7 @@
<services>
<service>
<name>FLUME</name>
- <version>1.7.0</version>
+ <version>1.4.0</version>
<extends>common-services/FLUME/1.4.0.2.0</extends>
<osSpecifics>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/JNBG/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/JNBG/metainfo.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/JNBG/metainfo.xml
deleted file mode 100755
index 3520a32..0000000
--- a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/JNBG/metainfo.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<metainfo>
- <schemaVersion>2.0</schemaVersion>
- <services>
- <service>
- <name>JNBG</name>
- <extends>common-services/JNBG/0.2.0</extends>
- </service>
- </services>
-</metainfo>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml
index 4a7dc31..94d3788 100755
--- a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/OOZIE/metainfo.xml
@@ -21,7 +21,7 @@
<service>
<name>OOZIE</name>
<extends>common-services/OOZIE/4.2.0.2.5</extends>
- <version>4.3.0</version>
+ <version>4.2.0</version>
<osSpecifics>
<osSpecific>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/R4ML/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/R4ML/metainfo.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/R4ML/metainfo.xml
deleted file mode 100755
index d1c708d..0000000
--- a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/R4ML/metainfo.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<metainfo>
- <schemaVersion>2.0</schemaVersion>
- <services>
- <service>
- <name>R4ML</name>
- <version>0.8.0</version>
- <extends>common-services/R4ML/0.8.0</extends>
- <osSpecifics>
- <osSpecific>
- <osFamily>any</osFamily>
- <packages>
- <package>
- <name>r4ml_4_2_5_*</name>
- </package>
- </packages>
- </osSpecific>
- </osSpecifics>
- </service>
- </services>
-</metainfo>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/metainfo.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/metainfo.xml
deleted file mode 100755
index be20810..0000000
--- a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/metainfo.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<metainfo>
- <schemaVersion>2.0</schemaVersion>
- <services>
- <service>
- <name>SOLR</name>
- <version>6.3.0</version>
- <extends>common-services/SOLR/5.5.0</extends>
- <osSpecifics>
- <osSpecific>
- <osFamily>redhat7,redhat6,suse11</osFamily>
- <packages>
- <package>
- <name>solr_4_2_5_*</name>
- </package>
- <package>
- <name>ambari-infra-solr-client-*</name>
- </package>
- </packages>
- </osSpecific>
- <osSpecific>
- <osFamily>ubuntu12</osFamily>
- <packages>
- <package>
- <name>solr_4_2_5_*</name>
- </package>
- <package>
- <name>ambari-infra-solr-client-*</name>
- </package>
- </packages>
- </osSpecific>
- </osSpecifics>
-
- <configuration-dependencies>
- <config-type>ranger-env</config-type>
- </configuration-dependencies>
- </service>
- </services>
-</metainfo>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SYSTEMML/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SYSTEMML/metainfo.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SYSTEMML/metainfo.xml
deleted file mode 100755
index 7a0e125..0000000
--- a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SYSTEMML/metainfo.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<metainfo>
- <schemaVersion>2.0</schemaVersion>
- <services>
- <service>
- <name>SYSTEMML</name>
- <version>0.13.0</version>
- <extends>common-services/SYSTEMML/0.10.0</extends>
- <osSpecifics>
- <osSpecific>
- <osFamily>any</osFamily>
- <packages>
- <package>
- <name>*systemml_4_2_5_*</name>
- </package>
- </packages>
- </osSpecific>
- </osSpecifics>
- </service>
- </services>
-</metainfo>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/TITAN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/TITAN/metainfo.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/TITAN/metainfo.xml
deleted file mode 100755
index d00e707..0000000
--- a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/TITAN/metainfo.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<metainfo>
- <schemaVersion>2.0</schemaVersion>
- <services>
- <service>
- <name>TITAN</name>
- <version>1.0.0</version>
- <extends>common-services/TITAN/1.0.0</extends>
- <osSpecifics>
- <osSpecific>
- <osFamily>any</osFamily>
- <packages>
- <package>
- <name>titan_4_2_5_*</name>
- </package>
- <package>
- <name>ambari-infra-solr-client-*</name>
- </package>
- </packages>
- </osSpecific>
- </osSpecifics>
- </service>
- </services>
-</metainfo>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProviderTest.java
index 47bba34..a41fb0f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProviderTest.java
@@ -101,6 +101,7 @@ public class PreUpgradeCheckResourceProviderTest {
ServiceFactory serviceFactory = createNiceMock(ServiceFactory.class);
AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class);
+ String stackName = "Stack100";
Map<String, Service> allServiceMap = new HashMap<String, Service>();
allServiceMap.put("Service100", service);
Map<String, ServiceInfo> allServiceInfoMap = new HashMap<String, ServiceInfo>();
@@ -116,14 +117,14 @@ public class PreUpgradeCheckResourceProviderTest {
expect(cluster.getService("Service100")).andReturn(service).anyTimes();
expect(cluster.getCurrentStackVersion()).andReturn(currentStackId).anyTimes();
- expect(currentStackId.getStackName()).andReturn("Stack100").anyTimes();
+ expect(currentStackId.getStackName()).andReturn(stackName).anyTimes();
expect(currentStackId.getStackVersion()).andReturn("1.0").anyTimes();
- expect(targetStackId.getStackName()).andReturn("Stack100").anyTimes();
+ expect(targetStackId.getStackName()).andReturn(stackName).anyTimes();
expect(targetStackId.getStackVersion()).andReturn("1.1").anyTimes();
- expect(repoDao.findByStackNameAndVersion("Stack100", "Repo100")).andReturn(repo).anyTimes();
+ expect(repoDao.findByStackNameAndVersion(stackName, "Repo100")).andReturn(repo).anyTimes();
expect(repo.getStackId()).andReturn(targetStackId).atLeastOnce();
- expect(upgradeHelper.suggestUpgradePack("Cluster100", "1.0", "Repo100", Direction.UPGRADE, UpgradeType.NON_ROLLING, "upgrade_pack11")).andReturn(upgradePack);
+ expect(upgradeHelper.suggestUpgradePack("Cluster100", "1.0", "Repo100", Direction.UPGRADE, UpgradeType.NON_ROLLING, stackName, "upgrade_pack11")).andReturn(upgradePack);
List<AbstractCheckDescriptor> upgradeChecksToRun = new LinkedList<AbstractCheckDescriptor>();
List<String> prerequisiteChecks = new LinkedList<String>();
@@ -132,7 +133,7 @@ public class PreUpgradeCheckResourceProviderTest {
expect(upgradePack.getPrerequisiteChecks()).andReturn(prerequisiteChecks).anyTimes();
expect(upgradePack.getTarget()).andReturn("1.1.*.*").anyTimes();
- expect(ambariMetaInfo.getServices("Stack100", "1.0")).andReturn(allServiceInfoMap).anyTimes();
+ expect(ambariMetaInfo.getServices(stackName, "1.0")).andReturn(allServiceInfoMap).anyTimes();
String checks = ClassLoader.getSystemClassLoader().getResource("checks").getPath();
expect(serviceInfo.getChecksFolder()).andReturn(new File(checks));
@@ -147,6 +148,7 @@ public class PreUpgradeCheckResourceProviderTest {
Predicate predicate = builder.property(PreUpgradeCheckResourceProvider.UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID).equals("Cluster100").and()
.property(PreUpgradeCheckResourceProvider.UPGRADE_CHECK_UPGRADE_PACK_PROPERTY_ID).equals("upgrade_pack11").and()
.property(PreUpgradeCheckResourceProvider.UPGRADE_CHECK_UPGRADE_TYPE_PROPERTY_ID).equals(UpgradeType.NON_ROLLING).and()
+ .property(PreUpgradeCheckResourceProvider.UPGRADE_CHECK_TARGET_STACK_ID).equals(stackName + "-100").and()
.property(PreUpgradeCheckResourceProvider.UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID).equals("Repo100").toPredicate();
http://git-wip-us.apache.org/repos/asf/ambari/blob/4e668ca6/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
index 6e27cba..25abada 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
@@ -187,11 +187,12 @@ public class UpgradeHelperTest {
final String upgradeToVersion = "2.2.0";
final Direction upgradeDirection = Direction.UPGRADE;
final UpgradeType upgradeType = UpgradeType.ROLLING;
+ final String stackName = "HDP";
makeCluster();
try {
String preferredUpgradePackName = "upgrade_test";
- UpgradePack up = m_upgradeHelper.suggestUpgradePack(clusterName, upgradeFromVersion, upgradeToVersion, upgradeDirection, upgradeType, preferredUpgradePackName);
+ UpgradePack up = m_upgradeHelper.suggestUpgradePack(clusterName, upgradeFromVersion, upgradeToVersion, upgradeDirection, upgradeType, stackName, preferredUpgradePackName);
assertEquals(upgradeType, up.getType());
} catch (AmbariException e){
assertTrue(false);
@@ -1725,13 +1726,14 @@ public class UpgradeHelperTest {
final String upgradeToVersion = "2.2.0";
final Direction upgradeDirection = Direction.UPGRADE;
final UpgradeType upgradeType = UpgradeType.ROLLING;
+ final String stackName = "HDP";
Cluster cluster = makeCluster();
// grab the right pack
String preferredUpgradePackName = "upgrade_grouping_rolling";
UpgradePack upgradePack = m_upgradeHelper.suggestUpgradePack(clusterName, upgradeFromVersion,
- upgradeToVersion, upgradeDirection, upgradeType, preferredUpgradePackName);
+ upgradeToVersion, upgradeDirection, upgradeType, stackName, preferredUpgradePackName);
assertEquals(upgradeType, upgradePack.getType());