diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java index 61c71cb8f93..10e569b34a0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java @@ -559,8 +559,7 @@ public abstract class CoprocessorHost observerGetter, User user, boolean bypassable) { - super(user != null? user: RpcServer.getRequestUser().orElse(null), - bypassable, bypassable/*'completable': make completable same as bypassable*/); + super(user != null? user: RpcServer.getRequestUser().orElse(null), bypassable); this.observerGetter = observerGetter; } @@ -678,10 +677,6 @@ public abstract class CoprocessorHost { * that the replacement for the bypassed code takes care of all necessary * skipped concerns. Because those concerns can change at any point, such an * assumption is never safe.

- * @see #complete() */ void bypass(); - /** - * Call to skip out on calling remaining coprocessors in current execution chain (there may be - * more than one coprocessor chained to a method call). Implies that this coprocessor's response - * is definitive. - *

Since hbase-2.0.0, only complete of 'bypassable' methods has an effect. See - * javadoc on the Coprocessor Observer method as to whether bypass (and thereby 'complete') is - * supported. This behavior of honoring only a subset of methods is new since hbase-2.0.0. - * @see #bypass() - */ - void complete(); - /** * Returns the active user for the coprocessor call. If an explicit {@code User} instance was * provided to the constructor, that will be returned, otherwise if we are in the context of an diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContextImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContextImpl.java index bdd6fec45bd..b52c23188de 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContextImpl.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContextImpl.java @@ -21,11 +21,9 @@ import java.util.Optional; import com.google.common.annotations.VisibleForTesting; import org.apache.hadoop.hbase.CoprocessorEnvironment; -import org.apache.hadoop.hbase.HBaseInterfaceAudience; import org.apache.hadoop.hbase.ipc.RpcServer; import org.apache.hadoop.hbase.security.User; import org.apache.yetus.audience.InterfaceAudience; -import org.apache.yetus.audience.InterfaceStability; /** * This is the only implementation of {@link ObserverContext}, which serves as the interface for @@ -39,21 +37,15 @@ public class ObserverContextImpl implements Ob * Is this operation bypassable? */ private final boolean bypassable; - /** - * Is this operation completable? - */ - private boolean complete; - private final boolean completable; private final User caller; public ObserverContextImpl(User caller) { - this(caller, false, false); + this(caller, false); } - public ObserverContextImpl(User caller, boolean bypassable, boolean completable) { + public ObserverContextImpl(User caller, boolean bypassable) { this.caller = caller; this.bypassable = bypassable; - this.completable = completable; } public E getEnvironment() { @@ -75,17 +67,6 @@ public class ObserverContextImpl implements Ob bypass = true; } - public boolean isCompleable() { - return this.completable; - }; - - public void complete() { - if (!this.completable) { - throw new UnsupportedOperationException("This method does not support 'complete'."); - } - complete = true; - } - /** * @return {@code true}, if {@link ObserverContext#bypass()} was called by one of the loaded * coprocessors, {@code false} otherwise. @@ -101,21 +82,6 @@ public class ObserverContextImpl implements Ob return false; } - /** - * @return {@code true}, if {@link ObserverContext#complete()} was called by one of the loaded - * coprocessors, {@code false} otherwise. - */ - public boolean shouldComplete() { - if (!isCompleable()) { - return false; - } - if (complete) { - complete = false; - return true; - } - return false; - } - public Optional getCaller() { return Optional.ofNullable(caller); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java index 4b8e3b8e31f..7ac0a7e7aed 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java @@ -310,9 +310,6 @@ public interface RegionObserver { * Called before the client performs a Get *

* Call CoprocessorEnvironment#bypass to skip default actions - *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors * @param c the environment provided by the region server * @param get the Get request * @param result The result to return to the client if default processing @@ -325,9 +322,6 @@ public interface RegionObserver { /** * Called after the client performs a Get *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'result' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -341,9 +335,6 @@ public interface RegionObserver { * Called before the client tests for existence using a Get. *

* Call CoprocessorEnvironment#bypass to skip default actions - *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors * @param c the environment provided by the region server * @param get the Get request * @param exists the result returned by the region server @@ -356,9 +347,6 @@ public interface RegionObserver { /** * Called after the client tests for existence using a Get. - *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors * @param c the environment provided by the region server * @param get the Get request * @param exists the result returned by the region server @@ -374,9 +362,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'put' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -390,9 +375,6 @@ public interface RegionObserver { /** * Called after the client stores a value. *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'put' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -408,9 +390,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'delete' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -425,8 +404,6 @@ public interface RegionObserver { * Called before the server updates the timestamp for version delete with latest timestamp. *

* Call CoprocessorEnvironment#bypass to skip default actions - *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors * @param c the environment provided by the region server * @param mutation - the parent mutation associated with this delete cell * @param cell - The deleteColumn with latest version cell @@ -443,9 +420,6 @@ public interface RegionObserver { /** * Called after the client deletes a value. *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'delete' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -523,9 +497,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'put' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -554,9 +525,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'put' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -579,9 +547,6 @@ public interface RegionObserver { /** * Called after checkAndPut *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'put' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -605,9 +570,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'delete' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -635,9 +597,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'delete' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -659,9 +618,6 @@ public interface RegionObserver { /** * Called after checkAndDelete *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'delete' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -685,9 +641,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'append' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -708,9 +661,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'append' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -725,9 +675,6 @@ public interface RegionObserver { /** * Called after Append *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'append' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -745,9 +692,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'increment' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -768,8 +712,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors - *

* Note: Do not retain references to any Cells in 'increment' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @@ -788,9 +730,6 @@ public interface RegionObserver { /** * Called after increment *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells in 'increment' beyond the life of this invocation. * If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -806,9 +745,6 @@ public interface RegionObserver { /** * Called before the client opens a new scanner. *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells returned by scanner, beyond the life of this * invocation. If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -821,9 +757,6 @@ public interface RegionObserver { /** * Called after the client opens a new scanner. *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells returned by scanner, beyond the life of this * invocation. If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -841,9 +774,6 @@ public interface RegionObserver { *

* Call CoprocessorEnvironment#bypass to skip default actions *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells returned by scanner, beyond the life of this * invocation. If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -863,9 +793,6 @@ public interface RegionObserver { /** * Called after the client asks for the next row on a scanner. *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors - *

* Note: Do not retain references to any Cells returned by scanner, beyond the life of this * invocation. If need a Cell reference for later use, copy the cell and use that. * @param c the environment provided by the region server @@ -910,9 +837,6 @@ public interface RegionObserver { * Called before the client closes a scanner. *

* Call CoprocessorEnvironment#bypass to skip default actions - *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors * @param c the environment provided by the region server * @param s the scanner */ @@ -921,9 +845,6 @@ public interface RegionObserver { /** * Called after the client closes a scanner. - *

- * Call CoprocessorEnvironment#complete to skip any subsequent chained - * coprocessors * @param ctx the environment provided by the region server * @param s the scanner */ diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/compactions/TestMobCompactor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/compactions/TestMobCompactor.java index 3f4633aee0f..54071d081d5 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/compactions/TestMobCompactor.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/compactions/TestMobCompactor.java @@ -741,7 +741,6 @@ public class TestMobCompactor { candidates.remove(0); } c.bypass(); - c.complete(); } } }