-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39048/#review101712
-----------------------------------------------------------

Ship it!



ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
 (line 1283)
<https://reviews.apache.org/r/39048/#comment159175>

    Should the ServiceComponentHostServerActionEvent also take hostName instead 
of null?


- Jonathan Hurley


On Oct. 6, 2015, 6:51 a.m., Dmitro Lisnichenko wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/39048/
> -----------------------------------------------------------
> 
> (Updated Oct. 6, 2015, 6:51 a.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Mahadev Konar.
> 
> 
> Bugs: AMBARI-13320
>     https://issues.apache.org/jira/browse/AMBARI-13320
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> 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.
> 
> 
> Diffs
> -----
> 
>   
> ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
>  653419b 
> 
> Diff: https://reviews.apache.org/r/39048/diff/
> 
> 
> Testing
> -------
> 
> [INFO] Reactor Summary:
> [INFO] 
> [INFO] Ambari Views ...................................... SUCCESS [3.135s]
> [INFO] Ambari Metrics Common ............................. SUCCESS [1.544s]
> [INFO] Ambari Server ..................................... SUCCESS 
> [48:41.994s]
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 48:47.250s
> [INFO] Finished at: Tue Oct 06 13:45:47 EEST 2015
> [INFO] Final Memory: 58M/565M
> 
> 
> Thanks,
> 
> Dmitro Lisnichenko
> 
>

Reply via email to