public ControllerStarter(ControllerConf conf) { LOGGER.info("Trying to init ControllerStarter with config: {}", conf); _config = conf; _managerControllerHelix = new ManagerControllerHelix(_config); }
public void handleRouteAssignmentEvent(String srcCluster, String dstCluster, String routePartition, String toState) { synchronized (_handlerLock) { if (toState.equals("ONLINE")) { handleRouteAssignmentOnline(srcCluster, dstCluster, routePartition); } else if (toState.equals("OFFLINE")) { handleRouteAssignmentOffline(srcCluster, dstCluster, routePartition); } else if (toState.equals("DROPPED")) { handleRouteAssignmentDropped(srcCluster, dstCluster, routePartition); } else { LOGGER.error("Invalid route assignement state {}", toState); } } }
private boolean handleTopicAssignmentDropped(String topic, String srcCluster, String dstCluster) { return handleTopicAssignmentOffline(topic, srcCluster, dstCluster); }
"Controller is not started yet. Start a new instance: srcCluster={}, dstCluster={}, routePartition={}", srcCluster, dstCluster, routePartition); handleRouteAssignmentOnline(srcCluster, dstCluster, routePartition); return handleTopicAssignmentOnline(topic, srcCluster, dstCluster); } else if (toState.equals("OFFLINE")) { return handleTopicAssignmentOffline(topic, srcCluster, dstCluster); } else if (toState.equals("DROPPED")) { return handleTopicAssignmentDropped(topic, srcCluster, dstCluster); } else { String msg = "Invalid topic assignement state: " + toState;
public void stop() { if (_controllerInstance != null) { LOGGER.info("stopping controller instance"); if (_controllerInstance.stop()) { _controllerInstance = null; } else { LOGGER.error("Failed to stop controller instance"); } } if (_config.isFederatedEnabled()) { if (_managerControllerHelix.getControllerInstance() != null) { LOGGER.info("stopping federated controller instance"); _managerControllerHelix.getControllerInstance().stop(); } LOGGER.info("stopping Manager-Controller Helix"); _managerControllerHelix.stop(); shutdownLatch.countDown(); } }
private void handleStateChange(Message message) { if (message.getResourceName().startsWith(SEPARATOR)) { String[] srcDest = message.getResourceName().split(SEPARATOR); if (srcDest.length == 3) { _controllerHelix.handleRouteAssignmentEvent(srcDest[1], srcDest[2], message.getPartitionName(), message.getToState()); } else { String msg = String.format("Invalid resource name for route: resource=%s, partition=%s", message.getResourceName(), message.getPartitionName()); LOGGER.error(msg); throw new IllegalArgumentException(msg); } } else { String[] srcDest = message.getPartitionName().split(SEPARATOR); if (srcDest.length == 4) { _controllerHelix.handleTopicAssignmentEvent(message.getResourceName(), srcDest[1], srcDest[2], srcDest[3], message.getToState()); } else { String msg = String.format("Invalid partition name for topic: resource=%s, partition=%s", message.getResourceName(), message.getPartitionName()); LOGGER.error(msg); throw new IllegalArgumentException(msg); } } } }
+ " in federated uReplicator"); if (!_managerControllerHelix.handleTopicAssignmentEvent(topicName, srcCluster, dstCluster, routeId, "OFFLINE")) { getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); String resp = String.format("Failed to blacklist topic: %s, src=%s, dst=%s, routeid=%s",
private boolean handleRouteAssignmentDropped(String srcCluster, String dstCluster, String routePartition) { return handleRouteAssignmentOffline(srcCluster, dstCluster, routePartition); }
+ " in federated uReplicator"); if (!_managerControllerHelix.handleTopicAssignmentEvent(topicName, srcCluster, dstCluster, routeId, "ONLINE")) { getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); String resp = String.format("Failed to add new topic: %s, src=%s, dst=%s, routeid=%s",