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 (Created) (JIRA)" <ji...@apache.org> on 2012/02/29 20:33:57 UTC

[jira] [Created] (SOLR-3182) If there is only one core, let it be the default without specifying a default 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


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 1295204)
+++ solr/core/src/java/org/apache/solr/core/CoreContainer.java	(working copy)
@@ -870,6 +870,13 @@
   }
 
   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) {
+      SolrCore onlyCore = cores.get(0);
+      if(onlyCore != null) {
+        return onlyCore.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


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

Posted by "Erick Erickson (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Erick Erickson reassigned SOLR-3182:
------------------------------------

    Assignee:     (was: Erick Erickson)

Don't have time to get to this in 3.6, does someone else want to push this forward?
                
> 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


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

Posted by "Russell Black (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Russell Black updated SOLR-3182:
--------------------------------

    Attachment:     (was: SOLR-3182-default-core.patch)
    
> 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


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

Posted by "Jan Høydahl (Commented JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221393#comment-13221393 ] 

Jan Høydahl commented on SOLR-3182:
-----------------------------------

I'd prefer to avoid such "magic" inconsistent behavior.

Instead I propose that if you specify defaultCoreName="$1" it will choose the first core in the list $2 the second etc. This will keep old solr.xml's backward compatible. Sample:

{code:xml}
  <cores adminPath="/admin/cores" defaultCoreName="$1">
    <core name="myCore" instanceDir="myCore" />
  </cores>
{code}
                
> 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


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

Posted by "Mark Miller (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221043#comment-13221043 ] 

Mark Miller commented on SOLR-3182:
-----------------------------------

Seems like a reasonable idea. I'll try to play with the patch a little when I get a free moment.
                
> 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


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

Posted by "Russell Black (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221098#comment-13221098 ] 

Russell Black commented on SOLR-3182:
-------------------------------------

Perhaps the confusion you point out could be mitigated with some messaging, something like this:

{code}
private String checkDefault(String name) {
  // if there is only one core, let it be the default without specifying a default in solr.xml
  if (StringUtils.isBlank(defaultCoreName) && StringUtils.isBlank(name.trim())) {
    if (cores.size() == 1) {
      return cores.values().iterator().next().getName();
    }
    else {
      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "This server hosts multiple cores, " +
      		"but no core name was supplied in the request and no defaultCoreName was declared in solr.xml" );
    }
  }
    return StringUtils.isBlank(name) || defaultCoreName.equals(name) ? "" : name;
  } 
{code}
                
> 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


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

Posted by "Russell Black (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221079#comment-13221079 ] 

Russell Black commented on SOLR-3182:
-------------------------------------

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


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

Posted by "Erick Erickson (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Erick Erickson reassigned SOLR-3182:
------------------------------------

    Assignee: Erick Erickson
    
> 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
>            Assignee: Erick Erickson
>            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


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

Posted by "Russell Black (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221412#comment-13221412 ] 

Russell Black edited comment on SOLR-3182 at 3/3/12 2:32 AM:
-------------------------------------------------------------

Jan, that is an interesting idea and is similar to the one Yonik proposed earlier.  I am happy with your proposal as it would address our situation just fine.  

That said, you could experience a type of inconsistent behavior with a $1 solution as well.  Let's say I have two cores and have {{defaultCoreName=$1}}.  Then the first core gets deleted.  Anyone who was making requests to the default core(/solr/select) will suddenly find that they are getting different data because they are hitting a new core.  From this perspective, the "magic" behavior would seem to be no worse than the inconsistency with the $1 solution.  It's possible I am missing something here.  

As far as the backwards compatibility of my proposed solution, old solr.xmls will continue to operate as they always have, the only difference being that single cores will be available via an additional url.  That is, single cores will continue to be accessible by their name.  

I am willing to build the patch for whatever solution the committers agree on. 
                
      was (Author: rblack):
    Jan, that is an interesting idea and is similar to the one Yonik proposed earlier.  I am happy with your proposal as it would address our situation just fine.  

That said, you could experience a type of inconsistent behavior with a $1 solution as well.  Let's say I have two cores and have {{defaultCoreName=$1}}.  Then the first core gets deleted.  Anyone who was making requests to the default core(/solr/select) will suddenly find that they are getting different data because they are hitting a new core.  From this perspective, the "magic" behavior would seem to be no worse than the inconsistency with the $1 solution.  It's possible I am missing something here.  

As far as backwards compatibility, old solr.xmls will continue to operate as they always have, the only difference being that single cores will be available via an additional url.  That is, single cores will continue to be accessible by their name.  

I am willing to build the patch for whatever solution the committers agree on. 
                  
> 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


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

Posted by "Russell Black (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Russell Black updated SOLR-3182:
--------------------------------

    Description: 
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}

  was:
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 1295204)
+++ solr/core/src/java/org/apache/solr/core/CoreContainer.java	(working copy)
@@ -870,6 +870,13 @@
   }
 
   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) {
+      SolrCore onlyCore = cores.get(0);
+      if(onlyCore != null) {
+        return onlyCore.getName();
+      }
+    }
     return name.length() == 0  || defaultCoreName.equals(name) || name.trim().length() == 0 ? "" : name;
   } 
{code}

    
> 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


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

Posted by "Russell Black (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221005#comment-13221005 ] 

Russell Black commented on SOLR-3182:
-------------------------------------

