You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by YouPeng Yang <yy...@gmail.com> on 2013/12/26 07:29:03 UTC

Maybe a bug for solr 4.6 when create a new core

Hi
   Merry Christmas.

   Before this mail,I am in trouble with a weird problem  for a few days
when to create a new core with both explicite shard and coreNodeName. And I
have posted a few mails  in the mailist,no one ever gives any
suggestions,maybe  they did not  encounter the same problem.
  I have to go through the srcs to check out the reason. Thanks god, I find
it. The reason to the problem,maybe be a bug, so I would like to report it
hoping to get your endorsement and confirmation.


In class org.apache.solr.cloud.Overseer the Line 360:
---------------------------------------------------------------------
          if (sliceName !=null && collectionExists &&
!"true".equals(state.getCollection(collection).getStr("autoCreated"))) {
            Slice slice = state.getSlice(collection, sliceName);
            if (slice.getReplica(coreNodeName) == null) {
              log.info("core_deleted . Just return");
              return state;
            }
          }
---------------------------------------------------------------------
the slice needs to be checked null .because I create a new core with both
explicite shard and coreNodeName, the state.getSlice(collection,
sliceName)  may return a null.So it needs to be checked ,or there will be
an NullpointException
---------------------------------------------------------------------
          if (sliceName !=null && collectionExists &&
!"true".equals(state.getCollection(collection).getStr("autoCreated"))) {
            Slice slice = state.getSlice(collection, sliceName);
            if (*slice != null &&* slice.getReplica(coreNodeName) == null) {
              log.info("core_deleted . Just return");
              return state;
            }
          }
---------------------------------------------------------------------

 *Querstion 1*: Is this OK with the whole solr project,I have no aware
about the influences about the change,as right now ,it goes right. Please
make confirm about this.

  After I fixed this prolem,I can create a core with the request:
http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test&
*shard=Test*
&collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
*coreNodeName=Test*

  However when I create a replica within the same shard Test:
http://10.7.23.122:8080/solr/admin/cores?action=CREATE&*name=Test1*&
*shard=Test*
&collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
*coreNodeName=Test1*

  It response an error:
<response>
        <lst name="responseHeader">
        <int name="status">400</int>
         <int name="QTime">29</int>
</lst>
<lst name="error">
          <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
removed</str>
          <int name="code">400</int>
</lst>
</response>

I aslo find the reason the in the class  org.apache.solr.cloud.ZkController
line 1369~ 1384[1]
 As the src here,it needs to check the autoCreated within an existing
collection
when the coreNodeName and shard were assigned manully. the autoCreated
property of a collection is not equal with true, it throws an exeption.

  *Question2*: Why does it need  to check the 'autoCreated', and how could
I go through this check, or Is this another bug?




[1]-------------------------------------------------------------------------------------------------------------
    try {
      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");
             }
           }
         }
        }
      }
--------------------------------------------------------------------------------------------------------------

Re: Maybe a bug for solr 4.6 when create a new core

Posted by Shawn Heisey <so...@elyograg.org>.
On 12/25/2013 11:29 PM, YouPeng Yang wrote:
>   After I fixed this prolem,I can create a core with the request:
> http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test&
> *shard=Test*
> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
> *coreNodeName=Test*

In simple terms, what are you trying to get done?  This is sounding like
an XY problem.

http://people.apache.org/~hossman/#xyproblem

If you take a few steps back and describe what you want to happen, what
has come before, what you've tried, and what has actually happened, it
will be easier to help you.

Most of the people who work on Solr are part of the western world, and
yesterday was Christmas.  Some people are getting back to work today,
but many of them will be unavailable until after the new year.

Thanks,
Shawn


Re: Maybe a bug for solr 4.6 when create a new core

Posted by Mark Miller <ma...@gmail.com>.
Thanks - that is more bad code that needs to be removed. I'll reopen that
issue and add to it.

- Mark


On Sun, Dec 29, 2013 at 8:56 AM, YouPeng Yang <yy...@gmail.com>wrote:

