You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Russell Black (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2012/03/02 18:39:58 UTC

[jira] [Issue Comment Edited] (SOLR-3182) If there is only one core, let it be the default without specifying a default in solr.xml

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

Russell Black edited comment on SOLR-3182 at 3/2/12 5:39 PM:
-------------------------------------------------------------

bq. But then the reverse case could also be jarring when someone is able to access a core by virtue of it being default, and then that ability is suddenly removed when a new core is created.

Agreed.  An application developer would need to understand the implications of adding another core and plan accordingly in his application, or else explicitly declare a defaultCoreName in solr.xml.  
                
      was (Author: rblack):
    bq. But then the reverse case could also be jarring when someone is able to access a core by virtue of it being default, and then that ability is suddenly removed when a new core is created.

Agreed.  An application developer would need to understand the implications of adding another core and plan accordingly in his application, or else explicitly declare a core using defaultCoreName in solr.xml.  
                  
> If there is only one core, let it be the default without specifying a default in solr.xml
> -----------------------------------------------------------------------------------------
>
>                 Key: SOLR-3182
>                 URL: https://issues.apache.org/jira/browse/SOLR-3182
>             Project: Solr
>          Issue Type: Improvement
>          Components: multicore
>    Affects Versions: 3.6, 4.0
>            Reporter: Russell Black
>            Priority: Minor
>              Labels: patch
>         Attachments: SOLR-3182-default-core.patch
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> Our particular need for this is as follows.  We operate in a sharded environment with one core per server.  Each shard also acts as a collator.  We want to use a hardware load balancer to choose which shard will do the collation for each query.  But in order to do that, each server's single core would have to carry the same name so that it could be accessed by the same url across servers.  However we name the cores by their shard number (query0,query1,...) because it parallels with the way we name our indexing/master cores (index0, index1,...).  This naming convention also gives us the flexibility of moving to a multicore environment in the future without having to rename the cores, although admittedly that would complicate load balancing.  
> In a system with a large number of shards and the anticipation of adding more going forward, setting a defaultCoreName attribute in each solr.xml file becomes inconvenient, especially since there is no Solr admin API for setting defaultCoreName.  It would have to be done by hand or with some automated tool we would write in house.  Even if there were an API, logically it seems unnecessary to have to declare the only core to be the default. 
> Fortunately this behavior can be implemented with the following simple patch:
> {code}
> Index: solr/core/src/java/org/apache/solr/core/CoreContainer.java
> ===================================================================
> --- solr/core/src/java/org/apache/solr/core/CoreContainer.java	(revision 1295229)
> +++ solr/core/src/java/org/apache/solr/core/CoreContainer.java	(working copy)
> @@ -870,6 +870,10 @@
>    }
>  
>    private String checkDefault(String name) {
> +    // if there is only one core, let it be the default without specifying a default in solr.xml
> +    if (defaultCoreName.trim().length() == 0 && name.trim().length() == 0 && cores.size() == 1) {
> +      return cores.values().iterator().next().getName();
> +    }
>      return name.length() == 0  || defaultCoreName.equals(name) || name.trim().length() == 0 ? "" : name;
>    } 
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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