Solr
  1. Solr
  2. SOLR-8215

SolrCloud can select a core not in active state for querying

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4
    • Component/s: None
    • Labels:
      None

      Description

      A query can be served by a core which is not in active state if the request hits the node which hosts these non active cores.

      We explicitly check for only active cores to search against in CloudSolrClient#sendRequest Line 1043 on trunk.

      But we don't check this if someone uses the REST APIs

      HttpSolrCall#getCoreByCollection should only pick cores which are active on line 794 on trunk.

      We however check it on line 882/883 in HttpSolrCall, when we try to find cores on other nodes when it's not present locally.

      So let's fix HttpSolrCall#getCoreByCollection to make the active check as well.

      1. SOLR-8215.patch
        15 kB
        Varun Thacker
      2. SOLR-8215.patch
        8 kB
        Varun Thacker

        Activity

        Hide
        Mark Miller added a comment -

        Would be great if we could get a test that could catch this.

        Show
        Mark Miller added a comment - Would be great if we could get a test that could catch this.
        Hide
        Varun Thacker added a comment -

        I was just working on one

        Patch which only allows incoming requests against a collection to be served by a local core if it's in active state.

        The test fails without the fix to HttpSolrCall.

        Show
        Varun Thacker added a comment - I was just working on one Patch which only allows incoming requests against a collection to be served by a local core if it's in active state. The test fails without the fix to HttpSolrCall.
        Hide
        Mark Miller added a comment -

        Cool, good catch!

        Patch LGTM.

        Show
        Mark Miller added a comment - Cool, good catch! Patch LGTM.
        Hide
        Varun Thacker added a comment -

        Thanks Mark for the review!

        I'll commit this shortly.

        Show
        Varun Thacker added a comment - Thanks Mark for the review! I'll commit this shortly.
        Hide
        Ishan Chattopadhyaya added a comment - - edited

        I'm just wondering if this would mean that if a replica gets marked as down (due to bugs / by mistake), one wouldn't be able to issue core admin commands to bring it back up if this patch (and please correct me if I misunderstand this) short circuits the requests at the HttpSolrCall layer. One such command is under discussion / development in SOLR-7569 (last few comments), which will let the replica change its last published state. I'm not suggesting right away that we don't do this patch, but do you have any thoughts around it (and recovery of such replicas, in general)? Fyi, Mark Miller.

        Show
        Ishan Chattopadhyaya added a comment - - edited I'm just wondering if this would mean that if a replica gets marked as down (due to bugs / by mistake), one wouldn't be able to issue core admin commands to bring it back up if this patch (and please correct me if I misunderstand this) short circuits the requests at the HttpSolrCall layer. One such command is under discussion / development in SOLR-7569 (last few comments), which will let the replica change its last published state. I'm not suggesting right away that we don't do this patch, but do you have any thoughts around it (and recovery of such replicas, in general)? Fyi, Mark Miller .
        Hide
        Varun Thacker added a comment -

        Hi Ishan,

        This code is only triggered when we issue a request against a collection. So for example /gettingstarted/update/ or /gettingstarted/select . It should not effect any core admin / collection api calls.

        Show
        Varun Thacker added a comment - Hi Ishan, This code is only triggered when we issue a request against a collection. So for example /gettingstarted/update/ or /gettingstarted/select . It should not effect any core admin / collection api calls.
        Hide
        Ishan Chattopadhyaya added a comment -

        Ah, I knew I was missing something. Sorry for the noise, please go ahead!

        Show
        Ishan Chattopadhyaya added a comment - Ah, I knew I was missing something. Sorry for the noise, please go ahead!
        Hide
        Varun Thacker added a comment -

        Some tweaks to the patch:

        • Moved verifyReplicaStatus to AbstractDistribZkTestBase so that it can be reused.
        • SolrCore core = cores.getCore(leader.getStr(ZkStateReader.CORE_NAME_PROP)); in the previous patch was causing the test code to leave the core open hence the test was failing. It was weird that running the tests from the IDE never hit this . So that code is fixed
        Show
        Varun Thacker added a comment - Some tweaks to the patch: Moved verifyReplicaStatus to AbstractDistribZkTestBase so that it can be reused. SolrCore core = cores.getCore(leader.getStr(ZkStateReader.CORE_NAME_PROP)); in the previous patch was causing the test code to leave the core open hence the test was failing. It was weird that running the tests from the IDE never hit this . So that code is fixed
        Hide
        ASF subversion and git services added a comment -

        Commit 1712601 from Varun Thacker in branch 'dev/trunk'
        [ https://svn.apache.org/r1712601 ]

        SOLR-8215: Only active replicas should handle incoming requests against a collection

        Show
        ASF subversion and git services added a comment - Commit 1712601 from Varun Thacker in branch 'dev/trunk' [ https://svn.apache.org/r1712601 ] SOLR-8215 : Only active replicas should handle incoming requests against a collection
        Hide
        ASF subversion and git services added a comment -

        Commit 1712614 from Varun Thacker in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1712614 ]

        SOLR-8215: Only active replicas should handle incoming requests against a collection (merged trunk 1712601)

        Show
        ASF subversion and git services added a comment - Commit 1712614 from Varun Thacker in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1712614 ] SOLR-8215 : Only active replicas should handle incoming requests against a collection (merged trunk 1712601)
        Hide
        Varun Thacker added a comment -

        Thanks Mark for the review!

        Show
        Varun Thacker added a comment - Thanks Mark for the review!
        Hide
        ASF subversion and git services added a comment -

        Commit 1712658 from Varun Thacker in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1712658 ]

        SOLR-8215: fixed typo. Class name is back to TestRandomRequestDistribution

        Show
        ASF subversion and git services added a comment - Commit 1712658 from Varun Thacker in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1712658 ] SOLR-8215 : fixed typo. Class name is back to TestRandomRequestDistribution

          People

          • Assignee:
            Varun Thacker
            Reporter:
            Varun Thacker
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development