> Hi Mark Miller
>
>    It's great that you have fixed the bug. By the way,there is another
> point i want to remind you which I posted it before.I am just posting  it
> again.
>   Please check it again.whether is the autoCreated check here  is fit?
>
>   IAfter I create a new core with explicite shard and coreNodeName
> successfully when I fixed the bug,I can not create a replica for above new
> core also with explicite coreNodeName and the same shard and collection
> ,the Request url as following:
>
>
> http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test1&shard=Test&collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&coreNodeName=Test1
>
>  It responses an error:
>
> <response>
>         <lst name="responseHeader">
>        <int name="status">400</int>
>          <int name="QTime">29</int>
>   </lst>
>   <lst name="error">
>          <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
> removed</str>
>          <int name="code">400</int>
>   </lst>
>   </response>
>
>    I find out that in the src class in  org.apache.solr.cloud.ZkController
> line 1369~ 1384:
>    As the code says,when I indicate a  coreNodeName and collection
> explicitly,it goes to check a 'autoCreated' property of the Collection
> which I have already created.
>
>   My question :Why does it need to check the 'autoCreated' property,any
> jira about this 'autoCreated' property? How can I make  through the check?
>
>    [1]---------------------------
>
> ----------------------------------------------------------------------------------
>     try {
>       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");
>              }
>            }
>          }
>         }
>       }
>
>  --------------------------------------------------------------------------------------------------------------
>
>
> 2013/12/27 YouPeng Yang <yy...@gmail.com>
>
> >  Hi Mark
> >
> >   I have filed a jira about the NPE:
> >   https://issues.apache.org/jira/browse/SOLR-5580
> >
> >
> > 2013/12/27 YouPeng Yang <yy...@gmail.com>
> >
> >> Hi Mark.
> >>
> >>    Thanks for your reply.
> >>
> >>     I will file a JIRA issue about the NPE.
> >>
> >>    By the way,would you look through the Question 2. After I create a
> new
> >> core with explicite shard and coreNodeName successfully,I can not
> create a
> >> replica for above new core also with explicite coreNodeName and the same
> >> shard and collection
> >>   Request url as following:
> >>
> >>
> http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test1&shard=Test&collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&coreNodeName=Test1
> >>
> >>  It responses an error:
> >>
> >> <response>
> >>         <lst name="responseHeader">
> >>        <int name="status">400</int>
> >>          <int name="QTime">29</int>
> >>   </lst>
> >>   <lst name="error">
> >>          <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
> >> removed</str>
> >>          <int name="code">400</int>
> >>   </lst>
> >>   </response>
> >>
> >>    I find out that in the src class in  org.apache.solr.cloud.
> >> ZkController line 1369~ 1384:
> >>    As the code says,when I indicate a  coreNodeName and collection
> >> explicitly,it goes to check a 'autoCreated' property of the Collection
> >> which I have already created.
> >>
> >>   My question :Why does it need to check the 'autoCreated' property,any
> >> jira about this 'autoCreated' property? How can I make  through the
> check?
> >>
> >>
> >>
> [1]-------------------------------------------------------------------------------------------------------------
> >>     try {
> >>       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");
> >>              }
> >>            }
> >>          }
> >>         }
> >>       }
> >>
> >>
>  --------------------------------------------------------------------------------------------------------------
> >>
> >>
> >> Regards
> >>
> >>
> >> 2013/12/27 Mark Miller <ma...@gmail.com>
> >>
> >>> If you are seeing an NPE there, sounds like you are on to something.
> >>> Please file a JIRA issue.
> >>>
> >>> - Mark
> >>>
> >>> > On Dec 26, 2013, at 1:29 AM, YouPeng Yang <yypvsxf19870706@gmail.com
> >
> >>> wrote:
> >>> >
> >>> > Hi
> >>> >   Merry Christmas.
> >>> >
> >>> >   Before this mail,I am in trouble with a weird problem  for a few
> days
> >>> > when to create a new core with both explicite shard and coreNodeName.
> >>> And I
> >>> > have posted a few mails  in the mailist,no one ever gives any
> >>> > suggestions,maybe  they did not  encounter the same problem.
> >>> >  I have to go through the srcs to check out the reason. Thanks god, I
> >>> find
> >>> > it. The reason to the problem,maybe be a bug, so I would like to
> >>> report it
> >>> > hoping to get your endorsement and confirmation.
> >>> >
> >>> >
> >>> > In class org.apache.solr.cloud.Overseer the Line 360:
> >>> > ---------------------------------------------------------------------
> >>> >          if (sliceName !=null && collectionExists &&
> >>> >
> !"true".equals(state.getCollection(collection).getStr("autoCreated")))
> >>> {
> >>> >            Slice slice = state.getSlice(collection, sliceName);
> >>> >            if (slice.getReplica(coreNodeName) == null) {
> >>> >              log.info("core_deleted . Just return");
> >>> >              return state;
> >>> >            }
> >>> >          }
> >>> > ---------------------------------------------------------------------
> >>> > the slice needs to be checked null .because I create a new core with
> >>> both
> >>> > explicite shard and coreNodeName, the state.getSlice(collection,
> >>> > sliceName)  may return a null.So it needs to be checked ,or there
> will
> >>> be
> >>> > an NullpointException
> >>> > ---------------------------------------------------------------------
> >>> >          if (sliceName !=null && collectionExists &&
> >>> >
> !"true".equals(state.getCollection(collection).getStr("autoCreated")))
> >>> {
> >>> >            Slice slice = state.getSlice(collection, sliceName);
> >>> >            if (*slice != null &&* slice.getReplica(coreNodeName) ==
> >>> null) {
> >>> >              log.info("core_deleted . Just return");
> >>> >              return state;
> >>> >            }
> >>> >          }
> >>> > ---------------------------------------------------------------------
> >>> >
> >>> > *Querstion 1*: Is this OK with the whole solr project,I have no aware
> >>> > about the influences about the change,as right now ,it goes right.
> >>> Please
> >>> > make confirm about this.
> >>> >
> >>> >  After I fixed this prolem,I can create a core with the request:
> >>> > http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test&
> >>> > *shard=Test*
> >>> >
> >>>
> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
> >>> > *coreNodeName=Test*
> >>> >
> >>> >  However when I create a replica within the same shard Test:
> >>> > http://10.7.23.122:8080/solr/admin/cores?action=CREATE&*name=Test1*&
> >>> > *shard=Test*
> >>> >
> >>>
> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
> >>> > *coreNodeName=Test1*
> >>> >
> >>> >  It response an error:
> >>> > <response>
> >>> >        <lst name="responseHeader">
> >>> >        <int name="status">400</int>
> >>> >         <int name="QTime">29</int>
> >>> > </lst>
> >>> > <lst name="error">
> >>> >          <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
> >>> > removed</str>
> >>> >          <int name="code">400</int>
> >>> > </lst>
> >>> > </response>
> >>> >
> >>> > I aslo find the reason the in the class
> >>>  org.apache.solr.cloud.ZkController
> >>> > line 1369~ 1384[1]
> >>> > As the src here,it needs to check the autoCreated within an existing
> >>> > collection
> >>> > when the coreNodeName and shard were assigned manully. the
> autoCreated
> >>> > property of a collection is not equal with true, it throws an
> exeption.
> >>> >
> >>> >  *Question2*: Why does it need  to check the 'autoCreated', and how
> >>> could
> >>> > I go through this check, or Is this another bug?
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >
> >>>
> [1]-------------------------------------------------------------------------------------------------------------
> >>> >    try {
> >>> >      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");
> >>> >             }
> >>> >           }
> >>> >         }
> >>> >        }
> >>> >      }
> >>> >
> >>>
> --------------------------------------------------------------------------------------------------------------
> >>>
> >>
> >>
> >
>



