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)
The _update method in class SolrCloud invokes Solr._update which in turn invokes SolrCloud._send_request by line 564 or 568:
pysolr/pysolr.py
Line 564 in da1522f
pysolr/pysolr.py
Line 568 in da1522f
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)