Hi,
Having tested my 3-nodes dev cluster, I would like to finalize the ambari migration like stated in the documentation.
So I’ve executed
ambari-server set-current --cluster-name=GANESH_DEV --version-display-name=HDP-2.2.4.2-2
(BTW, the port is always 8080 if you don’t edit /usr/lib/python2.6/site-packages/ambari_server/serverConfiguration.py
with your ambari server port as the configuration file is not taken into account properly)
I got the following error:
11 May 2015 17:39:19,857 INFO [qtp-client-14267] AbstractResourceProvider:473 - Initiating finalization for manual upgrade to version 2.2.4.2-2 for cluster GANESH_DEV 11 May 2015 17:39:19,861 INFO [qtp-client-14267] AbstractResourceProvider:501 - Finalize output: 11 May 2015 17:39:19,862 INFO [qtp-client-14267] AbstractResourceProvider:502 - STDOUT: Begin finalizing the upgrade of cluster GANESH_DEV to version 2.2.4.2-2 The following 3 host(s) have not been upgraded to version 2.2.4.2-2. Please install and upgrade the Stack Version on those hosts and try again. Hosts: bt1svlmw.bpa.bouyguestelecom.fr, bt1svlmy.bpa.bouyguestelecom.fr, bt1svlmx.bpa.bouyguestelecom.fr 11 May 2015 17:39:19,862 INFO [qtp-client-14267] AbstractResourceProvider:503 - STDERR: The following 3 host(s) have not been upgraded to version 2.2.4.2-2. Please install and upgrade the Stack Version on those hosts and try again. Hosts: bt1svlmw.bpa.bouyguestelecom.fr, bt1svlmy.bpa.bouyguestelecom.fr, bt1svlmx.bpa.bouyguestelecom.fr
In the ambari table, select * from host_version; gives :
id | repo_version_id | host_name | state ----+-----------------+---------------------------------+----------- 1 | 1 | bt1svlmw.bpa.bouyguestelecom.fr | UPGRADING 2 | 1 | bt1svlmx.bpa.bouyguestelecom.fr | UPGRADING 3 | 1 | bt1svlmy.bpa.bouyguestelecom.fr | UPGRADING
Looking at the java code of ambari (FinalizeUpgradeAction),
// If true, then the cluster version is still in UPGRADING and allowed to transition to UPGRADED, and then CURRENT boolean atLeastOneHostInInstalledState = false; // It is important to only iterate over the hosts with a version, as opposed to all hosts, since some hosts // may only have components that do not advertise a version, such as AMBARI_METRICS. for (HostVersionEntity hostVersion : hostVersions) { boolean isStateCorrect = false; if (RepositoryVersionState.UPGRADED == hostVersion.getState()) { isStateCorrect = true; } else { if (hostVersion.getState() == RepositoryVersionState.INSTALLED) { // It is possible that the host version has a state of INSTALLED and it never changed if the host only has // components that do not advertise a version. HostEntity host = hostVersion.getHostEntity(); ServiceComponentHostSummary hostSummary = new ServiceComponentHostSummary( ambariMetaInfo, host, clusterDesiredStackId); if (hostSummary.haveAllComponentsFinishedAdvertisingVersion()){ isStateCorrect = true; atLeastOneHostInInstalledState = true; } } } if (isStateCorrect) { hostVersionsAllowed.add(hostVersion); hostsToUpdate.add(hostVersion.getHostName()); } else { hostsWithoutCorrectVersionState.add(hostVersion.getHostName()); } } if (hostsWithoutCorrectVersionState.size() > 0) { String message = String.format("The following %d host(s) have not been upgraded to version %s. " + "Please install and upgrade the Stack Version on those hosts and try again.\nHosts: %s\n", hostsWithoutCorrectVersionState.size(), version, StringUtils.join(hostsWithoutCorrectVersionState, ", ")); outSB.append(message); throw new AmbariException(message); } checkHostComponentVersions(cluster, version, clusterDesiredStackId); // May need to first transition to UPGRADED if (atLeastOneHostInInstalledState) { cluster.transitionClusterVersion(clusterDesiredStackId, version, RepositoryVersionState.UPGRADED); upgradingClusterVersion = clusterVersionDAO.findByClusterAndStackAndVersion( clusterName, clusterDesiredStackId, version); } if (RepositoryVersionState.UPGRADED != upgradingClusterVersion.getState()) { throw new AmbariException(String.format("The cluster stack version state %s is not allowed to transition directly into %s", upgradingClusterVersion.getState(), RepositoryVersionState.CURRENT.toString())); }
I see that I need to have components in UPGRADED or INSTALLED state, which is not my case despite the upgrade script I’ve launched.
BTW, the part that tries to change the state from UPGRADING to UPGRADED is dead code, as an exception will be thrown each time an non UPGRADED/INSTALLED state is met…
This code is therefore very suspicious, and I wonder how to finalize my upgrade.
I could update the state in the sql table, but will I miss something important then? (the dead cluster.transitionClusterVersion(clusterDesiredStackId, version, RepositoryVersionState.UPGRADED);
)