Hi Mark I have filed a jira about the NPE: https://issues.apache.org/jira/browse/SOLR-5580
2013/12/27 YouPeng Yang <yypvsxf19870...@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 <markrmil...@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 <yypvsxf19870...@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"); >> > } >> > } >> > } >> > } >> > } >> > >> -------------------------------------------------------------------------------------------------------------- >> > >