-- 
- Mark

Re: Maybe a bug for solr 4.6 when create a new core

Posted by YouPeng Yang <yy...@gmail.com>.
Hi Mark Miller

   It's great that you have fixed the bug. By the way,there is another
point i want to remind you which I posted it before.I am just posting  it
again.
  Please check it again.whether is the autoCreated check here  is fit?

  IAfter I create a new core with explicite shard and coreNodeName
successfully when I fixed the bug,I can not create a replica for above new
core also with explicite coreNodeName and the same shard and collection
,the Request url as following:

http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test1&shard=Test&collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&coreNodeName=Test1

 It responses an error:

<response>
        <lst name="responseHeader">
       <int name="status">400</int>
         <int name="QTime">29</int>
  </lst>
  <lst name="error">
         <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
removed</str>
         <int name="code">400</int>
  </lst>
  </response>

   I find out that in the src class in  org.apache.solr.cloud.ZkController
line 1369~ 1384:
   As the code says,when I indicate a  coreNodeName and collection
explicitly,it goes to check a 'autoCreated' property of the Collection
which I have already created.

  My question :Why does it need to check the 'autoCreated' property,any
jira about this 'autoCreated' property? How can I make  through the check?

   [1]---------------------------
----------------------------------------------------------------------------------
    try {
      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");
             }
           }
         }
        }
      }
 --------------------------------------------------------------------------------------------------------------


