agresch commented on a change in pull request #3133: STORM-3516 Kill or Rebalance Topology
not processed on Nimbus restart
URL: https://github.com/apache/storm/pull/3133#discussion_r330730428
##########
File path: storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java
##########
@@ -1328,12 +1329,24 @@ public void launchServer() throws Exception {
exec.prepare();
}
- if (isLeader()) {
- for (String topoId : state.activeStorms()) {
- transition(topoId, TopologyActions.STARTUP, null);
- }
- clusterMetricSet.setActive(true);
- }
+ // Leadership coordination may be incomplete when launchServer is called. Previous
behavior did a one time check
+ // which could cause Nimbus to not process TopologyActions.STARTUP transitions.
Similar problem exists for
+ // HA Nimbus on being newly elected as leader. Change to a recurring pattern
addresses these problems.
+ timer.scheduleRecurring(3, 5,
+ () -> {
+ try {
+ boolean isLeader = isLeader();
+ if (isLeader && !wasLeader) {
+ for (String topoId : state.activeStorms()) {
Review comment:
can we make this duplicated code a common routine? performLeadershipTasks() or something
more creative?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
|