You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Steve Molloy <sm...@opentext.com> on 2013/11/26 20:10:08 UTC

Collections API

I'm trying to reconcile our fork with 4.6 tag and I'm getting weird behaviour in Collections API, more specifically in ZkController's preRegister method after calling the create method of the collections API. When it checks if a slice has a replica for current node name, there is never any because at this stage, the slice has no replica. This is the new code that seems to be causing my issue, I can force the "autoCreated" to be always true to avoid the issue, but would like a cleaner way if there is one.

      if(cd.getCloudDescriptor().getCollectionName() !=null && cd.getCloudDescriptor().getCoreNodeName() != null ) {
        //we were already registered
        if(zkStateReader.getClusterState().hasCollection(cd.getCloudDescriptor().getCollectionName())){
        DocCollection coll = zkStateReader.getClusterState().getCollection(cd.getCloudDescriptor().getCollectionName());
         if(!"true".equals(coll.getStr("autoCreated"))){
           Slice slice = coll.getSlice(cd.getCloudDescriptor().getShardId());
           if(slice != null){
==>      if(slice.getReplica(cd.getCloudDescriptor().getCoreNodeName()) == null) {
               log.info("core_removed This core is removed from ZK");
               throw new SolrException(ErrorCode.NOT_FOUND,coreNodeName +" is removed");
             }
           }
         }
        }
      }

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


RE: Collections API

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
If the patch is applied the work around must not be required
On 29 Nov 2013 08:17, "Steve Molloy" <sm...@opentext.com> wrote:

