SOLR-10261: Failure in replica didn't cause LIR; now it does

This commit is contained in:
Ishan Chattopadhyaya 2018-02-10 21:38:54 +05:30
parent 277097cd24
commit 1a4627d385
2 changed files with 21 additions and 2 deletions

View File

@ -197,6 +197,9 @@ Bug Fixes
* SOLR-11931: Fix contrib/ltr custom inner class feature/normaliser/model persistence. (Christine Poerschke)
* SOLR-10261: In case of in-place updates, failure in leader to follower replica update request now throws the
follower replica in leader-initiated-recovery (Ishan Chattopadhyaya, Steve Rowe)
Optimizations
----------------------

View File

@ -26,7 +26,6 @@ import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient; // jdoc
import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.common.cloud.ZkCoreNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.ModifiableSolrParams;
@ -279,7 +278,24 @@ public class SolrCmdDistributor implements Closeable {
try (HttpSolrClient client = new HttpSolrClient.Builder(req.node.getUrl()).withHttpClient(clients.getHttpClient()).build()) {
client.request(req.uReq);
} catch (Exception e) {
throw new SolrException(ErrorCode.SERVER_ERROR, "Failed synchronous update on shard " + req.node + " update: " + req.uReq , e);
try {
// if false, then the node is probably not "live" anymore
// and we do not need to send a recovery message
Throwable rootCause = SolrException.getRootCause(e);
log.error("Setting up to try to start recovery on replica {}", req.node.getUrl(), rootCause);
req.cmd.getReq().getCore().getCoreContainer().getZkController().ensureReplicaInLeaderInitiatedRecovery(
req.cmd.getReq().getCore().getCoreContainer(),
req.node.getCollection(),
req.node.getShardId(),
req.node.getNodeProps(),
req.cmd.getReq().getCore().getCoreDescriptor(),
false /* forcePublishState */
);
} catch (Exception exc) {
Throwable setLirZnodeFailedCause = SolrException.getRootCause(exc);
log.error("Leader failed to set replica " +
req.node.getUrl() + " state to DOWN due to: " + setLirZnodeFailedCause, setLirZnodeFailedCause);
}
}
return;