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

Race condition in ClusterStatus.getClusterStatus

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 5.3.1
    • Fix Version/s: 5.5.1, 6.0, 6.1, 7.0
    • Component/s: SolrCloud
    • Labels:
      None

      Description

      Reading cluster state information using /collections?action=CLUSTERSTATUS can fail if there's a concurrent /collections?action=DELETE operation.

      The code in ClusterStatus.getClusterStatus

      1. gets collection names
      2. for every collection reads its cluster state info using ClusterState.getCollection

      The problem is that if there's a DELETE operation in between then ClusterState.getCollection can fail thus causing the whole operation to fail. It seems that it would be better to call ClusterState.getCollectionOrNull and skip/ignore that collection if the result is null.

      19:49:32.479 [qtp1531448569-881] ERROR org.apache.solr.core.SolrCore - org.apache.solr.common.SolrException: Could not find collection : collection
          at org.apache.solr.common.cloud.ClusterState.getCollection(ClusterState.java:165)
          at org.apache.solr.handler.admin.ClusterStatus.getClusterStatus(ClusterStatus.java:110)
          at org.apache.solr.handler.admin.CollectionsHandler$CollectionOperation$19.call(CollectionsHandler.java:614)
          at org.apache.solr.handler.admin.CollectionsHandler.handleRequestBody(CollectionsHandler.java:166)
      
      1. SOLR-8804.patch
        3 kB
        Varun Thacker
      2. SOLR-8804.patch
        2 kB
        Varun Thacker

        Issue Links

          Activity

          Hide
          varunthacker Varun Thacker added a comment -

          Patch which fixes the problem.

          Show
          varunthacker Varun Thacker added a comment - Patch which fixes the problem.
          Hide
          noble.paul Noble Paul added a comment -

          +1

          Show
          noble.paul Noble Paul added a comment - +1
          Hide
          shalinmangar Shalin Shekhar Mangar added a comment -

          This fix isn't correct. We should throw an exception only if the user specifically asked for a collection and it doesn't exist anymore because of a concurrent delete request. In case no collection was specified in the request, we should just ignore a missing collection and continue to the next one.

          Show
          shalinmangar Shalin Shekhar Mangar added a comment - This fix isn't correct. We should throw an exception only if the user specifically asked for a collection and it doesn't exist anymore because of a concurrent delete request. In case no collection was specified in the request, we should just ignore a missing collection and continue to the next one.
          Hide
          varunthacker Varun Thacker added a comment -

          Thanks Shalin for the review! Updated patch taking into account your suggestions

          Show
          varunthacker Varun Thacker added a comment - Thanks Shalin for the review! Updated patch taking into account your suggestions
          Hide
          shalinmangar Shalin Shekhar Mangar added a comment -

          +1 LGTM

          Show
          shalinmangar Shalin Shekhar Mangar added a comment - +1 LGTM
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 343d9c6fa4ccff3d997b5b8c143b839364569ae6 in lucene-solr's branch refs/heads/master from Varun Thacker
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=343d9c6 ]

          SOLR-8804: Fix a race condition in the ClusterStatus API call

          Show
          jira-bot ASF subversion and git services added a comment - Commit 343d9c6fa4ccff3d997b5b8c143b839364569ae6 in lucene-solr's branch refs/heads/master from Varun Thacker [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=343d9c6 ] SOLR-8804 : Fix a race condition in the ClusterStatus API call
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit b8e454c1daf52b4f6126c0997e4e0b75eae9e34d in lucene-solr's branch refs/heads/branch_6x from Varun Thacker
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=b8e454c ]

          SOLR-8804: Fix a race condition in the ClusterStatus API call

          Show
          jira-bot ASF subversion and git services added a comment - Commit b8e454c1daf52b4f6126c0997e4e0b75eae9e34d in lucene-solr's branch refs/heads/branch_6x from Varun Thacker [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=b8e454c ] SOLR-8804 : Fix a race condition in the ClusterStatus API call
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit c0f69138a271f7aad67e937e99a24090986612fc in lucene-solr's branch refs/heads/branch_6_0 from Varun Thacker
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=c0f6913 ]

          SOLR-8804: Fix a race condition in the ClusterStatus API call

          Show
          jira-bot ASF subversion and git services added a comment - Commit c0f69138a271f7aad67e937e99a24090986612fc in lucene-solr's branch refs/heads/branch_6_0 from Varun Thacker [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=c0f6913 ] SOLR-8804 : Fix a race condition in the ClusterStatus API call
          Hide
          varunthacker Varun Thacker added a comment -

          Thanks Alexey for reporting the issue and Noble/Shalin for the reviews!

          Show
          varunthacker Varun Thacker added a comment - Thanks Alexey for reporting the issue and Noble/Shalin for the reviews!
          Hide
          anshumg Anshum Gupta added a comment -

          back porting for 5.5.1

          Show
          anshumg Anshum Gupta added a comment - back porting for 5.5.1
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit bf8a2c7caa2350e4764a0791cbee0c6764995e76 in lucene-solr's branch refs/heads/branch_5x from Varun Thacker
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=bf8a2c7 ]

          SOLR-8804: Fix a race condition in the ClusterStatus API call

          Show
          jira-bot ASF subversion and git services added a comment - Commit bf8a2c7caa2350e4764a0791cbee0c6764995e76 in lucene-solr's branch refs/heads/branch_5x from Varun Thacker [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=bf8a2c7 ] SOLR-8804 : Fix a race condition in the ClusterStatus API call
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit a0e686d0697957fac7f85fa8b606f547e5982e36 in lucene-solr's branch refs/heads/branch_5_5 from Varun Thacker
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=a0e686d ]

          SOLR-8804: Fix a race condition in the ClusterStatus API call

          Show
          jira-bot ASF subversion and git services added a comment - Commit a0e686d0697957fac7f85fa8b606f547e5982e36 in lucene-solr's branch refs/heads/branch_5_5 from Varun Thacker [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=a0e686d ] SOLR-8804 : Fix a race condition in the ClusterStatus API call
          Hide
          hossman Hoss Man added a comment -

          Manually correcting fixVersion per Step #S6 of LUCENE-7271

          Show
          hossman Hoss Man added a comment - Manually correcting fixVersion per Step #S6 of LUCENE-7271

            People

            • Assignee:
              varunthacker Varun Thacker
              Reporter:
              alexey Alexey Serba
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development