2013/12/27 YouPeng Yang <yy...@gmail.com>

>  Hi Mark
>
>   I have filed a jira about the NPE:
>   https://issues.apache.org/jira/browse/SOLR-5580
>
>
> 2013/12/27 YouPeng Yang <yy...@gmail.com>
>
>> Hi Mark.
>>
>>    Thanks for your reply.
>>
>>     I will file a JIRA issue about the NPE.
>>
>>    By the way,would you look through the Question 2. After I create a new
>> core with explicite shard and coreNodeName successfully,I can not create a
>> replica for above new core also with explicite coreNodeName and the same
>> shard and collection
>>   Request url as following:
>>
>> http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test1&shard=Test&collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&coreNodeName=Test1
>>
>>  It responses an error:
>>
>> <response>
>>         <lst name="responseHeader">
>>        <int name="status">400</int>
>>          <int name="QTime">29</int>
>>   </lst>
>>   <lst name="error">
>>          <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
>> removed</str>
>>          <int name="code">400</int>
>>   </lst>
>>   </response>
>>
>>    I find out that in the src class in  org.apache.solr.cloud.
>> ZkController line 1369~ 1384:
>>    As the code says,when I indicate a  coreNodeName and collection
>> explicitly,it goes to check a 'autoCreated' property of the Collection
>> which I have already created.
>>
>>   My question :Why does it need to check the 'autoCreated' property,any
>> jira about this 'autoCreated' property? How can I make  through the check?
>>
>>
>> [1]-------------------------------------------------------------------------------------------------------------
>>     try {
>>       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");
>>              }
>>            }
>>          }
>>         }
>>       }
>>
>>  --------------------------------------------------------------------------------------------------------------
>>
>>
>> Regards
>>
>>
>> 2013/12/27 Mark Miller <ma...@gmail.com>
>>
>>> If you are seeing an NPE there, sounds like you are on to something.
>>> Please file a JIRA issue.
>>>
>>> - Mark
>>>
>>> > On Dec 26, 2013, at 1:29 AM, YouPeng Yang <yy...@gmail.com>
>>> wrote:
>>> >
>>> > Hi
>>> >   Merry Christmas.
>>> >
>>> >   Before this mail,I am in trouble with a weird problem  for a few days
>>> > when to create a new core with both explicite shard and coreNodeName.
>>> And I
>>> > have posted a few mails  in the mailist,no one ever gives any
>>> > suggestions,maybe  they did not  encounter the same problem.
>>> >  I have to go through the srcs to check out the reason. Thanks god, I
>>> find
>>> > it. The reason to the problem,maybe be a bug, so I would like to
>>> report it
>>> > hoping to get your endorsement and confirmation.
>>> >
>>> >
>>> > In class org.apache.solr.cloud.Overseer the Line 360:
>>> > ---------------------------------------------------------------------
>>> >          if (sliceName !=null && collectionExists &&
>>> > !"true".equals(state.getCollection(collection).getStr("autoCreated")))
>>> {
>>> >            Slice slice = state.getSlice(collection, sliceName);
>>> >            if (slice.getReplica(coreNodeName) == null) {
>>> >              log.info("core_deleted . Just return");
>>> >              return state;
>>> >            }
>>> >          }
>>> > ---------------------------------------------------------------------
>>> > the slice needs to be checked null .because I create a new core with
>>> both
>>> > explicite shard and coreNodeName, the state.getSlice(collection,
>>> > sliceName)  may return a null.So it needs to be checked ,or there will
>>> be
>>> > an NullpointException
>>> > ---------------------------------------------------------------------
>>> >          if (sliceName !=null && collectionExists &&
>>> > !"true".equals(state.getCollection(collection).getStr("autoCreated")))
>>> {
>>> >            Slice slice = state.getSlice(collection, sliceName);
>>> >            if (*slice != null &&* slice.getReplica(coreNodeName) ==
>>> null) {
>>> >              log.info("core_deleted . Just return");
>>> >              return state;
>>> >            }
>>> >          }
>>> > ---------------------------------------------------------------------
>>> >
>>> > *Querstion 1*: Is this OK with the whole solr project,I have no aware
>>> > about the influences about the change,as right now ,it goes right.
>>> Please
>>> > make confirm about this.
>>> >
>>> >  After I fixed this prolem,I can create a core with the request:
>>> > http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test&
>>> > *shard=Test*
>>> >
>>> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
>>> > *coreNodeName=Test*
>>> >
>>> >  However when I create a replica within the same shard Test:
>>> > http://10.7.23.122:8080/solr/admin/cores?action=CREATE&*name=Test1*&
>>> > *shard=Test*
>>> >
>>> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
>>> > *coreNodeName=Test1*
>>> >
>>> >  It response an error:
>>> > <response>
>>> >        <lst name="responseHeader">
>>> >        <int name="status">400</int>
>>> >         <int name="QTime">29</int>
>>> > </lst>
>>> > <lst name="error">
>>> >          <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
>>> > removed</str>
>>> >          <int name="code">400</int>
>>> > </lst>
>>> > </response>
>>> >
>>> > I aslo find the reason the in the class
>>>  org.apache.solr.cloud.ZkController
>>> > line 1369~ 1384[1]
>>> > As the src here,it needs to check the autoCreated within an existing
>>> > collection
>>> > when the coreNodeName and shard were assigned manully. the autoCreated
>>> > property of a collection is not equal with true, it throws an exeption.
>>> >
>>> >  *Question2*: Why does it need  to check the 'autoCreated', and how
>>> could
>>> > I go through this check, or Is this another bug?
>>> >
>>> >
>>> >
>>> >
>>> >
>>> [1]-------------------------------------------------------------------------------------------------------------
>>> >    try {
>>> >      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");
>>> >             }
>>> >           }
>>> >         }
>>> >        }
>>> >      }
>>> >
>>> --------------------------------------------------------------------------------------------------------------
>>>
>>
>>
>

