You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Timothy Potter (JIRA)" <ji...@apache.org> on 2015/03/02 17:38:04 UTC

[jira] [Commented] (SOLR-7173) Fix ReplicationFactorTest on Windows

    [ https://issues.apache.org/jira/browse/SOLR-7173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14343348#comment-14343348 ] 

Timothy Potter commented on SOLR-7173:
--------------------------------------

[~ichattopadhyaya] thanks for taking this up ... a couple of minor suggestions about your patch:

1) please add some logging around the retries

2) I've found it better to use recursion with a decrementing counter vs. nested re-try blocks so something like the following, see where I use maxRetries as a param:

{code}
protected int sendBatch(List<SolrInputDocument> batch, int waitBeforeRetry, int maxRetries) throws Exception {
    int sent = 0;
    final Timer.Context sendTimerCtxt = sendBatchToSolrTimer.time();
    try {
      UpdateRequest updateRequest = new UpdateRequest();
      ModifiableSolrParams params = updateRequest.getParams();
      if (params == null) {
        params = new ModifiableSolrParams();
        updateRequest.setParams(params);
      }
      updateRequest.add(batch);
      cloudSolrServer.request(updateRequest);
      sent = batch.size();
    } catch (Exception exc) {
      Throwable rootCause = SolrException.getRootCause(exc);
      boolean wasCommError = ...
      if (wasCommError) {
        if (--maxRetries > 0) {
          log.warn("ERROR: " + rootCause + " ... Sleeping for "
              + waitBeforeRetry + " seconds before re-try ...");
          Thread.sleep(waitBeforeRetry * 1000L);
          sent = sendBatch(batch, waitBeforeRetry, maxRetries);
        } else {
          log.error("No more retries available! Add batch failed due to: " + rootCause);
          throw exc;
        }
      }
    } finally {
      sendTimerCtxt.stop();
    }

    batch.clear();
    return sent;
  }
{code}

> Fix ReplicationFactorTest on Windows
> ------------------------------------
>
>                 Key: SOLR-7173
>                 URL: https://issues.apache.org/jira/browse/SOLR-7173
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Ishan Chattopadhyaya
>             Fix For: 5.1
>
>         Attachments: SOLR-7173.patch
>
>
> The ReplicationFactorTest fails on the Windows build with NoHttpResponseException, as seen here: http://jenkins.thetaphi.de/job/Lucene-Solr-trunk-Windows/4502/testReport/junit/org.apache.solr.cloud/ReplicationFactorTest/test/
> Adding a retry logic similar to HttpPartitionTest's doSend() method makes the test pass on Windows.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org