From dev-return-60837-apmail-storm-dev-archive=storm.apache.org@storm.apache.org Wed Oct 2 19:28:43 2019 Return-Path: X-Original-To: apmail-storm-dev-archive@minotaur.apache.org Delivered-To: apmail-storm-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with SMTP id 6421418F11 for ; Wed, 2 Oct 2019 19:28:43 +0000 (UTC) Received: (qmail 99762 invoked by uid 500); 2 Oct 2019 19:28:41 -0000 Delivered-To: apmail-storm-dev-archive@storm.apache.org Received: (qmail 99718 invoked by uid 500); 2 Oct 2019 19:28:41 -0000 Mailing-List: contact dev-help@storm.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@storm.apache.org Delivered-To: mailing list dev@storm.apache.org Received: (qmail 99707 invoked by uid 99); 2 Oct 2019 19:28:41 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Oct 2019 19:28:41 +0000 From: GitBox To: dev@storm.apache.org Subject: [GitHub] [storm] agresch commented on a change in pull request #3133: STORM-3516 Kill or Rebalance Topology not processed on Nimbus restart Message-ID: <157004452166.22996.7546175047006877124.gitbox@gitbox.apache.org> Date: Wed, 02 Oct 2019 19:28:41 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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