> Thanks, I already had the genericCoreNodeNames=true in solrcloud section
> of solr.xml, new format. But I had a "str" entry instead of a "bool", which
> apparently is simply treated as false. Anyhow, in my case the fix works if
> I move the bit setting the coreNodeName after the publish, not before. If
> it's before, I get a timeout error while it waits for a replica that is
> never set in waitForShardId.
>
> I'll both apply the modified patch and switch from str to bool. :)
>
> Thanks for the help,
> Steve
>
>
> From: Alexey Serba [aserba@gmail.com]
>
> Sent: November 28, 2013 2:10 AM
>
> To: dev@lucene.apache.org
>
> Subject: Re: Collections API
>
>
>
>
>
>
> https://issues.apache.org/jira/browse/SOLR-5510
>
>
>
>
> I don't really understand all the details why is that happening, but the
> workaround is to add genericCoreNodeNames="${genericCoreNodeNames:true}
>  attribute to cores element in your solr.xml file.
>
>
>
>
>
> On Tue, Nov 26, 2013 at 10:10 PM, Steve Molloy
> <sm...@opentext.com> wrote:
>
>
> I'm trying to reconcile our fork with 4.6 tag and I'm getting weird
> behaviour in Collections API, more specifically in ZkController's
> preRegister method after calling the create method of the collections API.
> When it checks if a slice has a replica for current
>  node name, there is never any because at this stage, the slice has no
> replica. This is the new code that seems to be causing my issue, I can
> force the "autoCreated" to be always true to avoid the issue, but would
> like a cleaner way if there is one.
>
>
>
>       if(cd.getCloudDescriptor().getCollectionName() !=null &&
> cd.getCloudDescriptor().getCoreNodeName() != null ) {
>
>         //we were already registered
>
>
> if(zkStateReader.getClusterState().hasCollection(cd.getCloudDescriptor().getCollectionName())){
>
>         DocCollection coll =
> zkStateReader.getClusterState().getCollection(cd.getCloudDescriptor().getCollectionName());
>
>          if(!"true".equals(coll.getStr("autoCreated"))){
>
>            Slice slice =
> coll.getSlice(cd.getCloudDescriptor().getShardId());
>
>            if(slice != null){
>
> ==>      if(slice.getReplica(cd.getCloudDescriptor().getCoreNodeName()) ==
> null) {
>
>                log.info("core_removed This core is removed from ZK");
>
>                throw new SolrException(ErrorCode.NOT_FOUND,coreNodeName +"
> is removed");
>
>              }
>
>            }
>
>          }
>
>         }
>
>       }
>
>
>
> Thanks.
>
> Steve
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail:
> dev-unsubscribe@lucene.apache.org
>
> For additional commands, e-mail:
> dev-help@lucene.apache.org
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

RE: Collections API

Posted by Steve Molloy <sm...@opentext.com>.
Thanks, I already had the genericCoreNodeNames=true in solrcloud section of solr.xml, new format. But I had a "str" entry instead of a "bool", which apparently is simply treated as false. Anyhow, in my case the fix works if I move the bit setting the coreNodeName after the publish, not before. If it's before, I get a timeout error while it waits for a replica that is never set in waitForShardId.

I'll both apply the modified patch and switch from str to bool. :)

Thanks for the help,
Steve


From: Alexey Serba [aserba@gmail.com]

Sent: November 28, 2013 2:10 AM

To: dev@lucene.apache.org

Subject: Re: Collections API






https://issues.apache.org/jira/browse/SOLR-5510




I don't really understand all the details why is that happening, but the workaround is to add genericCoreNodeNames="${genericCoreNodeNames:true}
 attribute to cores element in your solr.xml file.





On Tue, Nov 26, 2013 at 10:10 PM, Steve Molloy 
<sm...@opentext.com> wrote:


I'm trying to reconcile our fork with 4.6 tag and I'm getting weird behaviour in Collections API, more specifically in ZkController's preRegister method after calling the create method of the collections API. When it checks if a slice has a replica for current
 node name, there is never any because at this stage, the slice has no replica. This is the new code that seems to be causing my issue, I can force the "autoCreated" to be always true to avoid the issue, but would like a cleaner way if there is one.



      if(cd.getCloudDescriptor().getCollectionName() !=null && cd.getCloudDescriptor().getCoreNodeName() != null ) {

        //we were already registered

        if(zkStateReader.getClusterState().hasCollection(cd.getCloudDescriptor().getCollectionName())){

        DocCollection coll = zkStateReader.getClusterState().getCollection(cd.getCloudDescriptor().getCollectionName());

         if(!"true".equals(coll.getStr("autoCreated"))){

           Slice slice = coll.getSlice(cd.getCloudDescriptor().getShardId());

           if(slice != null){

==>      if(slice.getReplica(cd.getCloudDescriptor().getCoreNodeName()) == null) {

               log.info("core_removed This core is removed from ZK");

               throw new SolrException(ErrorCode.NOT_FOUND,coreNodeName +" is removed");

             }

           }

         }

        }

      }



Thanks.

Steve

---------------------------------------------------------------------

To unsubscribe, e-mail: 
dev-unsubscribe@lucene.apache.org

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












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


Re: Collections API

Posted by Alexey Serba <as...@gmail.com>.
https://issues.apache.org/jira/browse/SOLR-5510

I don't really understand all the details why is that happening, but the
workaround is to add genericCoreNodeNames="${genericCoreNodeNames:true}
attribute to cores element in your solr.xml file.


On Tue, Nov 26, 2013 at 10:10 PM, Steve Molloy <sm...@opentext.com> wrote:

> I'm trying to reconcile our fork with 4.6 tag and I'm getting weird
> behaviour in Collections API, more specifically in ZkController's
> preRegister method after calling the create method of the collections API.
> When it checks if a slice has a replica for current node name, there is
> never any because at this stage, the slice has no replica. This is the new
> code that seems to be causing my issue, I can force the "autoCreated" to be
> always true to avoid the issue, but would like a cleaner way if there is
> one.
>
>       if(cd.getCloudDescriptor().getCollectionName() !=null &&
> cd.getCloudDescriptor().getCoreNodeName() != null ) {
>         //we were already registered
>
> if(zkStateReader.getClusterState().hasCollection(cd.getCloudDescriptor().getCollectionName())){
>         DocCollection coll =
> zkStateReader.getClusterState().getCollection(cd.getCloudDescriptor().getCollectionName());
>          if(!"true".equals(coll.getStr("autoCreated"))){
>            Slice slice =
> coll.getSlice(cd.getCloudDescriptor().getShardId());
>            if(slice != null){
> ==>      if(slice.getReplica(cd.getCloudDescriptor().getCoreNodeName()) ==
> null) {
>                log.info("core_removed This core is removed from ZK");
>                throw new SolrException(ErrorCode.NOT_FOUND,coreNodeName +"
> is removed");
>              }
>            }
>          }
>         }
>       }
>
> Thanks.
> Steve
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>