Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions storm-client/src/jvm/org/apache/storm/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,6 @@ public class Config extends HashMap<String, Object> {
@IsInteger
@IsPositiveNumber
public static final String TOPOLOGY_RAS_CONSTRAINT_MAX_STATE_SEARCH = "topology.ras.constraint.max.state.search";
/**
* The maximum number of states that will be searched looking for a solution in the constraint solver strategy.
* Backward compatibility config value for old topologies
*/
@IsInteger
@IsPositiveNumber
public static final String TOPOLOGY_RAS_CONSTRAINT_MAX_STATE_TRAVERSAL = "topology.ras.constraint.max.state.traversal";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was introduced by mistake #3056. We have this config on 0.10 storm in internal mirrors. But this is not an issue on community Storm codebase

/**
* The maximum number of seconds to spend scheduling a topology using the constraint solver. Null means no limit.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,24 +248,11 @@ public SchedulingResult schedule(Cluster cluster, TopologyDetails td) {
Map<WorkerSlot, Set<String>> workerCompAssignment = new HashMap<>();
Map<RAS_Node, Set<String>> nodeCompAssignment = new HashMap<>();

//set max number of states to search maintaining backward compatibility for old topologies
String stormVersionString = td.getTopology().get_storm_version();
boolean is2xTopology = stormVersionString != null && stormVersionString.startsWith("2");

Object confMaxStateSearch = null;
if (is2xTopology == false) {
//backward compatibility
confMaxStateSearch = td.getConf().get(Config.TOPOLOGY_RAS_CONSTRAINT_MAX_STATE_TRAVERSAL);
}
if (confMaxStateSearch == null) {
//new topology or old topology using new config
confMaxStateSearch = td.getConf().get(Config.TOPOLOGY_RAS_CONSTRAINT_MAX_STATE_SEARCH);
}
int daemonMaxStateSearch = ObjectReader.getInt(td.getConf().get(DaemonConfig.RESOURCE_AWARE_SCHEDULER_MAX_STATE_SEARCH));
final int maxStateSearch = Math.min(daemonMaxStateSearch, ObjectReader.getInt(confMaxStateSearch));
int confMaxStateSearch = ObjectReader.getInt(td.getConf().get(Config.TOPOLOGY_RAS_CONSTRAINT_MAX_STATE_SEARCH));
int daemonMaxStateSearch = ObjectReader.getInt(cluster.getConf().get(DaemonConfig.RESOURCE_AWARE_SCHEDULER_MAX_STATE_SEARCH));
final int maxStateSearch = Math.min(daemonMaxStateSearch, confMaxStateSearch);

final long maxTimeMs =
ObjectReader.getInt(td.getConf().get(Config.TOPOLOGY_RAS_CONSTRAINT_MAX_TIME_SECS), -1).intValue() * 1000L;
final long maxTimeMs = ObjectReader.getInt(td.getConf().get(Config.TOPOLOGY_RAS_CONSTRAINT_MAX_TIME_SECS), -1) * 1000L;

favoredNodeIds = makeHostToNodeIds((List<String>) td.getConf().get(Config.TOPOLOGY_SCHEDULER_FAVORED_NODES));
unFavoredNodeIds = makeHostToNodeIds((List<String>) td.getConf().get(Config.TOPOLOGY_SCHEDULER_UNFAVORED_NODES));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,25 @@ public TopologyDetails makeTopology(Map<String, Object> config, int boltParallel
return genTopology("testTopo", config, 1, 4, 4, boltParallel, 0, 0, "user");
}

public Cluster makeCluster(TopologyDetails topo) {
Topologies topologies = new Topologies(topo);
Map<String, SupervisorDetails> supMap = genSupervisors(4, 2, 120, 1200);
return new Cluster(new INimbusTest(), new ResourceMetrics(new StormMetricsRegistry()), supMap, new HashMap<>(), topologies, new Config());
public Cluster makeCluster(Topologies topologies) {
return makeCluster(topologies, null);
}

public Cluster makeCluster(Topologies topologies, Map<String, SupervisorDetails> supMap) {
if (supMap == null) {
supMap = genSupervisors(4, 2, 120, 1200);
}
Map<String, Object> config = Utils.readDefaultConfig();
return new Cluster(new INimbusTest(), new ResourceMetrics(new StormMetricsRegistry()), supMap, new HashMap<>(), topologies, config);
}

public void basicUnitTestWithKillAndRecover(ConstraintSolverStrategy cs, int boltParallel) {
Map<String, Object> config = makeTestTopoConf();
cs.prepare(config);

TopologyDetails topo = makeTopology(config, boltParallel);
Cluster cluster = makeCluster(topo);
Topologies topologies = new Topologies(topo);
Cluster cluster = makeCluster(topologies);

LOG.info("Scheduling...");
SchedulingResult result = cs.schedule(cluster, topo);
Expand Down Expand Up @@ -164,7 +171,8 @@ public void basicFailureTest(String confKey, Object confValue, ConstraintSolverS
cs.prepare(config);

TopologyDetails topo = makeTopology(config, NORMAL_BOLT_PARALLEL);
Cluster cluster = makeCluster(topo);
Topologies topologies = new Topologies(topo);
Cluster cluster = makeCluster(topologies);

LOG.info("Scheduling...");
SchedulingResult result = cs.schedule(cluster, topo);
Expand Down Expand Up @@ -196,8 +204,6 @@ protected SolverResult backtrackSearch(SearcherState state) {

@Test
public void testIntegrationWithRAS() {
Map<String, SupervisorDetails> supMap = genSupervisors(30, 16, 400, 1024 * 4);

List<List<String>> constraints = new LinkedList<>();
addContraints("spout-0", "bolt-0", constraints);
addContraints("bolt-1", "bolt-1", constraints);
Expand All @@ -206,8 +212,6 @@ public void testIntegrationWithRAS() {
spread.add("spout-0");

Map<String, Object> config = Utils.readDefaultConfig();
config.put(DaemonConfig.RESOURCE_AWARE_SCHEDULER_PRIORITY_STRATEGY, DefaultSchedulingPriorityStrategy.class.getName());
config.put(DaemonConfig.RESOURCE_AWARE_SCHEDULER_MAX_STATE_SEARCH, MAX_TRAVERSAL_DEPTH);
config.put(Config.TOPOLOGY_SCHEDULER_STRATEGY, ConstraintSolverStrategy.class.getName());
config.put(Config.TOPOLOGY_SPREAD_COMPONENTS, spread);
config.put(Config.TOPOLOGY_RAS_CONSTRAINTS, constraints);
Expand All @@ -222,7 +226,8 @@ public void testIntegrationWithRAS() {
Map<String, TopologyDetails> topoMap = new HashMap<>();
topoMap.put(topo.getId(), topo);
Topologies topologies = new Topologies(topoMap);
Cluster cluster = new Cluster(new INimbusTest(), new ResourceMetrics(new StormMetricsRegistry()), supMap, new HashMap<>(), topologies, config);
Map<String, SupervisorDetails> supMap = genSupervisors(30, 16, 400, 1024 * 4);
Cluster cluster = makeCluster(topologies, supMap);
ResourceAwareScheduler rs = new ResourceAwareScheduler();
rs.prepare(config);
try {
Expand Down