Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9199

ZkController#publishAndWaitForDownStates logic is inefficient

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.2, master (7.0)
    • Component/s: None
    • Labels:
      None

      Description

      The following logic introduced as part of SOLR-8720 is inefficient.

      https://github.com/apache/lucene-solr/blob/6c0331b8309603eaaf14b6677afba5ffe99f16a3/solr/core/src/java/org/apache/solr/cloud/ZkController.java#L687-L712

      Specifically,

      • foundStates flag is set to TRUE before the for loop.
      • In the for loop we check if any replica on this node is not in the DOWN state. If yes, then foundStates = FALSE
      • If foundStates == TRUE then we break out of the loop and return.

      The problem here is that once foundStates is set to FALSE, it is never reset to TRUE. Hence we end up spending the whole 60 secs iterating over the collections even though all the replicas are marked as DOWN in later iterations.

      1. SOLR-9199.patch
        1 kB
        Hrishikesh Gadre

        Activity

        Hide
        hgadre Hrishikesh Gadre added a comment -

        Please find the attached patch.

        Show
        hgadre Hrishikesh Gadre added a comment - Please find the attached patch.
        Hide
        dragonsinth Scott Blum added a comment -

        LGTM

        Show
        dragonsinth Scott Blum added a comment - LGTM
        Hide
        gchanan Gregory Chanan added a comment -

        lgtm. Could maybe quibble that the old code wouldn't print "timing out" if it never entered the loop (e.g. if wait time was 0), but that doesn't seem right or wrong.

        I'll commit to trunk and 6.x assuming the precommit and tests pass.

        Show
        gchanan Gregory Chanan added a comment - lgtm. Could maybe quibble that the old code wouldn't print "timing out" if it never entered the loop (e.g. if wait time was 0), but that doesn't seem right or wrong. I'll commit to trunk and 6.x assuming the precommit and tests pass.
        Hide
        gchanan Gregory Chanan added a comment -

        Precommit succeeded for me, will commit in the morning.

        Show
        gchanan Gregory Chanan added a comment - Precommit succeeded for me, will commit in the morning.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit d55cc8f293aec4ccc882b1a92ed450c9ec3877dc in lucene-solr's branch refs/heads/master from Gregory Chanan
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=d55cc8f ]

        SOLR-9199: ZkController#publishAndWaitForDownStates logic is inefficient

        Show
        jira-bot ASF subversion and git services added a comment - Commit d55cc8f293aec4ccc882b1a92ed450c9ec3877dc in lucene-solr's branch refs/heads/master from Gregory Chanan [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=d55cc8f ] SOLR-9199 : ZkController#publishAndWaitForDownStates logic is inefficient
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 360d9c40da4cc1f86f080b4f2c7410da6fbc2195 in lucene-solr's branch refs/heads/branch_6x from Gregory Chanan
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=360d9c4 ]

        SOLR-9199: ZkController#publishAndWaitForDownStates logic is inefficient

        Show
        jira-bot ASF subversion and git services added a comment - Commit 360d9c40da4cc1f86f080b4f2c7410da6fbc2195 in lucene-solr's branch refs/heads/branch_6x from Gregory Chanan [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=360d9c4 ] SOLR-9199 : ZkController#publishAndWaitForDownStates logic is inefficient
        Hide
        mikemccand Michael McCandless added a comment -

        Bulk close resolved issues after 6.2.0 release.

        Show
        mikemccand Michael McCandless added a comment - Bulk close resolved issues after 6.2.0 release.

          People

          • Assignee:
            hgadre Hrishikesh Gadre
            Reporter:
            hgadre Hrishikesh Gadre
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development