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

Andrew Purtell commented on HBASE-2396:
---------------------------------------

Coprocessors provide two extension surfaces, Observers (triggers) and Endpoints 
(stored procedures). We can provide access to both in a first cut via a system 
coprocessor that manages scriptlet execution. Consider:

* Ruby embedding by default, since the JRuby jar is already available.

* JavaScript embedding, since this will be a very popular request if it is not 
available as an option, and since packaging Rhino into the scripting 
coprocessor artifact with Maven should be easy enough.

* Support storing scriptlets for trigger-style execution at table, 
column[:qualifier], or row scope. 
** User should be able to specify if the scriptlet should run at read time or 
write time or both.
** Store scriptlet state in a metacolumn, similar to HBASE-2893, but privately 
managed to punt on issues of cross coprocessor dependencies and API invocation.
** The scriptlet execution host can wrap every Get or Scan with a custom filter 
that transforms or generates values according to entries in the metacolumn 
scanned internally at setup time. Implies that wherever the user specifies the 
location of a generator instead of a real value we must still store a 
placeholder.
** We also need to consider how this wrapper will interact with the 
AccessController's RegionScanner wrapper: Because the AccessController is first 
in any CP chain by priority it will already be filtering out placeholders the 
current subject doesn't have read or write access to, but how to handle EXEC 
permission may need some thought.

* Restrict scriptlets as observers to DML operations.
** We can expose a callback interface in the scripting environment on region 
operations with a small and familiar Document Object Model. Set up the DOM in 
the scripting environment(s) when the scriptlet host initializes. Call up into 
the DOM from Observer hooks at the Java level. See [JRuby 
embedding|https://github.com/jruby/jruby/wiki/RedBridge] and [Rhino 
embedding|http://www.mozilla.org/rhino/tutorial.html].


* Provide the Endpoint interface Stack mentioned in the above comment.
** The first cut Exec API could be {{String execute(String language, String 
script)}}
                
> Coprocessors: Server side dynamic scripting language execution
> --------------------------------------------------------------
>
>                 Key: HBASE-2396
>                 URL: https://issues.apache.org/jira/browse/HBASE-2396
>             Project: HBase
>          Issue Type: New Feature
>          Components: coprocessors
>            Reporter: Todd Lipcon
>            Assignee: Andrew Purtell
>
> There are a lot of use cases where users want to perform some simple 
> operations on the region server. For example, a row may represent a Set and 
> users want append/search/remove style operations within the row without 
> having to perform the work on the client side. One possible solution is to 
> embed a small language something like PL/SQL (not necessarily in syntax) 
> which restricts users to a safe set of operations.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to