Skip to content

Update requests are not always sent to leader in solr cloud #288

Description

@anguslee

The _update method in class SolrCloud invokes Solr._update which in turn invokes SolrCloud._send_request by line 564 or 568:

return self._send_request(

return self._send_request(

This invocation would generate a randomized request to one of the nodes in solr cluster, which is likely to bypass the leader node. It takes some patch to class SolrCloud like this to work around this problem:

     def _send_request(self, method, path='', body=None, headers=None, files=None):
         # FIXME: this needs to have a maximum retry counter rather than waiting endlessly
         try:
-            return self._randomized_request(method, path, body, headers, files)
+            if 'update/' in urlparse(path).path:
+                return Solr._send_request(self, method, path, body, headers, files)
+            else:
+                return self._randomized_request(method, path, body, headers, files)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions