lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Miller (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SOLR-4136) SolrCloud bugs when servlet context contains "/" or "_"
Date Tue, 11 Dec 2012 20:09:21 GMT

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

Mark Miller commented on SOLR-4136:
-----------------------------------

You need something along these lines:

{noformat}
Index: solr/core/src/test/org/apache/solr/cloud/OverseerCollectionProcessorTest.java
===================================================================
--- solr/core/src/test/org/apache/solr/cloud/OverseerCollectionProcessorTest.java	(revision
1420361)
+++ solr/core/src/test/org/apache/solr/cloud/OverseerCollectionProcessorTest.java	(working
copy)
@@ -35,6 +35,7 @@
 
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.cloud.ClusterState;
+import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.cloud.ZkNodeProps;
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.common.params.CoreAdminParams;
@@ -61,6 +62,7 @@
   private ShardHandler shardHandlerMock;
   private ZkStateReader zkStateReaderMock;
   private ClusterState clusterStateMock;
+  private SolrZkClient solrZkClientMock;
   
   private Thread thread;
   private Queue<byte[]> queue = new BlockingArrayQueue<byte[]>();
@@ -88,6 +90,7 @@
     shardHandlerMock = createMock(ShardHandler.class);
     zkStateReaderMock = createMock(ZkStateReader.class);
     clusterStateMock = createMock(ClusterState.class);
+    solrZkClientMock = createMock(SolrZkClient.class);
     underTest = new OverseerCollectionProcessorToBeTested(zkStateReaderMock,
         "1234", shardHandlerMock, ADMIN_PATH, workQueueMock);
   }
@@ -129,6 +132,15 @@
       }
     }).anyTimes();
     
+    zkStateReaderMock.getZkClient();
+    expectLastCall().andAnswer(new IAnswer<Object>() {
+      @Override
+      public Object answer() throws Throwable {
+        return solrZkClientMock;
+      }
+    }).anyTimes();
+    
+    
     clusterStateMock.getCollections();
     expectLastCall().andAnswer(new IAnswer<Object>() {
       @Override
@@ -138,7 +150,19 @@
     }).anyTimes();
     final Set<String> liveNodes = new HashSet<String>();
     for (int i = 0; i < liveNodesCount; i++) {
-      liveNodes.add("localhost:" + (8963 + i) + "_solr");
+      final String address = "localhost:" + (8963 + i) + "_solr";
+      liveNodes.add(address);
+      
+      solrZkClientMock.getBaseUrlForNodeName(address);
+      expectLastCall().andAnswer(new IAnswer<Object>() {
+        @Override
+        public Object answer() throws Throwable {
+          // This works as long as this test does not use a 
+          // webapp context with an underscore in it
+          return address.replaceAll("_", "/");
+        }
+      }).anyTimes();
+      
     }
     clusterStateMock.getLiveNodes();
     expectLastCall().andAnswer(new IAnswer<Object>() {
@@ -336,6 +360,7 @@
     }
     
     replay(workQueueMock);
+    replay(solrZkClientMock);
     replay(zkStateReaderMock);
     replay(clusterStateMock);
     replay(shardHandlerMock);
{noformat}
                
> SolrCloud bugs when servlet context contains "/" or "_"
> -------------------------------------------------------
>
>                 Key: SOLR-4136
>                 URL: https://issues.apache.org/jira/browse/SOLR-4136
>             Project: Solr
>          Issue Type: Bug
>          Components: SolrCloud
>    Affects Versions: 4.0
>            Reporter: Hoss Man
>            Assignee: Hoss Man
>         Attachments: SOLR-4136.patch, SOLR-4136.patch, SOLR-4136.patch, SOLR-4136.patch,
SOLR-4136.patch
>
>
> SolrCloud does not work properly with non-trivial values for "hostContext" (ie: the servlet
context path).  In particular...
> * Using a hostContext containing a  "/" (ie: a servlet context with a subdir path, semi-common
among people who organize webapps hierarchically for lod blanacer rules) is explicitly forbidden
in ZkController because of how the hostContext is used to build a ZK nodeName
> * Using a hostContext containing a "\_" causes problems in OverseerCollectionProcessor
where it assumes all "\_" characters should be converted to "/" to reconstitute a URL from
nodeName (NOTE: this code specifically has a TODO to fix this, and then has a subsequent TODO
about assuming "http://" labeled "this sucks")

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


Mime
View raw message