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?


<https://github.com/apache/hbase/blob/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java#L4073> https://github.com/apache/hbase/blob/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java#L4067
    // 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);
    }


Thanks,
Ben

Reply via email to