Github user danny0405 commented on the issue:

    https://github.com/apache/storm/pull/1874
  
    @arunmahadevan thx for your nice review, i have checked the code
    
    The fact is that, now for storm, we will pass in a `:scratch-topology-id` 
to execute mk-assignments function for rebalance command, thus, nimbus will 
just ignore the old assignment for the rebalanced topology. Finally, it will 
get a new storm-id and totally new assignment on cluster.
    
    When supervisor feels this, it will kill all the old workers for the 
rebalanced topology, and launch new. In other words, the rebalanced topology 
and the old one are totally two different topologies to nimbus and cluster. 
Storm doesn't keep any state and just kill the old worker after the wait time 
we passed in [from rebalance command].
    
    So, the problem you suggest doesn't exist. The rebalance command is just 
like a composite of kill and submit command.
    
    Here is the code snippet:
    
    ```java
    (defn do-rebalance [nimbus storm-id status storm-base]
      (let [rebalance-options (:topology-action-options storm-base)]
        (.update-storm! (:storm-cluster-state nimbus)
          storm-id
            (-> {:topology-action-options nil}
              (assoc-non-nil :component->executors (:component->executors 
rebalance-options))
              (assoc-non-nil :num-workers (:num-workers rebalance-options))))
      (mk-assignments nimbus :scratch-topology-id storm-id))
    
    (defnk mk-assignments [nimbus :scratch-topology-id nil]
      (if (is-leader nimbus :throw-exception false)
        (let [conf (:conf nimbus)
            storm-cluster-state (:storm-cluster-state nimbus)
            ^INimbus inimbus (:inimbus nimbus)
            ;; read all the topologies
            topologies (locking (:submit-lock nimbus) (into {} (for [tid 
(.active-storms storm-cluster-state)]
                                  {tid (read-topology-details nimbus tid)})))
            topologies (Topologies. topologies)
            ;; read all the assignments
            assigned-topology-ids (.assignments storm-cluster-state nil)
            existing-assignments (into {} (for [tid assigned-topology-ids]
                                            ;; for the topology which wants 
rebalance (specified by the scratch-topology-id)
                                            ;; we exclude its assignment, 
meaning that all the slots occupied by its assignment
                                            ;; will be treated as free slot in 
the scheduler code.
                                            (when (or (nil? 
scratch-topology-id) (not= tid scratch-topology-id))
                                              {tid (.assignment-info 
storm-cluster-state tid nil)})))]`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to