[
https://issues.apache.org/jira/browse/SOLR-7536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15121649#comment-15121649
]
Steve Rowe commented on SOLR-7536:
----------------------------------
[~kiranch] had this problem with Solr 5.3.1 and showed me the logs.
Here's what I think is happening:
In multi-replica managed schema SolrCloud setups that have a configset with a
schema resource named "schema.xml", each replica will try to rename the
"schema.xml" znode to "schema.xml.bak", but only one of them will succeed. The
others log the failure but ignore the exception.
But the code to change the schema's resourceName from "schema.xml" to
"managed-schema" (or whatever the configured managed schema resource name is)
is in the try block in ManagedIndexSchemaFactory.zkUgradeToManagedSchema()
*after* the znode renaming attempt[1], so in those replica(s) that lose the
race to rename the znode, the schema's resourceName stays at "schema.xml".
As of Solr 5.0 (and SOLR-6913), the shipped managed schema configsets have
their schema file named "managed-resource", so the znode never has to be
renamed, and this bug isn't being triggered.
I think the fix is to change the schema's resourceName before attempting to
rename the "schema.xml" znode to "schema.xml.bak".
[1]
https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/schema/ManagedIndexSchemaFactory.java#L352
> adding fields to newly created managed-schema could sometimes cause error
> --------------------------------------------------------------------------
>
> Key: SOLR-7536
> URL: https://issues.apache.org/jira/browse/SOLR-7536
> Project: Solr
> Issue Type: Bug
> Reporter: Zilo Zongh
> Assignee: Steve Rowe
>
> When using managed schema in SolrCloud, adding fields into schema would
> SOMETIMES end up prompting "Can't find resource 'schema.xml' in classpath or
> '/configs/collectionName', cwd=/export/solr/solr-5.1.0/server", there is of
> course no schema.xml in configs, but 'schema.xml.bak' and 'managed-schema'
> Code to upload configs and create collection:
> Path tempPath = getConfigPath();
> client.uploadConfig(tempPath, name); //customized
> configs with solrconfig.xml using ManagedIndexSchemaFactory
>
> if(numShards==0){
> numShards = getNumNodes(client);
> }
>
> Create request = new CollectionAdminRequest.Create();
> request.setCollectionName(name);
> request.setNumShards(numShards);
> replicationFactor =
> (replicationFactor==0?DEFAULT_REPLICA_FACTOR:replicationFactor);
> request.setReplicationFactor(replicationFactor);
>
> request.setMaxShardsPerNode(maxShardsPerNode==0?replicationFactor:maxShardsPerNode);
> CollectionAdminResponse response =
> request.process(client);
> adding fields to schema, either by curl or by httpclient, would sometimes
> yield the following error, but the error can be fixed by RELOADING the newly
> created collection once or several times:
> INFO - [{ "responseHeader":{ "status":500, "QTime":5},
> "errors":["Error reading input String Can't find resource 'schema.xml' in
> classpath or '/configs/collectionName', cwd=/export/solr/solr-5.1.0/server"],
> "error":{ "msg":"Can't find resource 'schema.xml' in classpath or
> '/configs/collectionName', cwd=/export/solr/solr-5.1.0/server",
> "trace":"java.io.IOException: Can't find resource 'schema.xml' in classpath
> or '/configs/collectionName', cwd=/export/solr/solr-5.1.0/server
>
> at
> org.apache.solr.cloud.ZkSolrResourceLoader.openResource(ZkSolrResourceLoader.java:98)
> at
> org.apache.solr.schema.SchemaManager.getFreshManagedSchema(SchemaManager.java:421)
> at
> org.apache.solr.schema.SchemaManager.doOperations(SchemaManager.java:104)
> at
> org.apache.solr.schema.SchemaManager.performOperations(SchemaManager.java:94)
> at
> org.apache.solr.handler.SchemaHandler.handleRequestBody(SchemaHandler.java:57)
> at
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
> at org.apache.solr.core.SolrCore.execute(SolrCore.java:1984)
> at
> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:829)
> at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:446)
> at
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:220)
> at
> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
> at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
> at
> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
> at
> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
> at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
> at
> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
> at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
> at
> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
> at org.eclipse.jetty.server.Server.handle(Server.java:368)
> at
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
> at
> org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
> at
> org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:953)
> at
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1014)
> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:861)
> at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
> at
> org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
> at
> org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
> at java.lang.Thread.run(Thread.java:745)\n", "code":500}}]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]