You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2013/12/26 16:30:42 UTC
svn commit: r1553498 - in /lucene/dev/branches/branch_4x: ./ solr/
solr/CHANGES.txt solr/core/
solr/core/src/java/org/apache/solr/cloud/ZkController.java
solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
Author: shalin
Date: Thu Dec 26 15:30:42 2013
New Revision: 1553498
URL: http://svn.apache.org/r1553498
Log:
SOLR-5567: ZkController getHostAddress duplicates url prefix
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_4x/solr/core/ (props changed)
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/ZkController.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1553498&r1=1553497&r2=1553498&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Thu Dec 26 15:30:42 2013
@@ -177,6 +177,9 @@ Bug Fixes
* SOLR-5562: ConcurrentUpdateSolrServer constructor ignores supplied httpclient.
(Kyle Halliday via Mark Miller)
+
+* SOLR-5567: ZkController getHostAddress duplicates url prefix.
+ (Kyle Halliday, Alexey Serba, shalin)
Optimizations
----------------------
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/ZkController.java?rev=1553498&r1=1553497&r2=1553498&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/cloud/ZkController.java Thu Dec 26 15:30:42 2013
@@ -477,10 +477,7 @@ public final class ZkController {
host = "http://" + hostaddress;
} else {
Matcher m = URL_PREFIX.matcher(host);
- if (m.matches()) {
- String prefix = m.group(1);
- host = prefix + host;
- } else {
+ if (!m.matches()) {
host = "http://" + host;
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java?rev=1553498&r1=1553497&r2=1553498&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java Thu Dec 26 15:30:42 2013
@@ -32,9 +32,11 @@ import org.junit.BeforeClass;
import org.junit.Test;
import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeoutException;
@Slow
public class ZkControllerTest extends SolrTestCaseJ4 {
@@ -255,6 +257,46 @@ public class ZkControllerTest extends So
}
+ @Test
+ public void testGetHostName() throws Exception {
+ String zkDir = dataDir.getAbsolutePath() + File.separator
+ + "zookeeper/server1/data";
+ CoreContainer cc = null;
+
+ ZkTestServer server = new ZkTestServer(zkDir);
+ try {
+ server.run();
+
+ AbstractZkTestCase.tryCleanSolrZkNode(server.getZkHost());
+ AbstractZkTestCase.makeSolrZkNode(server.getZkHost());
+
+ cc = getCoreContainer();
+ ZkController zkController = null;
+
+ try {
+ zkController = new ZkController(cc, server.getZkAddress(), TIMEOUT, 10000,
+ "http://127.0.0.1", "8983", "solr", 0, true, new CurrentCoreDescriptorProvider() {
+
+ @Override
+ public List<CoreDescriptor> getCurrentDescriptors() {
+ // do nothing
+ return null;
+ }
+ });
+ } catch (IllegalArgumentException e) {
+ fail("ZkController did not normalize host name correctly");
+ } finally {
+ if (zkController != null)
+ zkController.close();
+ }
+ } finally {
+ if (cc != null) {
+ cc.shutdown();
+ }
+ server.shutdown();
+ }
+ }
+
private CoreContainer getCoreContainer() {
CoreContainer cc = new CoreContainer(solrHomeDirectory.getAbsolutePath());
cc.load();