Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anguslee opened this issue Oct 30, 2019 · 2 comments
Open

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

anguslee opened this issue Oct 30, 2019 · 2 comments

Comments

@anguslee
Copy link

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)

@anguslee anguslee changed the title Update requests are not always sent to leader Update requests are not always sent to leader in solr cloud Oct 30, 2019
@acdha
Copy link
Collaborator

acdha commented Oct 30, 2019

If you want to send a pull request, that seems reasonable

@anguslee
Copy link
Author

I mean it's not so reasonable for update requests. I'm running a solr cloud version 6.6.3, and I found in this environment when update data are sent to a replica node, this node would forward it to leader node for indexing.So it clearly results in a waste of networking resource if the client fails to find the correct leader node to handle the update request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants