private void addMissingRestartDependencies() {
    Map<RoleCommandPair, Set<RoleCommandPair>> missingDependencies = new HashMap<>();
    for (Map.Entry<RoleCommandPair, Set<RoleCommandPair>> roleCommandPairSetEntry : dependencies.entrySet()) {
      RoleCommandPair roleCommandPair = roleCommandPairSetEntry.getKey();
      if (roleCommandPair.getCmd().equals(RoleCommand.START)) {
        RoleCommandPair restartPair = new RoleCommandPair(roleCommandPair.getRole(), RoleCommand.RESTART);
        if (!dependencies.containsKey(restartPair)) {
          // Assumption that if defined the RESTART deps are complete
          Set<RoleCommandPair> roleCommandDeps = new HashSet<>();
          for (RoleCommandPair rco : roleCommandPairSetEntry.getValue()) {
            // Change dependency Role to match source
            roleCommandDeps.add(new RoleCommandPair(rco.getRole(), RoleCommand.RESTART));
          }

          if (LOG.isDebugEnabled()) {
            LOG.debug("Adding dependency for {}, dependencies => {}", restartPair, roleCommandDeps);
          }
          missingDependencies.put(restartPair, roleCommandDeps);
        }
      }
    }
    if (!missingDependencies.isEmpty()) {
      dependencies.putAll(missingDependencies);
    }
  }
RoleCommand.RESTART dependencies that are missing from role_command_order.json
will be added to the RCO graph to make sure RESTART ALL type of
operations respect the RCO. Only those @{@link RoleCommandPair} will be
added which do not have any RESTART definition in the role_command_order.json
by copying dependencies from the START operation.
ambari-server/src/main/java/org/apache/ambari/server/metadata/RoleCommandOrder.java