Re: Maybe a bug for solr 4.6 when create a new core

Posted by YouPeng Yang <yy...@gmail.com>.
 Hi Mark

  I have filed a jira about the NPE:
  https://issues.apache.org/jira/browse/SOLR-5580


2013/12/27 YouPeng Yang <yy...@gmail.com>

> Hi Mark.
>
>    Thanks for your reply.
>
>     I will file a JIRA issue about the NPE.
>
>    By the way,would you look through the Question 2. After I create a new
> core with explicite shard and coreNodeName successfully,I can not create a
> replica for above new core also with explicite coreNodeName and the same
> shard and collection
>   Request url as following:
>
> http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test1&shard=Test&collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&coreNodeName=Test1
>
>  It responses an error:
>
> <response>
>         <lst name="responseHeader">
>        <int name="status">400</int>
>          <int name="QTime">29</int>
>   </lst>
>   <lst name="error">
>          <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
> removed</str>
>          <int name="code">400</int>
>   </lst>
>   </response>
>
>    I find out that in the src class in  org.apache.solr.cloud.
> ZkController line 1369~ 1384:
>    As the code says,when I indicate a  coreNodeName and collection
> explicitly,it goes to check a 'autoCreated' property of the Collection
> which I have already created.
>
>   My question :Why does it need to check the 'autoCreated' property,any
> jira about this 'autoCreated' property? How can I make  through the check?
>
>
> [1]-------------------------------------------------------------------------------------------------------------
>     try {
>       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");
>              }
>            }
>          }
>         }
>       }
>
>  --------------------------------------------------------------------------------------------------------------
>
>
> Regards
>
>
> 2013/12/27 Mark Miller <ma...@gmail.com>
>
>> If you are seeing an NPE there, sounds like you are on to something.
>> Please file a JIRA issue.
>>
>> - Mark
>>
>> > On Dec 26, 2013, at 1:29 AM, YouPeng Yang <yy...@gmail.com>
>> wrote:
>> >
>> > Hi
>> >   Merry Christmas.
>> >
>> >   Before this mail,I am in trouble with a weird problem  for a few days
>> > when to create a new core with both explicite shard and coreNodeName.
>> And I
>> > have posted a few mails  in the mailist,no one ever gives any
>> > suggestions,maybe  they did not  encounter the same problem.
>> >  I have to go through the srcs to check out the reason. Thanks god, I
>> find
>> > it. The reason to the problem,maybe be a bug, so I would like to report
>> it
>> > hoping to get your endorsement and confirmation.
>> >
>> >
>> > In class org.apache.solr.cloud.Overseer the Line 360:
>> > ---------------------------------------------------------------------
>> >          if (sliceName !=null && collectionExists &&
>> > !"true".equals(state.getCollection(collection).getStr("autoCreated"))) {
>> >            Slice slice = state.getSlice(collection, sliceName);
>> >            if (slice.getReplica(coreNodeName) == null) {
>> >              log.info("core_deleted . Just return");
>> >              return state;
>> >            }
>> >          }
>> > ---------------------------------------------------------------------
>> > the slice needs to be checked null .because I create a new core with
>> both
>> > explicite shard and coreNodeName, the state.getSlice(collection,
>> > sliceName)  may return a null.So it needs to be checked ,or there will
>> be
>> > an NullpointException
>> > ---------------------------------------------------------------------
>> >          if (sliceName !=null && collectionExists &&
>> > !"true".equals(state.getCollection(collection).getStr("autoCreated"))) {
>> >            Slice slice = state.getSlice(collection, sliceName);
>> >            if (*slice != null &&* slice.getReplica(coreNodeName) ==
>> null) {
>> >              log.info("core_deleted . Just return");
>> >              return state;
>> >            }
>> >          }
>> > ---------------------------------------------------------------------
>> >
>> > *Querstion 1*: Is this OK with the whole solr project,I have no aware
>> > about the influences about the change,as right now ,it goes right.
>> Please
>> > make confirm about this.
>> >
>> >  After I fixed this prolem,I can create a core with the request:
>> > http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test&
>> > *shard=Test*
>> >
>> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
>> > *coreNodeName=Test*
>> >
>> >  However when I create a replica within the same shard Test:
>> > http://10.7.23.122:8080/solr/admin/cores?action=CREATE&*name=Test1*&
>> > *shard=Test*
>> >
>> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
>> > *coreNodeName=Test1*
>> >
>> >  It response an error:
>> > <response>
>> >        <lst name="responseHeader">
>> >        <int name="status">400</int>
>> >         <int name="QTime">29</int>
>> > </lst>
>> > <lst name="error">
>> >          <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
>> > removed</str>
>> >          <int name="code">400</int>
>> > </lst>
>> > </response>
>> >
>> > I aslo find the reason the in the class
>>  org.apache.solr.cloud.ZkController
>> > line 1369~ 1384[1]
>> > As the src here,it needs to check the autoCreated within an existing
>> > collection
>> > when the coreNodeName and shard were assigned manully. the autoCreated
>> > property of a collection is not equal with true, it throws an exeption.
>> >
>> >  *Question2*: Why does it need  to check the 'autoCreated', and how
>> could
>> > I go through this check, or Is this another bug?
>> >
>> >
>> >
>> >
>> >
>> [1]-------------------------------------------------------------------------------------------------------------
>> >    try {
>> >      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");
>> >             }
>> >           }
>> >         }
>> >        }
>> >      }
>> >
>> --------------------------------------------------------------------------------------------------------------
>>
>
>

