AMBARI-18302.Desired state of client component should not be changed in case configuration changes are applied through a "Restart.(Laszlo Puskas via stoader)"
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e8d1c7c9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e8d1c7c9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e8d1c7c9 Branch: refs/heads/AMBARI-2.4.0.2 Commit: e8d1c7c925b1e7e4d5adf24003a27fa3549d3760 Parents: 17b583c Author: Toader, Sebastian <[email protected]> Authored: Wed Sep 7 15:18:25 2016 +0200 Committer: Toader, Sebastian <[email protected]> Committed: Wed Sep 7 15:21:16 2016 +0200 ---------------------------------------------------------------------- .../AmbariCustomCommandExecutionHelper.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/e8d1c7c9/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java index 8c8ae10..a671f0c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java @@ -465,15 +465,20 @@ public class AmbariCustomCommandExecutionHelper { private void applyCustomCommandBackendLogic(Cluster cluster, String serviceName, String componentName, String commandName, String hostname) throws AmbariException { switch (commandName) { case "RESTART": - ServiceComponentHost serviceComponentHost = cluster.getService( - serviceName).getServiceComponent(componentName).getServiceComponentHost(hostname); - + ServiceComponent serviceComponent = cluster.getService(serviceName).getServiceComponent(componentName); + ServiceComponentHost serviceComponentHost = serviceComponent.getServiceComponentHost(hostname); State currentDesiredState = serviceComponentHost.getDesiredState(); - if (currentDesiredState != State.STARTED) { - LOG.info("Updating desired state to {} on RESTART for {}/{} because it was {}", - State.STARTED, serviceName, componentName, currentDesiredState); - serviceComponentHost.setDesiredState(State.STARTED); + if( !serviceComponent.isClientComponent()) { + if (currentDesiredState != State.STARTED) { + LOG.info("Updating desired state to {} on RESTART for {}/{} because it was {}", + State.STARTED, serviceName, componentName, currentDesiredState); + + serviceComponentHost.setDesiredState(State.STARTED); + } + } else { + LOG.debug("Desired state for client components should not be updated on RESTART. Service/Component {}/{}", + serviceName, componentName); } break;
