[
https://issues.apache.org/jira/browse/HBASE-5827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401801#comment-13401801
]
Jesse Yates commented on HBASE-5827:
------------------------------------
The alternative might we something like:
{noformat}
Set<ErrorHandler> CPerrorHandlers = …
…
loadCPs(){
for(cp : loadedCPs){
CPerrorHandlers.add( cp.getErrorHandler());
}
…
{noformat}
Conceptually, the success/failure handlers could be bound via a
Callback<success, failure> on the actual operation. The success handler would
just be the regular Observer (though maybe it might be worth looking into
abstracting that into another class that the Observer would return on request
to be added to the Callback). The failure handler would deal with the exception
and be preloaded with the rest of the context.
Conceptually, this is really close to how the CP host works already, so maybe
I'm just proposing just doing a class-name change - you've definitely thought
about this interface more that me :) Ideally, I would like to see the operation
just wrapped in a single handler that keeps track of the success/failure
observers, and calls them as necessary (without dealing with too much other
state, e.g. host != null feels clunky all over the place).
> [Coprocessors] Observer notifications on exceptions
> ---------------------------------------------------
>
> Key: HBASE-5827
> URL: https://issues.apache.org/jira/browse/HBASE-5827
> Project: HBase
> Issue Type: Improvement
> Components: coprocessors
> Reporter: Andrew Purtell
> Assignee: Andrew Purtell
>
> Benjamin Busjaeger wrote on dev@:
> {quote}
> Is there a reason that RegionObservers are not notified when a get/put/delete
> fails? Suppose I maintain some (transient) state in my Coprocessor that is
> created during preGet and discarded during postGet. If the get fails, postGet
> is not invoked, so I cannot remove the state.
> If there is a good reason, is there any other way to achieve the same thing?
> If not, would it be possible to add something the snippet below to the code
> base?
> {code}
> // pre-get CP hook
> if (withCoprocessor && (coprocessorHost != null)) {
> if (coprocessorHost.preGet(get, results)) {
> return results;
> }
> }
> + try{
> ...
> + } catch (Throwable t) {
> + // failed-get CP hook
> + if (withCoprocessor && (coprocessorHost != null)) {
> + coprocessorHost.failedGet(get, results);
> + }
> + rethrow t;
> + }
> // post-get CP hook
> if (withCoprocessor && (coprocessorHost != null)) {
> coprocessorHost.postGet(get, results);
> }
> {code}
> {quote}
--
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