Source:
<code>protected void processEvent(ClusterEvent event, ResourcesStateMap resourcesStateMap) throws Exception { _eventId = event.getEventId(); HelixManager manager = event.getAttribute(AttributeName.helixmanager.name()); BaseControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES_TO_REBALANCE.name()); CurrentStateOutput currentStateOutput = event.getAttribute(AttributeName.CURRENT_STATE.name()); Map<String, Map<String, Message>> messagesToCleanUp = new HashMap<>(); if (manager == null || cache == null || resourceMap == null || currentStateOutput == null || resourcesStateMap == null) { throw new StageException("Missing attributes in event:" + event + ". Requires HelixManager|DataCache|RESOURCES|CURRENT_STATE|INTERMEDIATE_STATE"); } <START> Map<String, LiveInstance> liveInstances = cache.getLiveInstances(true); <END> Map<String, String> sessionIdMap = new HashMap<>(); for (LiveInstance liveInstance : liveInstances.values()) { sessionIdMap.put(liveInstance.getInstanceName(), liveInstance.getEphemeralOwner()); } MessageOutput output = new MessageOutput(); for (Resource resource : resourceMap.values()) { try { generateMessage(resource, cache, resourcesStateMap, currentStateOutput, manager, sessionIdMap, event.getEventType(), output, messagesToCleanUp); } catch (HelixException ex) { LogUtil.logError(logger, _eventId, "Failed to generate message for resource " + resource.getResourceName(), ex); } } if (!messagesToCleanUp.isEmpty()) { schedulePendingMessageCleanUp(messagesToCleanUp, cache.getAsyncTasksThreadPool(), manager.getHelixDataAccessor()); } event.addAttribute(AttributeName.MESSAGES_ALL.name(), output); }</code><technical_language>this create inconsistency LivInstances other places in pipeline here</technical_language>

Target:
protected void processEvent(ClusterEvent event, ResourcesStateMap resourcesStateMap) throws Exception { _eventId = event.getEventId(); HelixManager manager = event.getAttribute(AttributeName.helixmanager.name()); BaseControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES_TO_REBALANCE.name()); CurrentStateOutput currentStateOutput = event.getAttribute(AttributeName.CURRENT_STATE.name()); Map<String, Map<String, Message>> messagesToCleanUp = new HashMap<>(); if (manager == null || cache == null || resourceMap == null || currentStateOutput == null || resourcesStateMap == null) { throw new StageException("Missing attributes in event:" + event + ". Requires HelixManager|DataCache|RESOURCES|CURRENT_STATE|INTERMEDIATE_STATE"); } Map<String, LiveInstance> liveInstances = cache.getLiveInstances(); Map<String, String> sessionIdMap = new HashMap<>(); for (LiveInstance liveInstance : liveInstances.values()) { sessionIdMap.put(liveInstance.getInstanceName(), liveInstance.getEphemeralOwner()); } MessageOutput output = new MessageOutput(); for (Resource resource : resourceMap.values()) { try { generateMessage(resource, cache, resourcesStateMap, currentStateOutput, manager, sessionIdMap, event.getEventType(), output, messagesToCleanUp); } catch (HelixException ex) { LogUtil.logError(logger, _eventId, "Failed to generate message for resource " + resource.getResourceName(), ex); } } if (!messagesToCleanUp.isEmpty()) { schedulePendingMessageCleanUp(messagesToCleanUp, cache.getAsyncTasksThreadPool(), manager.getHelixDataAccessor()); } event.addAttribute(AttributeName.MESSAGES_ALL.name(), output); }