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

Jan Høydahl commented on SOLR-13661:
------------------------------------

Thanks for adding some high level design spec. I really like the distributed 
blob system, and how a node can bootstrap from other nodes by pulling needed 
jars. And the isolated class loaders that can just swap out a plugin with a new 
one. I also have some questions:
 # How would e.g. SolrCell / Tika contrib be defined as a package? It has some 
42 dependency jars. Guess through a blobs array?
 # If you DELETE a package a package through {{/api/cluster/packages}}, how 
will it know what blobs to delete and which to leave? Another package may have 
the exact same dependency jar with the same hash
 # Why do you need a {{package="pkg_name"}} in addition to 
{{class="my.plugin.Class}}? That sounds very invasive, since we'd need to add 
such package qualifiers to schema, security.json, solr.xml and virtually 
everywhere? I guess it is an explicit way of selecting class loader and 
obtaining isolation, but is there a smarter, less invasive way?
 # You say that the version is not used by the system. So time comes to upgrade 
Solr, how do you weed out the incompatible packages

> A package management system for Solr
> ------------------------------------
>
>                 Key: SOLR-13661
>                 URL: https://issues.apache.org/jira/browse/SOLR-13661
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Noble Paul
>            Priority: Major
>              Labels: package
>         Attachments: plugin-usage.png, repos.png
>
>
> Solr needs a unified cohesive package management system so that users can 
> deploy/redeploy plugins in a safe manner. This is an umbrella issue to 
> eventually build that solution
> h2. What is a package?
> A package has 2 parts 
>  * The {{jar}} binaries which may contain standard plugins (or even other 
> libraries). It does not expect anything special. Basically , any jar file can 
> be added into a package
>  * The configuration in ZK. The structure is as follows
> {code:json}
> {
>   "name": "package-name",
>   "version": "some-version-string",
>   "blob": {
>     "sha256": "the-sha256-of-the-blob",
>     "sig": "signature-signed-with-your-private-key",
>     "name": "some-identifier"
>   }
> }
> // use the following format for your multi jar package
> {
>   "name": "package-name",
>   "version": "some-version-string",
>   "blobs": [
>     {
>       "sha256": "the-sha256-of-the-blob",
>       "sig": "signature-signed-with-your-private-key",
>       "name": "some-identifier"
>     }
>   ]
> }
> {code}
>  * {{*name*}} : this is identifier used to access the package
>  * {{*version*}}: This is not consumed by the system. But, it is required so 
> that the user can make out which version is being used
>  * {{*blob/sha256*}}: The sha256 of the blob. You should have uploaded this 
> blob into the new FS blob store
>  * {{*blob/sig*}} : signature. ensure that your public keys are already there 
> in {{/keys/exe}} in ZK
>  * {{blob/name}} : a friendly identifier (not required)
> Voila! this is all you need to have a package in Solr
> Every package gets its own isolated unique classloader in a Solr node. The 
> classloader is a child of the {{CoreContainer}} classloader. Basically, your 
> classes have to be either in the root classloader or in the blobs in your 
> package
> h2. What are the components of this system?
> h3. {{PackageResourceLoader}} class
> This is a standard {{SolrResourceLoader}} . It has all the blobs of a package 
> in its classpath.
> h3. {{PackageManager}} class
> This is a registry of all Package classloaders . essentially a {{Map<String, 
> PackageResourceLoader>}}
>  This class is responsible for listening to the state changes in ZK to the 
> packages ADD/UPDATE/DELETE operations.
>  * ADD : create a new {{PackageResourceLoader}} and add it to the registry
>  * UPDATE: create a new {{PackageResourceLoader}}, update the registry and 
> notify every listener
>  * DELETE: remove a {{PackageResourceLoader}}
> h4. The Public APIs
>  * {{GET /api/cluster/packages}} : Get a list of all registered packages
>  * {{POST /api/cluster/packages}}
> ** {{add}} command: create a new package
> ** {{add}} command: update an existing package
> ** {{delete}} command: delete an existing package
> h4. configuring your plugins to use packages
>  * in your {{solrconfig.xml}}
> {code:xml}
> <requestHandler name="/my_handler" class="my.full.ClassName" 
> package="pkg_name">
> </requestHandler>
> {code}
>  * using config API
> {code:xml}
> {
> "add-requesthandler": {"name":""/my_handler", "class":"my.full.ClassName",  
> "package":"pkg_name"
>  }
> }
> {code}
> h4. Example hot loading schema from package (TBD)
> {code:java}
> <schemaFactory class="ClassicIndexSchemaFactory" package= "pkg_name"/>
> {code}
> h4. verifying your components
> {code:java}
> GET /solr/<collection-name>/config/<component-type>/component-name?meta=true
> {code}
> This API would return the component configuration and curerent package being 
> used as follows
> {code:json}
> { 
>   "config": {
>     "requestHandler": {
>       "/my_handler": {
>         "name": "/my_handler",
>         "class": "org.apache.solr.core.RuntimeLibReqHandler",
>         "package": "global",
>         "_packageinfo_": {
>           "name": "global",
>           "version": "1",
>           "blob": {
>             "sha256": 
> "e1f9e23988c19619402f1040c9251556dcd6e02b9d3e3b966a129ea1be5c70fc",
>             "sig": 
> "L3q/qIGs4NaF6JiO0ZkMUFa88j0OmYc+I6O7BOdNuMct/xoZ4h73aZHZGc0+nmI1f/U3bOlMPINlSOM6LK3JpQ=="
>           }
>         }
>       }
>     }}}
> {code}
> h3.  The Listeners
> Listeners listen to changes to packages. They get notified and they can take 
> appropriate action
>  h3. {{PackagePluginHolder}}
> This is a special {{PluginHolder}} that is a {{PackageListener}} . Whenever 
> it gets a notification of a package update , it reinitializes the plugin it's 
> holding and throw away the old one
> h2. {{FsBlobStore}} a.k.a FIle System Blob Store
> This is a fully replicated file system blob store.
>  * It lives at {{<solr.home>/blobs}} on each Solr node
>  * Every blob is a file. The file name is the sha256 of the blob
> When the {{FsBlobStore}} is requested a blob, it
>  * looks up in the local file store for the file
>  * If not found, it asks the blob store in every other node in the cluster 
> one by one
>  ** After it finds a node, the blob is downloaded and persisted to the local 
> file system
>  h3. public APIs
>  * {{POST /api/cluster/blob}} : create a new blob in the system. The 
> {{sha256}} is computed and it is saved as a file.
>  * * This API asks other nodes to download the blob.
>  * {{GET /api/node/blob}} : List of all the locally available blobs
>  * {{GET /api/node/blob/<sha256>}} : Download a blob
> h2. The CLI PackageManager
> <TBD>



--
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