Github user Ethanlm commented on a diff in the pull request:
https://github.com/apache/storm/pull/2710#discussion_r208096352
--- Diff:
storm-server/src/main/java/org/apache/storm/daemon/supervisor/Slot.java ---
@@ -1147,8 +1162,19 @@ public DynamicState
withPendingLocalization(Future<Void> pendingDownload) {
*/
public DynamicState withState(final MachineState state) {
long newStartTime = Time.currentTimeMillis();
+ //We may (though unlikely) lose metering here if state
transition is too frequent (less than a millisecond)
+ workerStateDuration.get(this.state).update(newStartTime -
startTime, TimeUnit.MILLISECONDS);
+ workerStateTransition.get(state).mark();
+
+ LocalAssignment assignment = this.currentAssignment;
+ if (this.state != MachineState.RUNNING && state ==
MachineState.RUNNING
+ && this.currentAssignment instanceof
TimerDecoratedAssignment) {
+ ((TimerDecoratedAssignment) assignment).stopTiming();
+ assignment = new LocalAssignment(this.currentAssignment);
--- End diff --
A few comments would be helpful.
---