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");
             }
           }
         }
        }
      }
--------------------------------------------------------------------------------------------------------------

Reply via email to