/** * Method to handle add flow config message forwarded by Helix (Standby) node. * In load balance mode, the FlowCatalog I/O was handled on standby when receiving Restli, so only need to handle * {@link org.apache.gobblin.runtime.api.SpecCatalogListener#onDeleteSpec(URI, String, Properties)} part. * Otherwise, we have to handle both FlowCatalog I/O and {@link org.apache.gobblin.runtime.api.SpecCatalogListener#onDeleteSpec(URI, String, Properties)}. * * Please refer to {@link FlowConfigResourceLocalHandler#deleteFlowConfig(FlowId, Properties)}. It will handle both FlowCatalog I/O and * {@link org.apache.gobblin.runtime.api.SpecCatalogListener#onDeleteSpec(URI, String, Properties)} in non-balance mode. */ private void handleDelete(String msg) throws IOException { try { FlowId id = FlowConfigUtils.deserializeFlowId(msg); if (flowCatalogLocalCommit) { // in balance mode, flow spec is already deleted in flow catalog on standby node. URI flowUri = FlowConfigResourceLocalHandler.createFlowSpecUri(id); log.info("Only handle update {} scheduling because flow catalog is committed locally on standby.", flowUri); jobScheduler.onDeleteSpec(flowUri, FlowSpec.Builder.DEFAULT_VERSION); } else { resourceHandler.deleteFlowConfig(id, new Properties()); } } catch (URISyntaxException e) { throw new IOException(e); } }
/** * Delete flowConfig locally and trigger all listeners iff @param triggerListener is set to true */ public UpdateResponse deleteFlowConfig(FlowId flowId, Properties header, boolean triggerListener) throws FlowConfigLoggedException { log.info("[GAAS-REST] Delete called with flowGroup {} flowName {}", flowId.getFlowGroup(), flowId.getFlowName()); URI flowUri = null; try { flowUri = createFlowSpecUri(flowId); this.flowCatalog.remove(flowUri, header, triggerListener); return new UpdateResponse(HttpStatus.S_200_OK); } catch (URISyntaxException e) { throw new FlowConfigLoggedException(HttpStatus.S_400_BAD_REQUEST, "bad URI " + flowUri, e); } }
/** * Method to handle add flow config message forwarded by Helix (Standby) node. * In load balance mode, the FlowCatalog I/O was handled on standby when receiving Restli, so only need to handle * {@link org.apache.gobblin.runtime.api.SpecCatalogListener#onDeleteSpec(URI, String, Properties)} part. * Otherwise, we have to handle both FlowCatalog I/O and {@link org.apache.gobblin.runtime.api.SpecCatalogListener#onDeleteSpec(URI, String, Properties)}. * * Please refer to {@link FlowConfigResourceLocalHandler#deleteFlowConfig(FlowId, Properties)}. It will handle both FlowCatalog I/O and * {@link org.apache.gobblin.runtime.api.SpecCatalogListener#onDeleteSpec(URI, String, Properties)} in non-balance mode. */ private void handleDelete(String msg) throws IOException { try { FlowId id = FlowConfigUtils.deserializeFlowId(msg); if (flowCatalogLocalCommit) { // in balance mode, flow spec is already deleted in flow catalog on standby node. URI flowUri = FlowConfigResourceLocalHandler.createFlowSpecUri(id); log.info("Only handle update {} scheduling because flow catalog is committed locally on standby.", flowUri); jobScheduler.onDeleteSpec(flowUri, FlowSpec.Builder.DEFAULT_VERSION); } else { resourceHandler.deleteFlowConfig(id, new Properties()); } } catch (URISyntaxException e) { throw new IOException(e); } }