sigram opened a new pull request #60:
URL: https://github.com/apache/solr/pull/60


   The solution implemented in this PR is a loose port of the `SimScenario` 
package from Solr 8.x, which was designed for running reproducible scenarios 
for the autoscaling framework.
   
   I re-worked the DSL and removed commands that are not applicable in the 
current context. The functionality is as follows:
   
   * two scripts can be supplied using system properties: `-DinitScript=...` 
and `-DshutdownScript=...`, which specify a text file resource (either absolute 
or relative to Solr home).
   * each script consists of series of operations that perform collection 
commands (plus some rudimentary conditionals, wait for state, asserts, etc)
   * operation parameters may use variable substitution, using either system 
properties or references to results of the previous operations. A shared 
context is provided where scripts may keep additional state between operations.
   * several context variables are filled in based on the current node 
environment.
   
   Example of an init script that uses a context variable `_node_name_` and a 
set of system properties defined by user: `collection`, `shard` to add a 
replica after startup and make sure it's operational - and if not the script 
will shut down the `CoreContainer`:
   
   ```
   # any errors will result in CC shutdown
   set key=_error_handling_&value=FATAL
   
   # request ADDREPLICA using sysprop values for collection and shard, and a 
context var for this node name
   request 
/admin/collections?action=ADDREPLICA&collection=${collection}&shard=${shard}&type=NRT&node=${_node_name_}
   
   # put the resulting core name in a context var 'newReplica'
   set key=newReplica&value=${_last_result_/result/success[0]/value/core}
   
   # wait for the new replica to become active
   wait_replica collection=${collection}&core=${newReplica}&state=ACTIVE
   
   # log replica name
   log 
key=_last_result_/result[0]/key&format=******%20Replica%20name:%20{}%20******
   
   # end of script
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to