bq. If you start with two cores open (and maybe even no default core), then close one core and all of a sudden the other becomes the default?

I have thought about that situation.  It is true that going from two cores to one would result in the remaining core becoming the default.  However, this doesn't change the way the server presents itself to an application that expects a multi-core system, since the remaining core continues to be accessible by the same URL as it was before.  It simply becomes accessible by an additional URL when it becomes the only core.

Thanks for considering this patch.  
                
> 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


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

Posted by "Yonik Seeley (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221054#comment-13221054 ] 

Yonik Seeley commented on SOLR-3182:
------------------------------------

bq. It simply becomes accessible by an additional URL when it becomes the only core.

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.

                
> 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


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

Posted by "Russell Black (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221098#comment-13221098 ] 

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

Perhaps the confusion you point out could be mitigated with some messaging, something like this:

{code}
private String checkDefault(String name) {
  // if there is only one core, let it be the default without specifying a default in solr.xml
  if (StringUtils.isBlank(defaultCoreName) && StringUtils.isBlank(name.trim())) {
    if (cores.size() == 1) {
      return cores.values().iterator().next().getName();
    }
    else {
      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "This server hosts multiple cores, " +
      		"but no core name was supplied in the request and no defaultCoreName was declared in solr.xml" );
    }
  }
  return StringUtils.isBlank(name) || defaultCoreName.equals(name) ? "" : name;
} 
{code}
                
      was (Author: rblack):
    Perhaps the confusion you point out could be mitigated with some messaging, something like this:

{code}
private String checkDefault(String name) {
  // if there is only one core, let it be the default without specifying a default in solr.xml
  if (StringUtils.isBlank(defaultCoreName) && StringUtils.isBlank(name.trim())) {
    if (cores.size() == 1) {
      return cores.values().iterator().next().getName();
    }
    else {
      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "This server hosts multiple cores, " +
      		"but no core name was supplied in the request and no defaultCoreName was declared in solr.xml" );
    }
  }
    return StringUtils.isBlank(name) || defaultCoreName.equals(name) ? "" : name;
  } 
{code}
                  
> 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


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

Posted by "Russell Black (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Russell Black updated SOLR-3182:
--------------------------------

    Attachment: SOLR-3182-default-core.patch
    
> 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, 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


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

Posted by "Erick Erickson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13224584#comment-13224584 ] 

Erick Erickson commented on SOLR-3182:
--------------------------------------

Do we want to carry this forward for 3.x? If so, we need to get consensus real soon now since there's a movement to cut a 3.6 (the last 3x release planned?) in 10 days or so.

I've assigned it to myself just as a placeholder, if someone else wants to go ahead and take this, please feel free.

Or does all the SolrCloud stuff make this something we don't want to deal with (in which case there never will be a 3.x way to handle this)...

Or does it make sense to do this for 3.6 and not try to move it into trunk?
                
> 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


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

Posted by "Russell Black (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ 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


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

Posted by "Russell Black (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221412#comment-13221412 ] 

Russell Black commented on SOLR-3182:
-------------------------------------

Jan, that is an interesting idea and is similar to the one Yonik proposed earlier.  I am happy with your proposal as it would address our situation just fine.  

That said, you could experience a type of inconsistent behavior with a $1 solution as well.  Let's say I have two cores and have {{defaultCoreName=$1}}.  Then the first core gets deleted.  Anyone who was making requests to the default core(/solr/select) will suddenly find that they are getting different data because they are hitting a new core.  From this perspective, the "magic" behavior would seem to be no worse than the inconsistency with the $1 solution.  It's possible I am missing something here.  

As far as backwards compatibility, old solr.xmls will continue to operate as they always have, the only difference being that single cores will be available via an additional url.  That is, single cores will continue to be accessible by their name.  

I am willing to build the patch for whatever solution the committers agree on. 
                
> 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


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

Posted by "Russell Black (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Russell Black updated SOLR-3182:
--------------------------------

    Attachment: SOLR-3182-default-core.patch
    
> 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 1295204)
> +++ solr/core/src/java/org/apache/solr/core/CoreContainer.java	(working copy)
> @@ -870,6 +870,13 @@
>    }
>  
>    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) {
> +      SolrCore onlyCore = cores.get(0);
> +      if(onlyCore != null) {
> +        return onlyCore.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


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

Posted by "Erick Erickson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13220990#comment-13220990 ] 

Erick Erickson commented on SOLR-3182:
--------------------------------------

Hmmm, there's no guarantee that the incoming name is not null, so wouldn't
StringUtils.isBlank() (commons-lang is available) be a better choice for testing name? defaultCoreName is initialized to "", but it doesn't seem like it would hurt there either...

Other than that, does anyone object to committing this? I don't see how this bit could generate an NPE given that the size is guaranteed to be > 0
cores.values().iterator().next().getName() 
                
> 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


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

Posted by "Yonik Seeley (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13220999#comment-13220999 ] 

Yonik Seeley commented on SOLR-3182:
------------------------------------

bq. Other than that, does anyone object to committing this?

I haven't thought through the implications, but it could be dicey for multi-core use.
If you start with two cores open (and maybe even no default core), then close one core and all of a sudden the other becomes the default?

Perhaps this need for a default core could instead be generalized... some sort of config option that made the default the first active core (sorted by core name)?

                
> 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