Github user yveschina commented on a diff in the pull request:

    https://github.com/apache/incubator-storm/pull/61#discussion_r11474408
  
    --- Diff: storm-core/src/clj/backtype/storm/daemon/nimbus.clj ---
    @@ -894,10 +895,47 @@
       )
     )
     
    +(defn- sync-storm-code-from-leader [nimbus]
    +  (let [conf (:conf nimbus)
    +        storm-cluster-state (:storm-cluster-state nimbus)
    +        storm-ids (.assignments storm-cluster-state nil)
    +        storm-code-map (->> (dofor [sid storm-ids] {sid (.assignment-info 
storm-cluster-state sid nil)})
    +                            (apply merge)
    +                            (filter-val not-nil?)
    +                            (map-val :master-code-dir)
    +                            )
    +        downloaded-storm-ids (set (map #(java.net.URLDecoder/decode %) 
(read-dir-contents (master-stormdist-root conf))))
    +        tmproot (str (master-tmp-dir conf) file-path-separator (uuid))]
    +    (doseq [[storm-id master-code-dir] storm-code-map]
    +        (when (not (downloaded-storm-ids storm-id))
    +          (log-message "Downloading code for storm id " storm-id " from " 
master-code-dir)
    +          
    +          (FileUtils/forceMkdir (File. tmproot))
    +          (Utils/downloadFromMaster conf (master-stormjar-path 
master-code-dir) (master-stormjar-path tmproot))
    +          (Utils/downloadFromMaster conf (master-stormcode-path 
master-code-dir) (master-stormcode-path tmproot))
    +          (Utils/downloadFromMaster conf (master-stormconf-path 
master-code-dir) (master-stormconf-path tmproot))
    +          (FileUtils/moveDirectory (File. tmproot) (File. 
(master-stormdist-root conf storm-id)))
    +          
    +          (log-message "Finished downloading code for storm id " storm-id 
" from " master-code-dir)
    +         )
    +     )
    +  )
    +)
    +
     (defserverfn service-handler [conf inimbus]
       (.prepare inimbus conf (master-inimbus-dir conf))
       (log-message "Starting Nimbus with conf " conf)
    -  (let [nimbus (nimbus-data conf inimbus)]
    +  (let [nimbus (nimbus-data conf inimbus)
    +        nimbus-leadership (nimbus-leadership conf)]
    --- End diff --
    
    About this i referred to the InterProcessMutex source code and believe that 
when networking glitch cause mutex.acquire() lose it's zk connection, an 
IOException will be throwed up by mutext.acquire() to cause this nimbus 
shutdown finally. Is there any other possibility may result in two or more 
nimbus instances?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to