Re: Maybe a bug for solr 4.6 when create a new core

Posted by YouPeng Yang <yy...@gmail.com>.
Hi Mark.

   Thanks for your reply.

    I will file a JIRA issue about the NPE.

   By the way,would you look through the Question 2. After I create a new
core with explicite shard and coreNodeName successfully,I can not create a
replica for above new core also with explicite coreNodeName and the same
shard and collection
  Request url as following:

http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test1&shard=Test&collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&coreNodeName=Test1

 It responses an error:
<response>
        <lst name="responseHeader">
       <int name="status">400</int>
         <int name="QTime">29</int>
  </lst>
  <lst name="error">
         <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
removed</str>
         <int name="code">400</int>
  </lst>
  </response>

   I find out that in the src class in  org.apache.solr.cloud.
ZkController line 1369~ 1384:
   As the code says,when I indicate a  coreNodeName and collection
explicitly,it goes to check a 'autoCreated' property of the Collection
which I have already created.

  My question :Why does it need to check the 'autoCreated' property,any
jira about this 'autoCreated' property? How can I make  through the check?


[1]-------------------------------------------------------------------------------------------------------------
    try {
      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");
             }
           }
         }
        }
      }
 --------------------------------------------------------------------------------------------------------------


Regards


2013/12/27 Mark Miller <ma...@gmail.com>

