SOLR-9291: ZkSolrResourceLoader should not retry fetching resources if the server has been shutdown

(cherry picked from commit 42e1caf)
This commit is contained in:
Shalin Shekhar Mangar 2016-07-11 07:35:10 +05:30
parent da25555baf
commit 9d8cc80a79
3 changed files with 13 additions and 8 deletions

View File

@ -104,6 +104,9 @@ Bug Fixes
* SOLR-9236: AutoAddReplicas will append an extra /tlog to the update log location on replica failover. * SOLR-9236: AutoAddReplicas will append an extra /tlog to the update log location on replica failover.
(Eungsop Yoo, Mark Miller) (Eungsop Yoo, Mark Miller)
* SOLR-9291: ZkSolrResourceLoader should not retry fetching resources if the server has been shutdown.
(shalin)
Optimizations Optimizations
---------------------- ----------------------

View File

@ -96,13 +96,15 @@ public class ZkSolrResourceLoader extends SolrResourceLoader {
} }
} catch (KeeperException.SessionExpiredException e) { } catch (KeeperException.SessionExpiredException e) {
exception = e; exception = e;
// Retry in case of session expiry if (!zkController.getCoreContainer().isShutDown()) {
try { // Retry in case of session expiry
Thread.sleep(1000); try {
log.debug("Sleeping for 1s before retrying fetching resource=" + resource); Thread.sleep(1000);
} catch (InterruptedException ie) { log.debug("Sleeping for 1s before retrying fetching resource=" + resource);
Thread.currentThread().interrupt(); } catch (InterruptedException ie) {
throw new IOException("Could not load resource=" + resource, ie); Thread.currentThread().interrupt();
throw new IOException("Could not load resource=" + resource, ie);
}
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();

View File

@ -48,7 +48,7 @@ public class TestSolrConfigHandlerCloud extends AbstractFullDistribZkTestBase {
private void setupHarnesses() { private void setupHarnesses() {
for (final SolrClient client : clients) { for (final SolrClient client : clients) {
RestTestHarness harness = new RestTestHarness(() -> ((HttpSolrClient)client).getBaseURL()); RestTestHarness harness = new RestTestHarness(((HttpSolrClient) client)::getBaseURL);
restTestHarnesses.add(harness); restTestHarnesses.add(harness);
} }
} }