I really don't remember. Yes, you don't want it to start with a /, yes it's part of the node name, but the node name should have all / turned into _.
I'd simply try it - enforce no starting / instead, turn / into _ for the name node…see what tests pass, do some manual testing… That's all I've got. - Mark On Nov 29, 2012, at 11:20 PM, Chris Hostetter <[email protected]> wrote: > > Can anyone shed some light on this code in ZkController... > > if (localHostContext.contains("/")) { > throw new IllegalArgumentException("localHostContext (" > + localHostContext + ") should not contain a /"); > } > > ...i don't really understand this limitation. There's nothing in the servlet > spec that prevents a context path from containing '/' characters -- i can for > instance modify the jetty context file that ships with solr like so and jetty > will happily run solr rooted at http://localhost:8983/solr/hoss/man ... > > > hossman@frisbee:~/lucene/dev$ svn diff solr/example/contexts/solr.xml > Index: solr/example/contexts/solr.xml > =================================================================== > --- solr/example/contexts/solr.xml (revision 1415493) > +++ solr/example/contexts/solr.xml (working copy) > @@ -1,8 +1,8 @@ > <?xml version="1.0"?> > <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" > "http://www.eclipse.org/jetty/configure.dtd"> > <Configure class="org.eclipse.jetty.webapp.WebAppContext"> > - <Set name="contextPath">/solr</Set> > + <Set name="contextPath">/solr/hoss/man</Set> > <Set name="war"><SystemProperty name="jetty.home"/>/webapps/solr.war</Set> > <Set name="defaultsDescriptor"><SystemProperty > name="jetty.home"/>/etc/webdefault.xml</Set> > <Set name="tempDirectory"><Property name="jetty.home" > default="."/>/solr-webapp</Set> > -</Configure> > \ No newline at end of file > +</Configure> > > > > My best guesses as to the intent of this code are: > > 1) that it was really ment to ensure the localHostContext didn't *start* with > a redundent "/" > > 2) that there is some reason why the nodeName shouldn't include slashes, and > the nodeName is built using the localHostContext, so the restriction > propogates. > > If it's #1 it seems like a trivial bug with an easy fix. #2 doesn't really > make sense to me -- but it may just be my ZK ignorance: Aren't nodePaths in > ZK hierarchical by nature, so shouldn't allowing "/" be fine? is there some > reason introducing multiple "sub directories" (with a single child) in ZK for > a single solr node would bad? ... if so then wouldn't a simple solution be to > URL encode the localHostContext (or escape the "/" in some other way) when > building the nodeName so that we can eliminate this limitation? > > > > > -Hoss
