default Map<String, StormBase> topologyBases() { Map<String, StormBase> stormBases = new HashMap<>(); for (String topologyId : activeStorms()) { StormBase base = stormBase(topologyId, null); if (base != null) { //race condition with delete stormBases.put(topologyId, base); } } return stormBases; } }
private static boolean isTopologyActiveOrActivating(IStormClusterState state, String topoName) { return isTopologyActive(state, topoName) || state.activeStorms().contains(topoName); }
@Override public void run(String[] args, Map<String, Object> conf, String command) throws Exception { try (BlobStore nimbusBlobStore = ServerUtils.getNimbusBlobStore(conf, NimbusInfo.fromConf(conf), null)) { IStormClusterState stormClusterState = ClusterUtils.mkStormClusterState(conf, new ClusterStateContext(DaemonType.NIMBUS, conf)); Set<String> blobStoreTopologyIds = nimbusBlobStore.filterAndListKeys(key -> ConfigUtils.getIdFromBlobKey(key)); Set<String> activeTopologyIds = new HashSet<>(stormClusterState.activeStorms()); Sets.SetView<String> diffTopology = Sets.difference(activeTopologyIds, blobStoreTopologyIds); LOG.info("active-topology-ids [{}] blob-topology-ids [{}] diff-topology [{}]", activeTopologyIds, blobStoreTopologyIds, diffTopology); for (String corruptId : diffTopology) { stormClusterState.removeStorm(corruptId); } } }
@VisibleForTesting public static Set<String> topoIdsToClean(IStormClusterState state, BlobStore store, Map<String, Object> conf) { Set<String> ret = new HashSet<>(); ret.addAll(Utils.OR(state.heartbeatStorms(), EMPTY_STRING_LIST)); ret.addAll(Utils.OR(state.errorTopologies(), EMPTY_STRING_LIST)); ret.addAll(Utils.OR(store.storedTopoIds(), EMPTY_STRING_SET)); ret.addAll(Utils.OR(state.backpressureTopologies(), EMPTY_STRING_LIST)); ret.addAll(Utils.OR(state.idsOfTopologiesWithPrivateWorkerKeys(), EMPTY_STRING_SET)); ret = getExpiredTopologyIds(ret, conf); ret.removeAll(Utils.OR(state.activeStorms(), EMPTY_STRING_LIST)); return ret; }
for (String topoId : state.activeStorms()) { transition(topoId, TopologyActions.STARTUP, null);