[ 
https://issues.apache.org/jira/browse/SOLR-14404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17154782#comment-17154782
 ] 

Chris M. Hostetter commented on SOLR-14404:
-------------------------------------------

we're seeing sporadic failures of TestContainerPlugin.testApiFromPackage in 
jenkins and Jira patch review builds.  these don't seem to reliably reproduce, 
and based on how/where they fail i'm guessing this is either a concurrency 
problem in the "real" code or a timing assumption in the test client code that 
isn't valid: the client sends a request to upload a new jar and that request 
finishes, but when the test client subsequently tries to send a request to 
"use" that new version it fails that the version isn't valid.

Here's what an example test failure looks like from junits perspective...
{noformat}
    [junit4]   2> NOTE: reproduce with: ant test  
-Dtestcase=TestContainerPlugin -Dtests.method=testApiFromPackage 
-Dtests.seed=52BF77C417B002F6 -Dtests.multiplier=2 -Dtests.slow=true 
-Dtests.locale=en-GB -Dtests.timezone=America/La_Paz -Dtests.asserts=true 
-Dtests.file.encoding=UTF-8
   [junit4] ERROR   11.6s J1 | TestContainerPlugin.testApiFromPackage <<<
   [junit4]    > Throwable #1: 
org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteExecutionException: 
Error from server at https://127.0.0.1:45705/solr: Error executing command
   [junit4]    >        at 
__randomizedtesting.SeedInfo.seed([52BF77C417B002F6:BFE18FB525FAD57F]:0)
   [junit4]    >        at 
org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteExecutionException.create(BaseHttpSolrClient.java:67)
   [junit4]    >        at 
org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:647)
   [junit4]    >        at 
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:266)
   [junit4]    >        at 
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:248)
   [junit4]    >        at 
org.apache.solr.client.solrj.impl.LBSolrClient.doRequest(LBSolrClient.java:389)
   [junit4]    >        at 
org.apache.solr.client.solrj.impl.LBSolrClient.request(LBSolrClient.java:359)
   [junit4]    >        at 
org.apache.solr.client.solrj.impl.BaseCloudSolrClient.sendRequest(BaseCloudSolrClient.java:1155)
   [junit4]    >        at 
org.apache.solr.client.solrj.impl.BaseCloudSolrClient.requestWithRetryOnStaleState(BaseCloudSolrClient.java:916)
   [junit4]    >        at 
org.apache.solr.client.solrj.impl.BaseCloudSolrClient.request(BaseCloudSolrClient.java:850)
   [junit4]    >        at 
org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:210)
   [junit4]    >        at 
org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:227)
   [junit4]    >        at 
org.apache.solr.handler.TestContainerPlugin.testApiFromPackage(TestContainerPlugin.java:265)
   [junit4]    >        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   [junit4]    >        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   [junit4]    >        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   [junit4]    >        at 
java.base/java.lang.reflect.Method.invoke(Method.java:566)
   [junit4]    >        at java.base/java.lang.Thread.run(Thread.java:834)
{noformat}
And here's a suspicious error from the log file (just before the test shards 
shutting down the nodes/zk) that seems to be the cause of the problem  ...
{noformat}
    [junit4]   2> 1392190 INFO  (zkCallback-17473-thread-1) [     ] 
o.a.s.c.SolrResourceLoader Added 1 libs to classloader, from paths: 
[/home/jenkins/jenkins-slave/workspace/PreCommit-SOLR-Build/sourcedir/solr/build/solr-core/test/J1/temp/solr.handler.TestContainerPlugin_52BF77C417B002F6-001/tempDir-002/node2/filestore/myplugin]
   [junit4]   2> 1392190 INFO  (zkCallback-17473-thread-1) [     ] 
o.a.s.p.PackageLoader version: 2.0 is the new latest in package: mypkg
   [junit4]   2> 1392191 INFO  (zkCallback-17435-thread-1) [     ] 
o.a.s.c.SolrResourceLoader Added 1 libs to classloader, from paths: 
[/home/jenkins/jenkins-slave/workspace/PreCommit-SOLR-Build/sourcedir/solr/build/solr-core/test/J1/temp/solr.handler.TestContainerPlugin_52BF77C417B002F6-001/tempDir-002/node3/filestore/myplugin]
   [junit4]   2> 1392191 INFO  (zkCallback-17435-thread-1) [     ] 
o.a.s.p.PackageLoader version: 2.0 is the new latest in package: mypkg
   [junit4]   2> 1392191 INFO  (qtp1162953234-28500) [n:127.0.0.1:33293_solr    
 ] o.a.s.s.HttpSolrCall [admin] webapp=null path=/cluster/package 
params={wt=javabin&version=2} status=0 QTime=28
   [junit4]   2> 1392191 INFO  (zkCallback-17418-thread-1) [     ] 
o.a.s.f.DistribPackageStore pub_key512.der does not exist locally, 
downloading.. 
   [junit4]   2> 1392192 INFO  (zkCallback-17438-thread-1) [     ] 
o.a.s.f.DistribPackageStore pub_key512.der does not exist locally, 
downloading.. 
   [junit4]   2> 1392193 INFO  (zkCallback-17438-thread-1) [     ] 
