You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Dmitry Lysnichenko (JIRA)" <ji...@apache.org> on 2015/10/06 12:48:26 UTC

[jira] [Created] (AMBARI-13320) Cannot Perform RU If Ambari Server Is Not A Part of the Cluster

Dmitry Lysnichenko created AMBARI-13320:
-------------------------------------------

             Summary: Cannot Perform RU If Ambari Server Is Not A Part of the Cluster
                 Key: AMBARI-13320
                 URL: https://issues.apache.org/jira/browse/AMBARI-13320
             Project: Ambari
          Issue Type: Bug
            Reporter: Dmitry Lysnichenko
            Assignee: Dmitry Lysnichenko
         Attachments: AMBARI-13320.patch

A commit was merged into {{branch-2.1}} and {{branch-2.1.2}} which prevents a rolling upgrade from starting unless the Ambari Server is a part of the cluster. When Ambari is not a part of the cluster, a hostname is not correctly chosen for server-side actions and the following exception is thrown at upgrade time:

{code}
java.lang.NullPointerException
	at org.apache.ambari.server.actionmanager.ActionDBAccessorImpl.persistActions(ActionDBAccessorImpl.java:300)
	at org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(AmbariJpaLocalTxnInterceptor.java:68)
	at org.apache.ambari.server.actionmanager.ActionManager.sendActions(ActionManager.java:99)
	at org.apache.ambari.server.controller.internal.RequestStageContainer.persist(RequestStageContainer.java:216)
	at org.apache.ambari.server.controller.internal.UpgradeResourceProvider.createUpgrade(UpgradeResourceProvider.java:752)
	at org.apache.ambari.server.controller.internal.UpgradeResourceProvider.access$100(UpgradeResourceProvider.java:116)
	at org.apache.ambari.server.controller.internal.UpgradeResourceProvider$1.invoke(UpgradeResourceProvider.java:284)
	at org.apache.ambari.server.controller.internal.UpgradeResourceProvider$1.invoke(UpgradeResourceProvider.java:274)
	at org.apache.ambari.server.controller.internal.AbstractResourceProvider.createResources(AbstractResourceProvider.java:272)
	at org.apache.ambari.server.controller.internal.UpgradeResourceProvider.createResources(UpgradeResourceProvider.java:274)
	at org.apache.ambari.server.controller.internal.ClusterControllerImpl.createResources(ClusterControllerImpl.java:289)
{code}

The problem is the following line of code:
https://github.com/apache/ambari/blob/branch-2.1.2/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java#L1281

{code}
    String hostName = null;
    Collection<Long> hostIds = cluster.getAllHostsDesiredConfigs().keySet();
    if (!hostIds.isEmpty()) {
      Long hostId = hostIds.iterator().next();
      HostEntity hostEntity = s_hostDAO.findById(hostId);
      if (hostEntity != null) {
        hostName = hostEntity.getHostName();
      }
    }

...

    stage.addServerActionCommand(task.getImplementationClass(), Role.AMBARI_SERVER_ACTION,
        RoleCommand.EXECUTE, cluster.getClusterName(),
        new ServiceComponentHostServerActionEvent(null, System.currentTimeMillis()), commandParams,
        itemDetail, null, Integer.valueOf(1200), allowRetry,
        context.isComponentFailureAutoSkipped());
{code}

The calculated {{hostName}} is never used to construct the server-side action. The fix is simple - use the {{hostName}} when creating the action.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)