@@ -985,11 +985,20 @@ private static Map<String, SupervisorDetails> basicSupervisorDetailsMap(IStormCl
985985 String id = entry .getKey ();
986986 SupervisorInfo info = entry .getValue ();
987987 ret .put (id , new SupervisorDetails (id , info .get_server_port (), info .get_hostname (),
988- info .get_scheduler_meta (), null , info .get_resources_map ()));
988+ info .get_scheduler_meta (), null , info .get_resources_map (),
989+ supervisorUptimeSecs (info )));
989990 }
990991 return ret ;
991992 }
992993
994+ private static long supervisorUptimeSecs (SupervisorInfo info ) {
995+ // An unset uptime maps to 0L (not the Long.MAX_VALUE default the bare SupervisorDetails constructors use) so a
996+ // freshly (re)registered supervisor is treated as just-returned and must accrue real uptime before
997+ // Cluster#hasMinimumIdleSupervisorStability lets the idle rebalance place workers on it -- the conservative
998+ // choice on the production path.
999+ return info .is_set_uptime_secs () ? info .get_uptime_secs () : 0L ;
1000+ }
1001+
9931002 /**
9941003 * NOTE: this can return false when a topology has just been activated. The topology may still be
9951004 * in the STORMS_SUBTREE.
@@ -2273,7 +2282,8 @@ private Map<String, SupervisorDetails> readAllSupervisorDetails(Map<String, Set<
22732282 List <SupervisorDetails > superDetails = new ArrayList <>();
22742283 for (Entry <String , SupervisorInfo > entry : superInfos .entrySet ()) {
22752284 SupervisorInfo info = entry .getValue ();
2276- superDetails .add (new SupervisorDetails (entry .getKey (), info .get_meta (), info .get_resources_map ()));
2285+ superDetails .add (new SupervisorDetails (entry .getKey (), info .get_meta (), info .get_resources_map (),
2286+ supervisorUptimeSecs (info )));
22772287 }
22782288 // Note that allSlotsAvailableForScheduling
22792289 // only uses the supervisor-details. The rest of the arguments
@@ -2306,7 +2316,7 @@ private Map<String, SupervisorDetails> readAllSupervisorDetails(Map<String, Set<
23062316 allPorts .removeAll (deadPorts );
23072317 }
23082318 ret .put (superId , new SupervisorDetails (superId , hostname , info .get_scheduler_meta (),
2309- allPorts , info .get_resources_map ()));
2319+ allPorts , info .get_resources_map (), supervisorUptimeSecs ( info ) ));
23102320 }
23112321 return ret ;
23122322 }
@@ -5526,4 +5536,3 @@ public void run() {
55265536 }
55275537 }
55285538}
5529-
0 commit comments