o.a.s.c.SolrResourceLoader Added 1 libs to classloader, from paths: 
[/home/jenkins/jenkins-slave/workspace/PreCommit-SOLR-Build/sourcedir/solr/build/solr-core/test/J1/temp/solr.handler.TestContainerPlugin_52BF77C417B002F6-001/tempDir-002/node4/filestore/myplugin]
   [junit4]   2> 1392193 INFO  (zkCallback-17438-thread-1) [     ] 
o.a.s.p.PackageLoader version: 2.0 is the new latest in package: mypkg
   [junit4]   2> 1392194 INFO  (zkCallback-17418-thread-1) [     ] 
o.a.s.f.DistribPackageStore pub_key512.der does not exist locally, 
downloading.. 
   [junit4]   2> 1392195 INFO  (zkCallback-17418-thread-1) [     ] 
o.a.s.c.SolrResourceLoader Added 1 libs to classloader, from paths: 
[/home/jenkins/jenkins-slave/workspace/PreCommit-SOLR-Build/sourcedir/solr/build/solr-core/test/J1/temp/solr.handler.TestContainerPlugin_52BF77C417B002F6-001/tempDir-002/node1/filestore/myplugin]
   [junit4]   2> 1392195 INFO  (zkCallback-17418-thread-1) [     ] 
o.a.s.p.PackageLoader version: 2.0 is the new latest in package: mypkg
   [junit4]   2> 1392195 ERROR (qtp383496068-28481) [n:127.0.0.1:45705_solr     
] o.a.s.a.AnnotatedApi Error executing command  
   [junit4]   2>           => 
org.apache.solr.api.ApiBag$ExceptionWithErrObject: Error executing command, 
errors: 
[{update=org.apache.solr.client.solrj.request.beans.PluginMeta@5f226d1d, 
errorMessages=[No such package version:mypkg:2.0 . available versions 
:[1.0]]}], 
   [junit4]   2>        at 
org.apache.solr.api.AnnotatedApi$Cmd.checkForErrorInPayload(AnnotatedApi.java:323)
   [junit4]   2> org.apache.solr.api.ApiBag$ExceptionWithErrObject: Error 
executing command
   [junit4]   2>        at 
org.apache.solr.api.AnnotatedApi$Cmd.checkForErrorInPayload(AnnotatedApi.java:323)
 ~[java/:?]
   [junit4]   2>        at 
org.apache.solr.api.AnnotatedApi$Cmd.invoke(AnnotatedApi.java:293) [java/:?]
   [junit4]   2>        at 
org.apache.solr.api.AnnotatedApi.call(AnnotatedApi.java:196) [java/:?]
{noformat}
 

> CoreContainer level custom requesthandlers
> ------------------------------------------
>
>                 Key: SOLR-14404
>                 URL: https://issues.apache.org/jira/browse/SOLR-14404
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Noble Paul
>            Assignee: Noble Paul
>            Priority: Major
>          Time Spent: 5h 20m
>  Remaining Estimate: 0h
>
> caveats:
>  * The class should be annotated with  {{org.apache.solr.api.EndPoint}}. 
> Which means only V2 APIs are supported
>  * The path should have prefix {{/api/plugin}}
> add a plugin
> {code:java}
> curl -X POST -H 'Content-type:application/json' --data-binary '
> {
>   "add": {
>   "name":"myplugin",
>   "class": "full.ClassName", 
>   "path-prefix" : "some-path-prefix"    
>   }
> }' http://localhost:8983/api/cluster/plugins
> {code}
> add a plugin from a package
> {code:java}
> curl -X POST -H 'Content-type:application/json' --data-binary '
> {
>   "add": {
>   "name":"myplugin", 
>   "class": "pkgName:full.ClassName" ,
>   "path-prefix" : "some-path-prefix"  ,  
>   "version: "1.0"   
>   }
> }' http://localhost:8983/api/cluster/plugins
> {code}
> remove a plugin
> {code:java}
> curl -X POST -H 'Content-type:application/json' --data-binary '
> {
>   "remove": "myplugin"
> }' http://localhost:8983/api/cluster/plugins
> {code}
> The configuration will be stored in the {{clusterprops.json}}
>  as
> {code:java}
> {
> "plugins" : {
> "myplugin" : {"class": "full.ClassName", "path-prefix" : "some-path-prefix" }
> }
> }
> {code}
> example plugin
> {code:java}
> public class MyPlugin {
>   private final CoreContainer coreContainer;
>   public MyPlugin(CoreContainer coreContainer) {
>     this.coreContainer = coreContainer;
>   }
>   @EndPoint(path = "/$path-prefix/path1",
>     method = METHOD.GET,
>     permission = READ)
>   public void call(SolrQueryRequest req, SolrQueryResponse rsp){
>     rsp.add("myplugin.version", "2.0");
>   }
> }
> {code}
> This plugin will be accessible on all nodes at 
> {{/api/some-path-prefix/path1}}. It's possible to add more methods at 
> different paths. Ensure that all paths start with {{$path-prefix}} because 
> that is the prefix in which the plugin is registered with. So 
> {{/some-path-prefix/path2}} , {{/some-path-prefix/my/deeply/nested/path}} are 
> all valid paths. 
> It's possible that the user chooses to register the plugin with a different 
> name. In that case , use a template variable as follows in paths 
> {{/cluster/some/other/path}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to