> If you are seeing an NPE there, sounds like you are on to something.
> Please file a JIRA issue.
>
> - Mark
>
> > On Dec 26, 2013, at 1:29 AM, YouPeng Yang <yy...@gmail.com>
> wrote:
> >
> > Hi
> >   Merry Christmas.
> >
> >   Before this mail,I am in trouble with a weird problem  for a few days
> > when to create a new core with both explicite shard and coreNodeName.
> And I
> > have posted a few mails  in the mailist,no one ever gives any
> > suggestions,maybe  they did not  encounter the same problem.
> >  I have to go through the srcs to check out the reason. Thanks god, I
> find
> > it. The reason to the problem,maybe be a bug, so I would like to report
> it
> > hoping to get your endorsement and confirmation.
> >
> >
> > In class org.apache.solr.cloud.Overseer the Line 360:
> > ---------------------------------------------------------------------
> >          if (sliceName !=null && collectionExists &&
> > !"true".equals(state.getCollection(collection).getStr("autoCreated"))) {
> >            Slice slice = state.getSlice(collection, sliceName);
> >            if (slice.getReplica(coreNodeName) == null) {
> >              log.info("core_deleted . Just return");
> >              return state;
> >            }
> >          }
> > ---------------------------------------------------------------------
> > the slice needs to be checked null .because I create a new core with both
> > explicite shard and coreNodeName, the state.getSlice(collection,
> > sliceName)  may return a null.So it needs to be checked ,or there will be
> > an NullpointException
> > ---------------------------------------------------------------------
> >          if (sliceName !=null && collectionExists &&
> > !"true".equals(state.getCollection(collection).getStr("autoCreated"))) {
> >            Slice slice = state.getSlice(collection, sliceName);
> >            if (*slice != null &&* slice.getReplica(coreNodeName) ==
> null) {
> >              log.info("core_deleted . Just return");
> >              return state;
> >            }
> >          }
> > ---------------------------------------------------------------------
> >
> > *Querstion 1*: Is this OK with the whole solr project,I have no aware
> > about the influences about the change,as right now ,it goes right. Please
> > make confirm about this.
> >
> >  After I fixed this prolem,I can create a core with the request:
> > http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test&
> > *shard=Test*
> >
> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
> > *coreNodeName=Test*
> >
> >  However when I create a replica within the same shard Test:
> > http://10.7.23.122:8080/solr/admin/cores?action=CREATE&*name=Test1*&
> > *shard=Test*
> >
> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
> > *coreNodeName=Test1*
> >
> >  It response an error:
> > <response>
> >        <lst name="responseHeader">
> >        <int name="status">400</int>
> >         <int name="QTime">29</int>
> > </lst>
> > <lst name="error">
> >          <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
> > removed</str>
> >          <int name="code">400</int>
> > </lst>
> > </response>
> >
> > I aslo find the reason the in the class
>  org.apache.solr.cloud.ZkController
> > line 1369~ 1384[1]
> > As the src here,it needs to check the autoCreated within an existing
> > collection
> > when the coreNodeName and shard were assigned manully. the autoCreated
> > property of a collection is not equal with true, it throws an exeption.
> >
> >  *Question2*: Why does it need  to check the 'autoCreated', and how could
> > I go through this check, or Is this another bug?
> >
> >
> >
> >
> >
> [1]-------------------------------------------------------------------------------------------------------------
> >    try {
> >      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");
> >             }
> >           }
> >         }
> >        }
> >      }
> >
> --------------------------------------------------------------------------------------------------------------
>

Re: Maybe a bug for solr 4.6 when create a new core

Posted by Mark Miller <ma...@gmail.com>.
If you are seeing an NPE there, sounds like you are on to something. Please file a JIRA issue.  

- Mark

> On Dec 26, 2013, at 1:29 AM, YouPeng Yang <yy...@gmail.com> wrote:
> 
> Hi
>   Merry Christmas.
> 
>   Before this mail,I am in trouble with a weird problem  for a few days
> when to create a new core with both explicite shard and coreNodeName. And I
> have posted a few mails  in the mailist,no one ever gives any
> suggestions,maybe  they did not  encounter the same problem.
>  I have to go through the srcs to check out the reason. Thanks god, I find
> it. The reason to the problem,maybe be a bug, so I would like to report it
> hoping to get your endorsement and confirmation.
> 
> 
> In class org.apache.solr.cloud.Overseer the Line 360:
> ---------------------------------------------------------------------
>          if (sliceName !=null && collectionExists &&
> !"true".equals(state.getCollection(collection).getStr("autoCreated"))) {
>            Slice slice = state.getSlice(collection, sliceName);
>            if (slice.getReplica(coreNodeName) == null) {
>              log.info("core_deleted . Just return");
>              return state;
>            }
>          }
> ---------------------------------------------------------------------
> the slice needs to be checked null .because I create a new core with both
> explicite shard and coreNodeName, the state.getSlice(collection,
> sliceName)  may return a null.So it needs to be checked ,or there will be
> an NullpointException
> ---------------------------------------------------------------------
>          if (sliceName !=null && collectionExists &&
> !"true".equals(state.getCollection(collection).getStr("autoCreated"))) {
>            Slice slice = state.getSlice(collection, sliceName);
>            if (*slice != null &&* slice.getReplica(coreNodeName) == null) {
>              log.info("core_deleted . Just return");
>              return state;
>            }
>          }
> ---------------------------------------------------------------------
> 
> *Querstion 1*: Is this OK with the whole solr project,I have no aware
> about the influences about the change,as right now ,it goes right. Please
> make confirm about this.
> 
>  After I fixed this prolem,I can create a core with the request:
> http://10.7.23.122:8080/solr/admin/cores?action=CREATE&name=Test&
> *shard=Test*
> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
> *coreNodeName=Test*
> 
>  However when I create a replica within the same shard Test:
> http://10.7.23.122:8080/solr/admin/cores?action=CREATE&*name=Test1*&
> *shard=Test*
> &collection.configName=myconf&schema=schema.xml&config=solrconfigLocal_default.xml&collection=defaultcol&
> *coreNodeName=Test1*
> 
>  It response an error:
> <response>
>        <lst name="responseHeader">
>        <int name="status">400</int>
>         <int name="QTime">29</int>
> </lst>
> <lst name="error">
>          <str name="msg">Error CREATEing SolrCore 'Test1': Test1 is
> removed</str>
>          <int name="code">400</int>
> </lst>
> </response>
> 
> I aslo find the reason the in the class  org.apache.solr.cloud.ZkController
> line 1369~ 1384[1]
> As the src here,it needs to check the autoCreated within an existing
> collection
> when the coreNodeName and shard were assigned manully. the autoCreated
> property of a collection is not equal with true, it throws an exeption.
> 
>  *Question2*: Why does it need  to check the 'autoCreated', and how could
> I go through this check, or Is this another bug?
> 
> 
> 
> 
> [1]-------------------------------------------------------------------------------------------------------------
>    try {
>      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");
>             }
>           }
>         }
>        }
>      }
> --------------------------------------------------------------------------------------------------------------