HBASE-17312 Use 'default' keyword in coprocessor Observer interfaces to get rid of 'Base...Observer' implementations. Some javadoc improvements too.

Reason for refactor:
In cases where one might need to use multiple observers, say region, master and regionserver; and the fact that only one class can be extended, it gives rise to following pattern:

public class BaseMasterAndRegionObserver
  extends BaseRegionObserver
  implements MasterObserver

class AccessController
  extends BaseMasterAndRegionObserver
  implements RegionServerObserver

were BaseMasterAndRegionObserver is full copy of BaseMasterObserver.

There is an example of simple case too where the current design fails.
Say only one observer is needed by the coprocessor, but the design doesn't permit extending even that single observer (see RSGroupAdminEndpoint), that leads to copy of full Bas
e...Observer class into coprocessor class leading to 1000s of lines of code and this ugly mix of 5 main functions with 100 useless functions.

Javadocs changes:
- Adds class comments on 'default' methods and expectations.
- Adds explanaiton of Exception handling in Observers' class comment. Removes redundant @throws before each function.
- Improves javadocs for a bunch of functions
- deletes empty @params in a bunch of places

Change-Id: I265738d47e8554e7b4678e88bb916a0cc7d00ab3
This commit is contained in:
Apekshit Sharma 2017-02-15 13:07:21 -08:00
parent e7d16db2ac
commit f444b3b542
79 changed files with 949 additions and 4761 deletions

View File

@ -54,8 +54,8 @@ public interface Coprocessor {
}
// Interface
void start(CoprocessorEnvironment env) throws IOException;
default void start(CoprocessorEnvironment env) throws IOException {}
void stop(CoprocessorEnvironment env) throws IOException;
default void stop(CoprocessorEnvironment env) throws IOException {}
}

View File

@ -117,7 +117,7 @@ public class TestHTableDescriptor {
public void testGetSetRemoveCP() throws Exception {
HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(name.getMethodName()));
// simple CP
String className = "org.apache.hadoop.hbase.coprocessor.BaseRegionObserver";
String className = "org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver";
// add and check that it is present
desc.addCoprocessor(className);
assertTrue(desc.hasCoprocessor(className));
@ -134,7 +134,7 @@ public class TestHTableDescriptor {
public void testSetListRemoveCP() throws Exception {
HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(name.getMethodName()));
// simple CP
String className1 = "org.apache.hadoop.hbase.coprocessor.BaseRegionObserver";
String className1 = "org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver";
String className2 = "org.apache.hadoop.hbase.coprocessor.SampleRegionWALObserver";
// Check that any coprocessor is present.
assertTrue(desc.getCoprocessors().isEmpty());

View File

@ -54,6 +54,8 @@ public class TestClassLoading {
private static final Log LOG = LogFactory.getLog(TestClassLoading.class);
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
public static class TestMasterCoprocessor implements MasterObserver {}
private static MiniDFSCluster cluster;
static final TableName tableName = TableName.valueOf("TestClassLoading");
@ -68,7 +70,7 @@ public class TestClassLoading {
// TOOD: Fix the import of this handler. It is coming in from a package that is far away.
private static Class<?> regionCoprocessor2 = TestServerCustomProtocol.PingHandler.class;
private static Class<?> regionServerCoprocessor = SampleRegionWALObserver.class;
private static Class<?> masterCoprocessor = BaseMasterObserver.class;
private static Class<?> masterCoprocessor = TestMasterCoprocessor.class;
private static final String[] regionServerSystemCoprocessors =
new String[]{
@ -109,7 +111,7 @@ public class TestClassLoading {
static File buildCoprocessorJar(String className) throws Exception {
String code = "import org.apache.hadoop.hbase.coprocessor.*;" +
"public class " + className + " extends BaseRegionObserver {}";
"public class " + className + " implements RegionObserver {}";
return ClassLoaderTestHelper.buildJar(
TEST_UTIL.getDataTestDir().toString(), className, code);
}

View File

@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseMasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.metrics.Counter;
@ -45,7 +45,7 @@ import org.apache.hadoop.hbase.metrics.Timer;
* </p>
* @see ExampleRegionObserverWithMetrics
*/
public class ExampleMasterObserverWithMetrics extends BaseMasterObserver {
public class ExampleMasterObserverWithMetrics implements MasterObserver {
private static final Log LOG = LogFactory.getLog(ExampleMasterObserverWithMetrics.class);
@ -69,7 +69,6 @@ public class ExampleMasterObserverWithMetrics extends BaseMasterObserver {
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
super.preCreateTable(ctx, desc, regions);
// we rely on the fact that there is only 1 instance of our MasterObserver. We keep track of
// when the operation starts before the operation is executing.
this.createTableStartTime = System.currentTimeMillis();
@ -78,7 +77,6 @@ public class ExampleMasterObserverWithMetrics extends BaseMasterObserver {
@Override
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
super.postCreateTable(ctx, desc, regions);
if (this.createTableStartTime > 0) {
long time = System.currentTimeMillis() - this.createTableStartTime;
LOG.info("Create table took: " + time);
@ -90,16 +88,12 @@ public class ExampleMasterObserverWithMetrics extends BaseMasterObserver {
@Override
public void preDisableTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName) throws IOException {
super.preDisableTable(ctx, tableName);
// Increment the Counter for disable table operations
this.disableTableCounter.increment();
}
@Override
public void start(CoprocessorEnvironment env) throws IOException {
super.start(env);
// start for the MasterObserver will be called only once in the lifetime of the
// server. We will construct and register all metrics that we will track across method
// invocations.

View File

@ -27,9 +27,9 @@ import java.util.concurrent.ThreadLocalRandom;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.metrics.Counter;
import org.apache.hadoop.hbase.metrics.MetricRegistry;
import org.apache.hadoop.hbase.metrics.Timer;
@ -45,7 +45,7 @@ import org.apache.hadoop.hbase.metrics.Timer;
*
* @see ExampleMasterObserverWithMetrics
*/
public class ExampleRegionObserverWithMetrics extends BaseRegionObserver {
public class ExampleRegionObserverWithMetrics implements RegionObserver {
private Counter preGetCounter;
private Timer costlyOperationTimer;
@ -53,8 +53,6 @@ public class ExampleRegionObserverWithMetrics extends BaseRegionObserver {
@Override
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results)
throws IOException {
super.preGetOp(e, get, results);
// Increment the Counter whenever the coprocessor is called
preGetCounter.increment();
}
@ -62,8 +60,6 @@ public class ExampleRegionObserverWithMetrics extends BaseRegionObserver {
@Override
public void postGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get,
List<Cell> results) throws IOException {
super.postGetOp(e, get, results);
// do a costly (high latency) operation which we want to measure how long it takes by
// using a Timer (which is a Meter and a Histogram).
long start = System.nanoTime();
@ -83,8 +79,6 @@ public class ExampleRegionObserverWithMetrics extends BaseRegionObserver {
@Override
public void start(CoprocessorEnvironment env) throws IOException {
super.start(env);
// start for the RegionServerObserver will be called only once in the lifetime of the
// server. We will construct and register all metrics that we will track across method
// invocations.
@ -116,6 +110,5 @@ public class ExampleRegionObserverWithMetrics extends BaseRegionObserver {
public void stop(CoprocessorEnvironment e) throws IOException {
// we should NOT remove / deregister the metrics in stop(). The whole registry will be
// removed when the last region of the table is closed.
super.stop(e);
}
}

View File

@ -29,9 +29,9 @@ import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.client.IsolationLevel;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.regionserver.HStore;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
@ -63,7 +63,7 @@ import org.apache.zookeeper.ZooKeeper;
* because RegionObservers come and go and currently
* listeners registered with ZooKeeperWatcher cannot be removed.
*/
public class ZooKeeperScanPolicyObserver extends BaseRegionObserver {
public class ZooKeeperScanPolicyObserver implements RegionObserver {
public static final String node = "/backup/example/lastbackup";
public static final String zkkey = "ZK";
private static final Log LOG = LogFactory.getLog(ZooKeeperScanPolicyObserver.class);
@ -171,11 +171,6 @@ public class ZooKeeperScanPolicyObserver extends BaseRegionObserver {
}
}
@Override
public void stop(CoprocessorEnvironment e) throws IOException {
// nothing to do here
}
protected ScanInfo getScanInfo(Store store, RegionCoprocessorEnvironment e) {
byte[] data = ((ZKWatcher)e.getSharedData().get(zkkey)).getData();
if (data == null) {

View File

@ -46,9 +46,9 @@ import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
@ -152,7 +152,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
private boolean load = false;
private boolean check = false;
public static class SlowMeCoproScanOperations extends BaseRegionObserver {
public static class SlowMeCoproScanOperations implements RegionObserver {
static final AtomicLong sleepTime = new AtomicLong(2000);
Random r = new Random();
AtomicLong countOfNext = new AtomicLong(0);

View File

@ -303,890 +303,4 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService implements Coproce
NamespaceDescriptor ns) throws IOException {
preCreateNamespace(ctx, ns);
}
@Override
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc,
HRegionInfo[] regions) throws IOException {
}
@Deprecated
@Override
public void preCreateTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc,
HRegionInfo[] regions) throws IOException {
}
@Override
public void preCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HTableDescriptor desc,
final HRegionInfo[] regions) throws IOException {
}
@Deprecated
@Override
public void postCreateTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc,
HRegionInfo[] regions) throws IOException {
}
@Override
public void postCompletedCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HTableDescriptor desc,
final HRegionInfo[] regions) throws IOException {
}
@Override
public void preDeleteTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Deprecated
@Override
public void preDeleteTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void preDeleteTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName) throws IOException {
}
@Deprecated
@Override
public void postDeleteTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void postCompletedDeleteTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName) throws IOException {
}
@Override
public void preTruncateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void postTruncateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Deprecated
@Override
public void preTruncateTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void preTruncateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName) throws IOException {
}
@Deprecated
@Override
public void postTruncateTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void postCompletedTruncateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName) throws IOException {
}
@Override
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HTableDescriptor htd) throws IOException {
}
@Override
public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HTableDescriptor htd) throws IOException {
}
@Deprecated
@Override
public void preModifyTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HTableDescriptor htd) throws IOException {
}
@Override
public void preModifyTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HTableDescriptor htd) throws IOException {
}
@Deprecated
@Override
public void postModifyTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HTableDescriptor htd) throws IOException {
}
@Override
public void postCompletedModifyTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HTableDescriptor htd) throws IOException {
}
@Override
public void preAddColumn(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void postAddColumn(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void postAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void preAddColumnHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void preAddColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void postAddColumnHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void postCompletedAddColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void preModifyColumn(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void postModifyColumn(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void postModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName, HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void preModifyColumnHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName, HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void preModifyColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily)
throws IOException {
}
@Deprecated
@Override
public void postModifyColumnHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws
IOException {
}
@Override
public void postCompletedModifyColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily)
throws IOException {
}
@Override
public void preDeleteColumn(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName, byte[] columnFamily) throws IOException {
}
@Override
public void preDeleteColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName, byte[] columnFamily) throws IOException {
}
@Override
public void postDeleteColumn(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName, byte[] columnFamily) throws IOException {
}
@Override
public void postDeleteColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName, byte[] columnFamily) throws IOException {
}
@Deprecated
@Override
public void preDeleteColumnHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName, byte[] columnFamily) throws IOException {
}
@Override
public void preDeleteColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final byte[] columnFamily) throws
IOException {
}
@Deprecated
@Override
public void postDeleteColumnHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, byte[] columnFamily) throws IOException {
}
@Override
public void postCompletedDeleteColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final byte[] columnFamily) throws
IOException {
}
@Override
public void preEnableTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName) throws IOException {
}
@Override
public void postEnableTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName) throws IOException {
}
@Deprecated
@Override
public void preEnableTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName) throws IOException {
}
@Override
public void preEnableTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName) throws IOException {
}
@Deprecated
@Override
public void postEnableTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName) throws IOException {
}
@Override
public void postCompletedEnableTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName) throws IOException {
}
@Override
public void preDisableTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName) throws IOException {
}
@Override
public void postDisableTable(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName) throws IOException {
}
@Deprecated
@Override
public void preDisableTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName) throws IOException {
}
@Override
public void preDisableTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName) throws IOException {
}
@Deprecated
@Override
public void postDisableTableHandler(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void postCompletedDisableTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName) throws IOException {
}
@Override
public void preMove(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo region,
ServerName srcServer, ServerName destServer) throws IOException {
}
@Override
public void postMove(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo region,
ServerName srcServer, ServerName destServer) throws IOException {
}
@Override
public void preAssign(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo
regionInfo) throws IOException {
}
@Override
public void postAssign(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo
regionInfo) throws IOException {
}
@Override
public void preUnassign(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo
regionInfo, boolean force) throws IOException {
}
@Override
public void postUnassign(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo
regionInfo, boolean force) throws IOException {
}
@Override
public void preRegionOffline(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo
regionInfo) throws IOException {
}
@Override
public void postRegionOffline(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo
regionInfo) throws IOException {
}
@Override
public void preBalance(ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
}
@Override
public void postBalance(ObserverContext<MasterCoprocessorEnvironment> ctx, List<RegionPlan>
plans) throws IOException {
}
@Override
public boolean preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> ctx, boolean
newValue) throws IOException {
return newValue;
}
@Override
public void postBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> ctx, boolean
oldValue, boolean newValue) throws IOException {
}
@Override
public void preShutdown(ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
}
@Override
public void preStopMaster(ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
}
@Override
public void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx) throws
IOException {
}
@Override
public void preMasterInitialization(ObserverContext<MasterCoprocessorEnvironment> ctx) throws
IOException {
}
@Override
public void preSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription
snapshot, HTableDescriptor hTableDescriptor) throws IOException {
}
@Override
public void postSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription
snapshot, HTableDescriptor hTableDescriptor) throws IOException {
}
@Override
public void preListSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
SnapshotDescription snapshot) throws IOException {
}
@Override
public void postListSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
SnapshotDescription snapshot) throws IOException {
}
@Override
public void preCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
SnapshotDescription snapshot, HTableDescriptor hTableDescriptor)
throws IOException {
}
@Override
public void postCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
SnapshotDescription snapshot, HTableDescriptor hTableDescriptor)
throws IOException {
}
@Override
public void preRestoreSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
SnapshotDescription snapshot, HTableDescriptor hTableDescriptor)
throws IOException {
}
@Override
public void postRestoreSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
SnapshotDescription snapshot, HTableDescriptor
hTableDescriptor) throws IOException {
}
@Override
public void preDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
SnapshotDescription snapshot) throws IOException {
}
@Override
public void postDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
SnapshotDescription snapshot) throws IOException {
}
@Override
public void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<TableName> tableNamesList, List<HTableDescriptor>
descriptors, String regex) throws IOException {
}
@Override
public void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<TableName> tableNamesList, List<HTableDescriptor>
descriptors, String regex) throws IOException {
}
@Override
public void preGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<HTableDescriptor> descriptors, String regex) throws
IOException {
}
@Override
public void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<HTableDescriptor> descriptors, String regex) throws
IOException {
}
@Override
public void postCreateNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx,
NamespaceDescriptor ns) throws IOException {
}
@Override
public void preDeleteNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx, String
namespace) throws IOException {
}
@Override
public void postDeleteNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx, String
namespace) throws IOException {
}
@Override
public void postModifyNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx,
NamespaceDescriptor ns) throws IOException {
}
@Override
public void preGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx, String
namespace) throws IOException {
}
@Override
public void postGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx,
NamespaceDescriptor ns) throws IOException {
}
@Override
public void preListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<NamespaceDescriptor> descriptors) throws
IOException {
}
@Override
public void postListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<NamespaceDescriptor> descriptors) throws
IOException {
}
@Override
public void preTableFlush(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName) throws IOException {
}
@Override
public void postTableFlush(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName) throws IOException {
}
@Override
public boolean preSetSplitOrMergeEnabled(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final boolean newValue, final MasterSwitchType switchType) throws IOException {
return false;
}
@Override
public void postSetSplitOrMergeEnabled(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final boolean newValue, final MasterSwitchType switchType) throws IOException {
}
@Override
public void preSetUserQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String userName,
Quotas quotas) throws IOException {
}
@Override
public void postSetUserQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String
userName, Quotas quotas) throws IOException {
}
@Override
public void preSetUserQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String userName,
TableName tableName, Quotas quotas) throws IOException {
}
@Override
public void postSetUserQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String
userName, TableName tableName, Quotas quotas) throws IOException {
}
@Override
public void preSetUserQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String userName,
String namespace, Quotas quotas) throws IOException {
}
@Override
public void postSetUserQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String
userName, String namespace, Quotas quotas) throws IOException {
}
@Override
public void preSetTableQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName, Quotas quotas) throws IOException {
}
@Override
public void postSetTableQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName
tableName, Quotas quotas) throws IOException {
}
@Override
public void preSetNamespaceQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String
namespace, Quotas quotas) throws IOException {
}
@Override
public void postSetNamespaceQuota(ObserverContext<MasterCoprocessorEnvironment> ctx, String
namespace, Quotas quotas) throws IOException {
}
@Override
public void preDispatchMerge(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo
regionA, HRegionInfo regionB) throws IOException {
}
@Override
public void postDispatchMerge(ObserverContext<MasterCoprocessorEnvironment> c, HRegionInfo
regionA, HRegionInfo regionB) throws IOException {
}
@Override
public void preMergeRegions(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge) throws IOException {
}
@Override
public void postMergeRegions(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge) throws IOException {
}
@Override
public void preMoveServers(ObserverContext<MasterCoprocessorEnvironment> ctx,
Set<Address> servers, String targetGroup)
throws IOException {}
@Override
public void postMoveServers(ObserverContext<MasterCoprocessorEnvironment> ctx,
Set<Address> servers, String targetGroup)
throws IOException {}
@Override
public void preMoveTables(ObserverContext<MasterCoprocessorEnvironment> ctx, Set<TableName>
tables, String targetGroup) throws IOException {
}
@Override
public void postMoveTables(ObserverContext<MasterCoprocessorEnvironment> ctx,
Set<TableName> tables, String targetGroup) throws IOException {
}
@Override
public void preAddRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String name)
throws IOException {
}
@Override
public void postAddRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String name)
throws IOException {
}
@Override
public void preRemoveRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String name)
throws IOException {
}
@Override
public void postRemoveRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String name)
throws IOException {
}
@Override
public void preBalanceRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String groupName)
throws IOException {
}
@Override
public void postBalanceRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx,
String groupName, boolean balancerRan) throws IOException {
}
@Override
public void preAbortProcedure(ObserverContext<MasterCoprocessorEnvironment> ctx,
ProcedureExecutor<MasterProcedureEnv> procEnv, long procId) throws IOException {
}
@Override
public void postAbortProcedure(ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void preListProcedures(ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void postListProcedures(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<ProcedureInfo> procInfoList) throws IOException {
}
@Override
public void preSplitRegion(
final ObserverContext<MasterCoprocessorEnvironment> c,
final TableName tableName,
final byte[] splitRow) throws IOException {
}
@Override
public void preSplitRegionAction(
final ObserverContext<MasterCoprocessorEnvironment> c,
final TableName tableName,
final byte[] splitRow) throws IOException {
}
@Override
public void postCompletedSplitRegionAction(
final ObserverContext<MasterCoprocessorEnvironment> c,
final HRegionInfo regionInfoA,
final HRegionInfo regionInfoB) throws IOException {
}
@Override
public void preSplitRegionBeforePONRAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final byte[] splitKey,
final List<Mutation> metaEntries) throws IOException {
}
@Override
public void preSplitRegionAfterPONRAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
}
@Override
public void postRollBackSplitRegionAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
}
@Override
public void preMergeRegionsAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge) throws IOException {
}
@Override
public void postCompletedMergeRegionsAction(
final ObserverContext<MasterCoprocessorEnvironment> c,
final HRegionInfo[] regionsToMerge,
final HRegionInfo mergedRegion) throws IOException {
}
@Override
public void preMergeRegionsCommitAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge,
final List<Mutation> metaEntries) throws IOException {
}
@Override
public void postMergeRegionsCommitAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge,
final HRegionInfo mergedRegion) throws IOException {
}
@Override
public void postRollBackMergeRegionsAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge) throws IOException {
}
@Override
public void preLockHeartbeat(ObserverContext<MasterCoprocessorEnvironment> ctx,
LockProcedure proc, boolean keepAlive) throws IOException {
}
@Override
public void postLockHeartbeat(ObserverContext<MasterCoprocessorEnvironment> ctx,
LockProcedure proc, boolean keepAlive) throws IOException {
}
@Override
public void preRequestLock(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace, TableName tableName,
HRegionInfo[] regionInfos, LockType type, String description) throws IOException {
// TODO Auto-generated method stub
}
@Override
public void postRequestLock(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace, TableName tableName,
HRegionInfo[] regionInfos, LockType type, String description) throws IOException {
// TODO Auto-generated method stub
}
}

View File

@ -29,9 +29,9 @@ import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
@ -42,7 +42,7 @@ import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
* implemented on any given system by a coprocessor.
*/
@InterfaceAudience.Private
public class ConstraintProcessor extends BaseRegionObserver {
public class ConstraintProcessor implements RegionObserver {
private static final Log LOG = LogFactory.getLog(ConstraintProcessor.class);
@ -95,7 +95,7 @@ public class ConstraintProcessor extends BaseRegionObserver {
@Override
public boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> e,
final InternalScanner s, final Cell curRowCell, final boolean hasMore) throws IOException {
// Impl in BaseRegionObserver might do unnecessary copy for Off heap backed Cells.
// 'default' in RegionObserver might do unnecessary copy for Off heap backed Cells.
return hasMore;
}
}

View File

@ -1,916 +0,0 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.coprocessor;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.NamespaceDescriptor;
import org.apache.hadoop.hbase.ProcedureInfo;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.client.MasterSwitchType;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.master.RegionPlan;
import org.apache.hadoop.hbase.master.locking.LockProcedure;
import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
import org.apache.hadoop.hbase.net.Address;
import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.SnapshotDescription;
import org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas;
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
public class BaseMasterAndRegionObserver extends BaseRegionObserver
implements MasterObserver {
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
}
@Override
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
}
/**
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-">HBASE-</a>).
* Use {@link #preMergeRegions(ObserverContext, HRegionInfo[])}
*/
@Deprecated
@Override
public void preDispatchMerge(final ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo regionA, HRegionInfo regionB) throws IOException {
}
/**
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
* (<a href="https://issues.apache.org/jira/browse/HBASE-">HBASE-</a>).
* Use {@link #postMergeRegions(ObserverContext, HRegionInfo[])}
*/
@Deprecated
@Override
public void postDispatchMerge(final ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo regionA, HRegionInfo regionB) throws IOException {
}
@Deprecated
@Override
public void preCreateTableHandler(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
}
@Override
public void preCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HTableDescriptor desc,
final HRegionInfo[] regions) throws IOException {
}
@Deprecated
@Override
public void postCreateTableHandler(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
}
@Override
public void postCompletedCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HTableDescriptor desc,
final HRegionInfo[] regions) throws IOException {
}
@Override
public void preDeleteTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void postDeleteTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Deprecated
@Override
public void preDeleteTableHandler(
final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
throws IOException{
}
@Override
public void preDeleteTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
throws IOException{
}
@Deprecated
@Override
public void postDeleteTableHandler(
final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
throws IOException {
}
@Override
public void postCompletedDeleteTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
throws IOException {
}
@Override
public void preTruncateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void postTruncateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Deprecated
@Override
public void preTruncateTableHandler(
final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
throws IOException {
}
@Override
public void preTruncateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
throws IOException {
}
@Deprecated
@Override
public void postTruncateTableHandler(
final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
throws IOException {
}
@Override
public void postCompletedTruncateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
throws IOException {
}
@Override
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HTableDescriptor htd) throws IOException {
}
@Deprecated
@Override
public void postModifyTableHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
HTableDescriptor htd) throws IOException {
}
@Deprecated
@Override
public void preModifyTableHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
HTableDescriptor htd) throws IOException {
}
@Override
public void preModifyTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HTableDescriptor htd) throws IOException {
}
@Override
public void postCompletedModifyTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HTableDescriptor htd) throws IOException {
}
@Override
public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HTableDescriptor htd) throws IOException {
}
@Override
public void preCreateNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx,
NamespaceDescriptor ns) throws IOException {
}
@Override
public void postCreateNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx,
NamespaceDescriptor ns) throws IOException {
}
@Override
public void preDeleteNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx,
String namespace) throws IOException {
}
@Override
public void postDeleteNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx,
String namespace) throws IOException {
}
@Override
public void preModifyNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx,
NamespaceDescriptor ns) throws IOException {
}
@Override
public void postModifyNamespace(ObserverContext<MasterCoprocessorEnvironment> ctx,
NamespaceDescriptor ns) throws IOException {
}
@Override
public void preGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx,
String namespace) throws IOException {
}
@Override
public void postGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx,
NamespaceDescriptor ns) throws IOException {
}
@Override
public void preListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<NamespaceDescriptor> descriptors) throws IOException {
}
@Override
public void postListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<NamespaceDescriptor> descriptors) throws IOException {
}
@Deprecated
@Override
public void preAddColumn(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void preAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void postAddColumn(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void postAddColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void preAddColumnHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void preAddColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void postAddColumnHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void postCompletedAddColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void preModifyColumn(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void preModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void postModifyColumn(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void postModifyColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void preModifyColumnHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void preModifyColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void postModifyColumnHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
HColumnDescriptor columnFamily) throws IOException {
}
@Override
public void postCompletedModifyColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final HColumnDescriptor columnFamily) throws IOException {
}
@Deprecated
@Override
public void preDeleteColumn(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, byte[] columnFamily) throws IOException {
}
@Override
public void preDeleteColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, byte[] columnFamily) throws IOException {
}
@Deprecated
@Override
public void postDeleteColumn(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, byte[] columnFamily) throws IOException {
}
@Override
public void postDeleteColumnFamily(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName, byte[] columnFamily) throws IOException {
}
@Deprecated
@Override
public void preDeleteColumnHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
byte[] columnFamily) throws IOException {
}
@Override
public void preDeleteColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final byte[] columnFamily) throws IOException {
}
@Deprecated
@Override
public void postDeleteColumnHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName,
byte[] columnFamily) throws IOException {
}
@Override
public void postCompletedDeleteColumnFamilyAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName,
final byte[] columnFamily) throws IOException {
}
@Override
public void preEnableTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void postEnableTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Deprecated
@Override
public void preEnableTableHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
throws IOException {
}
@Override
public void preEnableTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
throws IOException {
}
@Deprecated
@Override
public void postEnableTableHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
throws IOException {
}
@Override
public void postCompletedEnableTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
throws IOException {
}
@Override
public void preDisableTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void postDisableTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Deprecated
@Override
public void preDisableTableHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
throws IOException {
}
@Override
public void preDisableTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
throws IOException {
}
@Deprecated
@Override
public void postDisableTableHandler(
ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
throws IOException {
}
@Override
public void postCompletedDisableTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
throws IOException {
}
@Override
public void preMergeRegions(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge) throws IOException {
}
@Override
public void postMergeRegions(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge) throws IOException {
}
@Override
public void preAbortProcedure(
ObserverContext<MasterCoprocessorEnvironment> ctx,
final ProcedureExecutor<MasterProcedureEnv> procEnv,
final long procId) throws IOException {
}
@Override
public void postAbortProcedure(ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void preListProcedures(ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void postListProcedures(
ObserverContext<MasterCoprocessorEnvironment> ctx,
List<ProcedureInfo> procInfoList) throws IOException {
}
@Override
public void preAssign(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo regionInfo) throws IOException {
}
@Override
public void postAssign(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo regionInfo) throws IOException {
}
@Override
public void preUnassign(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo regionInfo, boolean force) throws IOException {
}
@Override
public void postUnassign(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo regionInfo, boolean force) throws IOException {
}
@Override
public void preRegionOffline(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo regionInfo) throws IOException {
}
@Override
public void postRegionOffline(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo regionInfo) throws IOException {
}
@Override
public void preBalance(ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void postBalance(ObserverContext<MasterCoprocessorEnvironment> ctx, List<RegionPlan> plans)
throws IOException {
}
@Override
public boolean preSetSplitOrMergeEnabled(ObserverContext<MasterCoprocessorEnvironment> ctx,
boolean newValue,
MasterSwitchType switchType)
throws IOException {
return false;
}
@Override
public void postSetSplitOrMergeEnabled(ObserverContext<MasterCoprocessorEnvironment> ctx,
boolean newValue,
MasterSwitchType switchType)
throws IOException {
}
@Override
public boolean preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> ctx,
boolean b) throws IOException {
return b;
}
@Override
public void postBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> ctx,
boolean oldValue, boolean newValue) throws IOException {
}
@Override
public void preShutdown(ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void preStopMaster(ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void preMasterInitialization(
ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
}
@Override
public void start(CoprocessorEnvironment ctx) throws IOException {
}
@Override
public void stop(CoprocessorEnvironment ctx) throws IOException {
}
@Override
public void preMove(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo region, ServerName srcServer, ServerName destServer)
throws IOException {
}
@Override
public void postMove(ObserverContext<MasterCoprocessorEnvironment> ctx,
HRegionInfo region, ServerName srcServer, ServerName destServer)
throws IOException {
}
@Override
public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
throws IOException {
}
@Override
public void postSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
throws IOException {
}
@Override
public void preListSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot) throws IOException {
}
@Override
public void postListSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot) throws IOException {
}
@Override
public void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
throws IOException {
}
@Override
public void postCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
throws IOException {
}
@Override
public void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
throws IOException {
}
@Override
public void postRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
throws IOException {
}
@Override
public void preDeleteSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot) throws IOException {
}
@Override
public void postDeleteSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final SnapshotDescription snapshot) throws IOException {
}
@Override
public void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
String regex) throws IOException {
}
@Override
public void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
String regex) throws IOException {
}
@Override
public void preGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<HTableDescriptor> descriptors, String regex) throws IOException {
}
@Override
public void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<HTableDescriptor> descriptors, String regex) throws IOException {
}
@Override
public void preTableFlush(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void postTableFlush(ObserverContext<MasterCoprocessorEnvironment> ctx,
TableName tableName) throws IOException {
}
@Override
public void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String userName, final Quotas quotas) throws IOException {
}
@Override
public void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String userName, final Quotas quotas) throws IOException {
}
@Override
public void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String userName, final TableName tableName, final Quotas quotas) throws IOException {
}
@Override
public void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String userName, final TableName tableName, final Quotas quotas) throws IOException {
}
@Override
public void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String userName, final String namespace, final Quotas quotas) throws IOException {
}
@Override
public void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String userName, final String namespace, final Quotas quotas) throws IOException {
}
@Override
public void preSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName, final Quotas quotas) throws IOException {
}
@Override
public void postSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableName tableName, final Quotas quotas) throws IOException {
}
@Override
public void preSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String namespace, final Quotas quotas) throws IOException {
}
@Override
public void postSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String namespace, final Quotas quotas) throws IOException {
}
@Override
public void postAddRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String name)
throws IOException {
}
@Override
public void postBalanceRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx,
String groupName, boolean balancerRan) throws IOException {
}
@Override
public void postMoveServers(ObserverContext<MasterCoprocessorEnvironment> ctx, Set<Address>
servers, String targetGroup) throws IOException {
}
@Override
public void postMoveTables(ObserverContext<MasterCoprocessorEnvironment> ctx, Set<TableName>
tables, String targetGroup) throws IOException {
}
@Override
public void postRemoveRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String name)
throws IOException {
}
@Override
public void preAddRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String name)
throws IOException {
}
@Override
public void preBalanceRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String groupName)
throws IOException {
}
@Override
public void preMoveServers(ObserverContext<MasterCoprocessorEnvironment> ctx,
Set<Address> servers, String targetGroup) throws IOException {
}
@Override
public void preMoveTables(ObserverContext<MasterCoprocessorEnvironment> ctx,
Set<TableName> tables, String targetGroup) throws IOException {
}
@Override
public void preRemoveRSGroup(ObserverContext<MasterCoprocessorEnvironment> ctx, String name)
throws IOException {
}
@Override
public void preSplitRegion(
final ObserverContext<MasterCoprocessorEnvironment> c,
final TableName tableName,
final byte[] splitRow) throws IOException {
}
@Override
public void preSplitRegionAction(
final ObserverContext<MasterCoprocessorEnvironment> c,
final TableName tableName,
final byte[] splitRow) throws IOException {
}
@Override
public void postCompletedSplitRegionAction(
ObserverContext<MasterCoprocessorEnvironment> c,
final HRegionInfo regionInfoA,
final HRegionInfo regionInfoB) throws IOException {
}
@Override
public void preSplitRegionBeforePONRAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final byte[] splitKey,
final List<Mutation> metaEntries) throws IOException {
}
@Override
public void preSplitRegionAfterPONRAction(final ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void postRollBackSplitRegionAction(final ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void preMergeRegionsAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge) throws IOException {
}
@Override
public void postCompletedMergeRegionsAction(
final ObserverContext<MasterCoprocessorEnvironment> c,
final HRegionInfo[] regionsToMerge,
final HRegionInfo mergedRegion) throws IOException {
}
@Override
public void preMergeRegionsCommitAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge,
final List<Mutation> metaEntries) throws IOException {
}
@Override
public void postMergeRegionsCommitAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge,
final HRegionInfo mergedRegion) throws IOException {
}
@Override
public void postRollBackMergeRegionsAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo[] regionsToMerge) throws IOException {
}
@Override
public void preRequestLock(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace,
TableName tableName, HRegionInfo[] regionInfos, LockProcedure.LockType type,
String description) throws IOException {
}
@Override
public void postRequestLock(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace,
TableName tableName, HRegionInfo[] regionInfos, LockProcedure.LockType type,
String description) throws IOException {
}
@Override
public void preLockHeartbeat(ObserverContext<MasterCoprocessorEnvironment> ctx,
LockProcedure proc, boolean keepAlive) throws IOException {
}
@Override
public void postLockHeartbeat(ObserverContext<MasterCoprocessorEnvironment> ctx,
LockProcedure proc, boolean keepAlive) throws IOException {
}
}

View File

@ -1,559 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.hadoop.hbase.coprocessor;
import com.google.common.collect.ImmutableList;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.NavigableSet;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.filter.ByteArrayComparable;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
import org.apache.hadoop.hbase.io.Reference;
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
import org.apache.hadoop.hbase.regionserver.Region;
import org.apache.hadoop.hbase.regionserver.Region.Operation;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
import org.apache.hadoop.hbase.regionserver.ScanType;
import org.apache.hadoop.hbase.regionserver.Store;
import org.apache.hadoop.hbase.regionserver.StoreFile;
import org.apache.hadoop.hbase.regionserver.StoreFileReader;
import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
import org.apache.hadoop.hbase.regionserver.querymatcher.DeleteTracker;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.wal.WALKey;
/**
* An abstract class that implements RegionObserver.
* By extending it, you can create your own region observer without
* overriding all abstract methods of RegionObserver.
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
public class BaseRegionObserver implements RegionObserver {
@Override
public void start(CoprocessorEnvironment e) throws IOException { }
@Override
public void stop(CoprocessorEnvironment e) throws IOException { }
@Override
public void preOpen(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException { }
@Override
public void postOpen(ObserverContext<RegionCoprocessorEnvironment> e) { }
@Override
public void postLogReplay(ObserverContext<RegionCoprocessorEnvironment> e) { }
@Override
public void preClose(ObserverContext<RegionCoprocessorEnvironment> c, boolean abortRequested)
throws IOException { }
@Override
public void postClose(ObserverContext<RegionCoprocessorEnvironment> e,
boolean abortRequested) { }
@Override
public InternalScanner preFlushScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final KeyValueScanner memstoreScanner, final InternalScanner s)
throws IOException {
return s;
}
@Override
public InternalScanner preFlushScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final KeyValueScanner memstoreScanner, final InternalScanner s,
final long readPoint) throws IOException {
return preFlushScannerOpen(c, store, memstoreScanner, s);
}
@Override
public void preFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
}
@Override
public void postFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
}
@Override
public InternalScanner preFlush(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
InternalScanner scanner) throws IOException {
return scanner;
}
@Override
public void postFlush(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
StoreFile resultFile) throws IOException {
}
@Override
public void preSplit(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
}
@Override
public void preSplit(ObserverContext<RegionCoprocessorEnvironment> c,
byte[] splitRow) throws IOException {
}
@Override
public void preSplitBeforePONR(ObserverContext<RegionCoprocessorEnvironment> ctx,
byte[] splitKey, List<Mutation> metaEntries) throws IOException {
}
@Override
public void preSplitAfterPONR(
ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
}
@Override
public void preRollBackSplit(ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
}
@Override
public void postRollBackSplit(
ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
}
@Override
public void postCompleteSplit(
ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
}
@Override
public void postSplit(ObserverContext<RegionCoprocessorEnvironment> e, Region l, Region r)
throws IOException {
}
@Override
public void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final List<StoreFile> candidates) throws IOException { }
@Override
public void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final List<StoreFile> candidates, final CompactionRequest request)
throws IOException {
preCompactSelection(c, store, candidates);
}
@Override
public void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final ImmutableList<StoreFile> selected) { }
@Override
public void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final ImmutableList<StoreFile> selected, CompactionRequest request) {
postCompactSelection(c, store, selected);
}
@Override
public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e,
final Store store, final InternalScanner scanner, final ScanType scanType)
throws IOException {
return scanner;
}
@Override
public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e,
final Store store, final InternalScanner scanner, final ScanType scanType,
CompactionRequest request) throws IOException {
return preCompact(e, store, scanner, scanType);
}
@Override
public InternalScanner preCompactScannerOpen(
final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
List<? extends KeyValueScanner> scanners, final ScanType scanType, final long earliestPutTs,
final InternalScanner s) throws IOException {
return s;
}
@Override
public InternalScanner preCompactScannerOpen(
final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
List<? extends KeyValueScanner> scanners, final ScanType scanType, final long earliestPutTs,
final InternalScanner s, CompactionRequest request) throws IOException {
return preCompactScannerOpen(c, store, scanners, scanType, earliestPutTs, s);
}
@Override
public InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store, List<? extends KeyValueScanner> scanners, ScanType scanType, long earliestPutTs,
InternalScanner s, CompactionRequest request, long readPoint) throws IOException {
return preCompactScannerOpen(c, store, scanners, scanType, earliestPutTs, s, request);
}
@Override
public void postCompact(ObserverContext<RegionCoprocessorEnvironment> e, final Store store,
final StoreFile resultFile) throws IOException {
}
@Override
public void postCompact(ObserverContext<RegionCoprocessorEnvironment> e, final Store store,
final StoreFile resultFile, CompactionRequest request) throws IOException {
postCompact(e, store, resultFile);
}
@Override
public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e,
final Get get, final List<Cell> results) throws IOException {
}
@Override
public void postGetOp(final ObserverContext<RegionCoprocessorEnvironment> e,
final Get get, final List<Cell> results) throws IOException {
}
@Override
public boolean preExists(final ObserverContext<RegionCoprocessorEnvironment> e,
final Get get, final boolean exists) throws IOException {
return exists;
}
@Override
public boolean postExists(final ObserverContext<RegionCoprocessorEnvironment> e,
final Get get, boolean exists) throws IOException {
return exists;
}
@Override
public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e,
final Put put, final WALEdit edit, final Durability durability) throws IOException {
}
@Override
public void postPut(final ObserverContext<RegionCoprocessorEnvironment> e,
final Put put, final WALEdit edit, final Durability durability) throws IOException {
}
@Override
public void preDelete(final ObserverContext<RegionCoprocessorEnvironment> e, final Delete delete,
final WALEdit edit, final Durability durability) throws IOException {
}
@Override
public void prePrepareTimeStampForDeleteVersion(
final ObserverContext<RegionCoprocessorEnvironment> e, final Mutation delete,
final Cell cell, final byte[] byteNow, final Get get) throws IOException {
}
@Override
public void postDelete(final ObserverContext<RegionCoprocessorEnvironment> e,
final Delete delete, final WALEdit edit, final Durability durability)
throws IOException {
}
@Override
public void preBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
}
@Override
public void postBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
}
@Override
public void postBatchMutateIndispensably(final ObserverContext<RegionCoprocessorEnvironment> ctx,
MiniBatchOperationInProgress<Mutation> miniBatchOp, final boolean success) throws IOException {
}
@Override
public boolean preCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> e,
final byte [] row, final byte [] family, final byte [] qualifier,
final CompareOp compareOp, final ByteArrayComparable comparator,
final Put put, final boolean result) throws IOException {
return result;
}
@Override
public boolean preCheckAndPutAfterRowLock(
final ObserverContext<RegionCoprocessorEnvironment> e,
final byte[] row, final byte[] family, final byte[] qualifier, final CompareOp compareOp,
final ByteArrayComparable comparator, final Put put,
final boolean result) throws IOException {
return result;
}
@Override
public boolean postCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> e,
final byte [] row, final byte [] family, final byte [] qualifier,
final CompareOp compareOp, final ByteArrayComparable comparator,
final Put put, final boolean result) throws IOException {
return result;
}
@Override
public boolean preCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> e,
final byte [] row, final byte [] family, final byte [] qualifier,
final CompareOp compareOp, final ByteArrayComparable comparator,
final Delete delete, final boolean result) throws IOException {
return result;
}
@Override
public boolean preCheckAndDeleteAfterRowLock(
final ObserverContext<RegionCoprocessorEnvironment> e,
final byte[] row, final byte[] family, final byte[] qualifier, final CompareOp compareOp,
final ByteArrayComparable comparator, final Delete delete,
final boolean result) throws IOException {
return result;
}
@Override
public boolean postCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> e,
final byte [] row, final byte [] family, final byte [] qualifier,
final CompareOp compareOp, final ByteArrayComparable comparator,
final Delete delete, final boolean result) throws IOException {
return result;
}
@Override
public Result preAppend(final ObserverContext<RegionCoprocessorEnvironment> e,
final Append append) throws IOException {
return null;
}
@Override
public Result preAppendAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> e,
final Append append) throws IOException {
return null;
}
@Override
public Result postAppend(final ObserverContext<RegionCoprocessorEnvironment> e,
final Append append, final Result result) throws IOException {
return result;
}
@Override
public long preIncrementColumnValue(final ObserverContext<RegionCoprocessorEnvironment> e,
final byte [] row, final byte [] family, final byte [] qualifier,
final long amount, final boolean writeToWAL) throws IOException {
return amount;
}
@Override
public long postIncrementColumnValue(final ObserverContext<RegionCoprocessorEnvironment> e,
final byte [] row, final byte [] family, final byte [] qualifier,
final long amount, final boolean writeToWAL, long result)
throws IOException {
return result;
}
@Override
public Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> e,
final Increment increment) throws IOException {
return null;
}
@Override
public Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> e,
final Increment increment) throws IOException {
return null;
}
@Override
public Result postIncrement(final ObserverContext<RegionCoprocessorEnvironment> e,
final Increment increment, final Result result) throws IOException {
return result;
}
@Override
public RegionScanner preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e,
final Scan scan, final RegionScanner s) throws IOException {
return s;
}
@Override
public KeyValueScanner preStoreScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final Scan scan, final NavigableSet<byte[]> targetCols,
final KeyValueScanner s) throws IOException {
return s;
}
@Override
public KeyValueScanner preStoreScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final Scan scan, final NavigableSet<byte[]> targetCols,
final KeyValueScanner s, final long readPt) throws IOException {
return preStoreScannerOpen(c, store, scan, targetCols, s);
}
@Override
public RegionScanner postScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e,
final Scan scan, final RegionScanner s) throws IOException {
return s;
}
@Override
public boolean preScannerNext(final ObserverContext<RegionCoprocessorEnvironment> e,
final InternalScanner s, final List<Result> results,
final int limit, final boolean hasMore) throws IOException {
return hasMore;
}
@Override
public boolean postScannerNext(final ObserverContext<RegionCoprocessorEnvironment> e,
final InternalScanner s, final List<Result> results, final int limit,
final boolean hasMore) throws IOException {
return hasMore;
}
@Override
@Deprecated
public boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> e,
final InternalScanner s, final byte[] currentRow, final int offset, final short length,
final boolean hasMore) throws IOException {
return hasMore;
}
@Override
public boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> e,
final InternalScanner s, final Cell curRowCell, final boolean hasMore) throws IOException {
return postScannerFilterRow(e, s, curRowCell.getRowArray(), curRowCell.getRowOffset(),
curRowCell.getRowLength(), hasMore);
}
@Override
public void preScannerClose(final ObserverContext<RegionCoprocessorEnvironment> e,
final InternalScanner s) throws IOException {
}
@Override
public void postScannerClose(final ObserverContext<RegionCoprocessorEnvironment> e,
final InternalScanner s) throws IOException {
}
@Override
public void preReplayWALs(ObserverContext<? extends RegionCoprocessorEnvironment> env,
HRegionInfo info, Path edits) throws IOException {
}
@Override
public void postReplayWALs(ObserverContext<? extends RegionCoprocessorEnvironment> env,
HRegionInfo info, Path edits) throws IOException {
}
/**
* Implementers should override this version of the method and leave the deprecated one as-is.
*/
@Override
public void preWALRestore(ObserverContext<? extends RegionCoprocessorEnvironment> env,
HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
}
/**
* Implementers should override this version of the method and leave the deprecated one as-is.
*/
@Override
public void postWALRestore(ObserverContext<? extends RegionCoprocessorEnvironment> env,
HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
}
@Override
public void preBulkLoadHFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
List<Pair<byte[], String>> familyPaths) throws IOException {
}
@Override
public void preCommitStoreFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
final byte[] family, final List<Pair<Path, Path>> pairs) throws IOException {
}
@Override
public void postCommitStoreFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
final byte[] family, Path srcPath, Path dstPath) throws IOException {
}
@Override
public boolean postBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx,
List<Pair<byte[], String>> stagingFamilyPaths, Map<byte[], List<Path>> finalPaths,
boolean hasLoaded) throws IOException {
return postBulkLoadHFile(ctx, stagingFamilyPaths, hasLoaded);
}
@Override
public boolean postBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx,
List<Pair<byte[], String>> stagingFamilyPaths, boolean hasLoaded) throws IOException {
return hasLoaded;
}
@Override
public StoreFileReader preStoreFileReaderOpen(ObserverContext<RegionCoprocessorEnvironment> ctx,
FileSystem fs, Path p, FSDataInputStreamWrapper in, long size, CacheConfig cacheConf,
Reference r, StoreFileReader reader) throws IOException {
return reader;
}
@Override
public StoreFileReader postStoreFileReaderOpen(ObserverContext<RegionCoprocessorEnvironment> ctx,
FileSystem fs, Path p, FSDataInputStreamWrapper in, long size, CacheConfig cacheConf,
Reference r, StoreFileReader reader) throws IOException {
return reader;
}
@Override
public Cell postMutationBeforeWAL(ObserverContext<RegionCoprocessorEnvironment> ctx,
MutationType opType, Mutation mutation, Cell oldCell, Cell newCell) throws IOException {
return newCell;
}
@Override
public void postStartRegionOperation(final ObserverContext<RegionCoprocessorEnvironment> ctx,
Operation op) throws IOException {
}
@Override
public void postCloseRegionOperation(final ObserverContext<RegionCoprocessorEnvironment> ctx,
Operation op) throws IOException {
}
@Override
public DeleteTracker postInstantiateDeleteTracker(
final ObserverContext<RegionCoprocessorEnvironment> ctx, DeleteTracker delTracker)
throws IOException {
return delTracker;
}
}

View File

@ -1,99 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.hadoop.hbase.coprocessor;
import java.io.IOException;
import java.util.List;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WALEntry;
import org.apache.hadoop.hbase.regionserver.Region;
import org.apache.hadoop.hbase.replication.ReplicationEndpoint;
/**
* An abstract class that implements RegionServerObserver.
* By extending it, you can create your own region server observer without
* overriding all abstract methods of RegionServerObserver.
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
public class BaseRegionServerObserver implements RegionServerObserver {
@Override
public void preStopRegionServer(ObserverContext<RegionServerCoprocessorEnvironment> env)
throws IOException { }
@Override
public void start(CoprocessorEnvironment env) throws IOException { }
@Override
public void stop(CoprocessorEnvironment env) throws IOException { }
@Override
public void preMerge(ObserverContext<RegionServerCoprocessorEnvironment> ctx, Region regionA,
Region regionB) throws IOException { }
@Override
public void postMerge(ObserverContext<RegionServerCoprocessorEnvironment> c, Region regionA,
Region regionB, Region mergedRegion) throws IOException { }
@Override
public void preMergeCommit(ObserverContext<RegionServerCoprocessorEnvironment> ctx,
Region regionA, Region regionB, List<Mutation> metaEntries) throws IOException { }
@Override
public void postMergeCommit(ObserverContext<RegionServerCoprocessorEnvironment> ctx,
Region regionA, Region regionB, Region mergedRegion) throws IOException { }
@Override
public void preRollBackMerge(ObserverContext<RegionServerCoprocessorEnvironment> ctx,
Region regionA, Region regionB) throws IOException { }
@Override
public void postRollBackMerge(ObserverContext<RegionServerCoprocessorEnvironment> ctx,
Region regionA, Region regionB) throws IOException { }
@Override
public void preRollWALWriterRequest(ObserverContext<RegionServerCoprocessorEnvironment> ctx)
throws IOException { }
@Override
public void postRollWALWriterRequest(ObserverContext<RegionServerCoprocessorEnvironment> ctx)
throws IOException { }
@Override
public ReplicationEndpoint postCreateReplicationEndPoint(
ObserverContext<RegionServerCoprocessorEnvironment> ctx, ReplicationEndpoint endpoint) {
return endpoint;
}
@Override
public void preReplicateLogEntries(ObserverContext<RegionServerCoprocessorEnvironment> ctx,
List<WALEntry> entries, CellScanner cells) throws IOException { }
@Override
public void postReplicateLogEntries(ObserverContext<RegionServerCoprocessorEnvironment> ctx,
List<WALEntry> entries, CellScanner cells) throws IOException { }
}

View File

@ -1,69 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.coprocessor;
import java.io.IOException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.wal.WALKey;
/**
* An abstract class that implements WALObserver.
* By extending it, you can create your own WAL observer without
* overriding all abstract methods of WALObserver.
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
public class BaseWALObserver implements WALObserver {
@Override
public void start(CoprocessorEnvironment e) throws IOException { }
@Override
public void stop(CoprocessorEnvironment e) throws IOException { }
/**
* Implementers should override this method and leave the deprecated version as-is.
*/
@Override
public boolean preWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
return false;
}
/**
* Implementers should override this method and leave the deprecated version as-is.
*/
@Override
public void postWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {}
@Override
public void preWALRoll(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
Path oldPath, Path newPath) throws IOException { }
@Override
public void postWALRoll(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
Path oldPath, Path newPath) throws IOException { }
}

View File

@ -30,6 +30,21 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CleanupBul
/**
* Coprocessors implement this interface to observe and mediate bulk load operations.
* <br><br>
*
* <h3>Exception Handling</h3>
* For all functions, exception handling is done as follows:
* <ul>
* <li>Exceptions of type {@link IOException} are reported back to client.</li>
* <li>For any other kind of exception:
* <ul>
* <li>If the configuration {@link CoprocessorHost#ABORT_ON_ERROR_KEY} is set to true, then
* the server aborts.</li>
* <li>Otherwise, coprocessor is removed from the server and
* {@link org.apache.hadoop.hbase.DoNotRetryIOException} is returned to the client.</li>
* </ul>
* </li>
* </ul>
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
@ -38,17 +53,15 @@ public interface BulkLoadObserver extends Coprocessor {
* Called as part of SecureBulkLoadEndpoint.prepareBulkLoad() RPC call.
* It can't bypass the default action, e.g., ctx.bypass() won't have effect.
* @param ctx the environment to interact with the framework and master
* @throws IOException
*/
void prePrepareBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx,
PrepareBulkLoadRequest request) throws IOException;
default void prePrepareBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx,
PrepareBulkLoadRequest request) throws IOException {}
/**
* Called as part of SecureBulkLoadEndpoint.cleanupBulkLoad() RPC call.
* It can't bypass the default action, e.g., ctx.bypass() won't have effect.
* @param ctx the environment to interact with the framework and master
* @throws IOException
*/
void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx,
CleanupBulkLoadRequest request) throws IOException;
default void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx,
CleanupBulkLoadRequest request) throws IOException {}
}

View File

@ -45,7 +45,6 @@ import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.HTableWrapper;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.util.CoprocessorClassLoader;
@ -584,6 +583,10 @@ public abstract class CoprocessorHost<E extends CoprocessorEnvironment> {
* @param e Throwable object thrown by coprocessor.
* @exception IOException Exception
*/
// Note to devs: Class comments of all observers ({@link MasterObserver}, {@link WALObserver},
// etc) mention this nuance of our exception handling so that coprocessor can throw appropriate
// exceptions depending on situation. If any changes are made to this logic, make sure to
// update all classes' comments.
protected void handleCoprocessorThrowable(final CoprocessorEnvironment env, final Throwable e)
throws IOException {
if (e instanceof IOException) {

View File

@ -32,6 +32,21 @@ import com.google.protobuf.Service;
/**
* Coprocessors implement this interface to observe and mediate endpoint invocations
* on a region.
* <br><br>
*
* <h3>Exception Handling</h3>
* For all functions, exception handling is done as follows:
* <ul>
* <li>Exceptions of type {@link IOException} are reported back to client.</li>
* <li>For any other kind of exception:
* <ul>
* <li>If the configuration {@link CoprocessorHost#ABORT_ON_ERROR_KEY} is set to true, then
* the server aborts.</li>
* <li>Otherwise, coprocessor is removed from the server and
* {@link org.apache.hadoop.hbase.DoNotRetryIOException} is returned to the client.</li>
* </ul>
* </li>
* </ul>
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
@ -45,13 +60,15 @@ public interface EndpointObserver extends Coprocessor {
* effect in this hook.
* @param ctx the environment provided by the region server
* @param service the endpoint service
* @param request Request message expected by given {@code Service}'s method (by the name
* {@code methodName}).
* @param methodName the invoked service method
* @param request the request message
* @return the possibly modified message
* @throws IOException
*/
Message preEndpointInvocation(ObserverContext<RegionCoprocessorEnvironment> ctx, Service service,
String methodName, Message request) throws IOException;
default Message preEndpointInvocation(ObserverContext<RegionCoprocessorEnvironment> ctx,
Service service, String methodName, Message request) throws IOException {
return request;
}
/**
* Called after an Endpoint service method is invoked. The response message can be
@ -59,11 +76,12 @@ public interface EndpointObserver extends Coprocessor {
* @param ctx the environment provided by the region server
* @param service the endpoint service
* @param methodName the invoked service method
* @param request the request message
* @param responseBuilder the response message builder
* @throws IOException
* @param request Request message expected by given {@code Service}'s method (by the name
* {@code methodName}).
* @param responseBuilder Builder for final response to the client, with original response from
* Service's method merged into it.
*/
void postEndpointInvocation(ObserverContext<RegionCoprocessorEnvironment> ctx, Service service,
String methodName, Message request, Message.Builder responseBuilder) throws IOException;
default void postEndpointInvocation(ObserverContext<RegionCoprocessorEnvironment> ctx,
Service service, String methodName, Message request, Message.Builder responseBuilder)
throws IOException {}
}

View File

@ -35,130 +35,140 @@ import org.apache.hadoop.hbase.replication.ReplicationEndpoint;
/**
* Defines coprocessor hooks for interacting with operations on the
* {@link org.apache.hadoop.hbase.regionserver.HRegionServer} process.
*
* Since most implementations will be interested in only a subset of hooks, this class uses
* 'default' functions to avoid having to add unnecessary overrides. When the functions are
* non-empty, it's simply to satisfy the compiler by returning value of expected (non-void) type.
* It is done in a way that these default definitions act as no-op. So our suggestion to
* implementation would be to not call these 'default' methods from overrides.
* <br><br>
*
* <h3>Exception Handling</h3>
* For all functions, exception handling is done as follows:
* <ul>
* <li>Exceptions of type {@link IOException} are reported back to client.</li>
* <li>For any other kind of exception:
* <ul>
* <li>If the configuration {@link CoprocessorHost#ABORT_ON_ERROR_KEY} is set to true, then
* the server aborts.</li>
* <li>Otherwise, coprocessor is removed from the server and
* {@link org.apache.hadoop.hbase.DoNotRetryIOException} is returned to the client.</li>
* </ul>
* </li>
* </ul>
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
public interface RegionServerObserver extends Coprocessor {
/**
* Called before stopping region server.
* @param env An instance of RegionServerCoprocessorEnvironment
* @throws IOException Signals that an I/O exception has occurred.
* @param ctx the environment to interact with the framework and region server.
*/
void preStopRegionServer(
final ObserverContext<RegionServerCoprocessorEnvironment> env)
throws IOException;
default void preStopRegionServer(
final ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException {}
/**
* Called before the regions merge.
* Call {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} to skip the merge.
* @throws IOException if an error occurred on the coprocessor
* @param ctx
* @param regionA
* @param regionB
* @throws IOException
* @param ctx the environment to interact with the framework and region server.
* @param regionA region being merged.
* @param regionB region being merged.
*/
void preMerge(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
final Region regionA, final Region regionB) throws IOException;
default void preMerge(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
final Region regionA, final Region regionB) throws IOException {}
/**
* called after the regions merge.
* @param c
* @param regionA
* @param regionB
* @param mergedRegion
* @throws IOException
* @param ctx the environment to interact with the framework and region server.
* @param regionA region being merged.
* @param regionB region being merged.
*/
void postMerge(final ObserverContext<RegionServerCoprocessorEnvironment> c,
final Region regionA, final Region regionB, final Region mergedRegion) throws IOException;
default void postMerge(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
final Region regionA, final Region regionB, final Region mergedRegion) throws IOException {}
/**
* This will be called before PONR step as part of regions merge transaction. Calling
* {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} rollback the merge
* @param ctx
* @param regionA
* @param regionB
* @param ctx the environment to interact with the framework and region server.
* @param regionA region being merged.
* @param regionB region being merged.
* @param metaEntries mutations to execute on hbase:meta atomically with regions merge updates.
* Any puts or deletes to execute on hbase:meta can be added to the mutations.
* @throws IOException
*/
void preMergeCommit(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
default void preMergeCommit(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
final Region regionA, final Region regionB,
@MetaMutationAnnotation List<Mutation> metaEntries) throws IOException;
@MetaMutationAnnotation List<Mutation> metaEntries) throws IOException {}
/**
* This will be called after PONR step as part of regions merge transaction.
* @param ctx
* @param regionA
* @param regionB
* @param mergedRegion
* @throws IOException
* @param ctx the environment to interact with the framework and region server.
* @param regionA region being merged.
* @param regionB region being merged.
*/
void postMergeCommit(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
final Region regionA, final Region regionB, final Region mergedRegion) throws IOException;
default void postMergeCommit(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
final Region regionA, final Region regionB, final Region mergedRegion) throws IOException {}
/**
* This will be called before the roll back of the regions merge.
* @param ctx
* @param regionA
* @param regionB
* @throws IOException
* @param ctx the environment to interact with the framework and region server.
* @param regionA region being merged.
* @param regionB region being merged.
*/
void preRollBackMerge(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
final Region regionA, final Region regionB) throws IOException;
default void preRollBackMerge(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
final Region regionA, final Region regionB) throws IOException {}
/**
* This will be called after the roll back of the regions merge.
* @param ctx
* @param regionA
* @param regionB
* @throws IOException
* @param ctx the environment to interact with the framework and region server.
* @param regionA region being merged.
* @param regionB region being merged.
*/
void postRollBackMerge(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
final Region regionA, final Region regionB) throws IOException;
default void postRollBackMerge(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
final Region regionA, final Region regionB) throws IOException {}
/**
* This will be called before executing user request to roll a region server WAL.
* @param ctx An instance of ObserverContext
* @throws IOException Signals that an I/O exception has occurred.
* @param ctx the environment to interact with the framework and region server.
*/
void preRollWALWriterRequest(final ObserverContext<RegionServerCoprocessorEnvironment> ctx)
throws IOException;
default void preRollWALWriterRequest(
final ObserverContext<RegionServerCoprocessorEnvironment> ctx)
throws IOException {}
/**
* This will be called after executing user request to roll a region server WAL.
* @param ctx An instance of ObserverContext
* @throws IOException Signals that an I/O exception has occurred.
* @param ctx the environment to interact with the framework and region server.
*/
void postRollWALWriterRequest(final ObserverContext<RegionServerCoprocessorEnvironment> ctx)
throws IOException;
default void postRollWALWriterRequest(
final ObserverContext<RegionServerCoprocessorEnvironment> ctx)
throws IOException {}
/**
* This will be called after the replication endpoint is instantiated.
* @param ctx
* @param ctx the environment to interact with the framework and region server.
* @param endpoint - the base endpoint for replication
* @return the endpoint to use during replication.
*/
ReplicationEndpoint postCreateReplicationEndPoint(
ObserverContext<RegionServerCoprocessorEnvironment> ctx, ReplicationEndpoint endpoint);
default ReplicationEndpoint postCreateReplicationEndPoint(
ObserverContext<RegionServerCoprocessorEnvironment> ctx, ReplicationEndpoint endpoint) {
return endpoint;
}
/**
* This will be called before executing replication request to shipping log entries.
* @param ctx An instance of ObserverContext
* @param ctx the environment to interact with the framework and region server.
* @param entries list of WALEntries to replicate
* @param cells Cells that the WALEntries refer to (if cells is non-null)
* @throws IOException Signals that an I/O exception has occurred.
*/
void preReplicateLogEntries(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
List<WALEntry> entries, CellScanner cells) throws IOException;
default void preReplicateLogEntries(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
List<WALEntry> entries, CellScanner cells) throws IOException {}
/**
* This will be called after executing replication request to shipping log entries.
* @param ctx An instance of ObserverContext
* @param ctx the environment to interact with the framework and region server.
* @param entries list of WALEntries to replicate
* @param cells Cells that the WALEntries refer to (if cells is non-null)
* @throws IOException Signals that an I/O exception has occurred.
*/
void postReplicateLogEntries(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
List<WALEntry> entries, CellScanner cells) throws IOException;
default void postReplicateLogEntries(
final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
List<WALEntry> entries, CellScanner cells) throws IOException {}
}

View File

@ -38,15 +38,35 @@ import org.apache.hadoop.hbase.wal.WALKey;
* as empty via {@link WALEdit#isEmpty()}.
*
* {@link org.apache.hadoop.hbase.coprocessor.RegionObserver} provides
* hooks for adding logic for WALEdits in the region context during reconstruction,
* hooks for adding logic for WALEdits in the region context during reconstruction.
*
* Defines coprocessor hooks for interacting with operations on the
* {@link org.apache.hadoop.hbase.wal.WAL}.
*
* Since most implementations will be interested in only a subset of hooks, this class uses
* 'default' functions to avoid having to add unnecessary overrides. When the functions are
* non-empty, it's simply to satisfy the compiler by returning value of expected (non-void) type.
* It is done in a way that these default definitions act as no-op. So our suggestion to
* implementation would be to not call these 'default' methods from overrides.
* <br><br>
*
* <h3>Exception Handling</h3>
* For all functions, exception handling is done as follows:
* <ul>
* <li>Exceptions of type {@link IOException} are reported back to client.</li>
* <li>For any other kind of exception:
* <ul>
* <li>If the configuration {@link CoprocessorHost#ABORT_ON_ERROR_KEY} is set to true, then
* the server aborts.</li>
* <li>Otherwise, coprocessor is removed from the server and
* {@link org.apache.hadoop.hbase.DoNotRetryIOException} is returned to the client.</li>
* </ul>
* </li>
* </ul>
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
public interface WALObserver extends Coprocessor {
/**
* Called before a {@link org.apache.hadoop.hbase.regionserver.wal.WALEdit}
* is writen to WAL.
@ -54,30 +74,32 @@ public interface WALObserver extends Coprocessor {
* @return true if default behavior should be bypassed, false otherwise
*/
// TODO: return value is not used
boolean preWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException;
default boolean preWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
return false;
}
/**
* Called after a {@link org.apache.hadoop.hbase.regionserver.wal.WALEdit}
* is writen to WAL.
*/
void postWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException;
default void postWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {}
/**
* Called before rolling the current WAL
* @param oldPath the path of the current wal that we are replacing
* @param newPath the path of the wal we are going to create
*/
void preWALRoll(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
Path oldPath, Path newPath) throws IOException;
default void preWALRoll(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
Path oldPath, Path newPath) throws IOException {}
/**
* Called after rolling the current WAL
* @param oldPath the path of the wal that we replaced
* @param newPath the path of the wal we have created and now is the current
*/
void postWALRoll(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
Path oldPath, Path newPath) throws IOException;
default void postWALRoll(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
Path oldPath, Path newPath) throws IOException {}
}

View File

@ -127,11 +127,6 @@ observe and mediate client actions on the region:
<li>preCheckAndDelete, postCheckAndDelete: Called before and after the client
calls checkAndDelete().</li>
</ul>
You can also extend abstract class <code>BaseRegionObserverCoprocessor</code>
which
implements both <code>Coprocessor</code> and <code>RegionObserver</code>.
In addition, it overrides all methods with default behaviors so you don't
have to override all of them.
<p>
Here's an example of what a simple RegionObserver might look like. This
example shows how to implement access control for HBase. This

View File

@ -55,7 +55,6 @@ import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
import org.apache.hadoop.hbase.coprocessor.EndpointObserver;
@ -236,10 +235,6 @@ public class RegionCoprocessorHost
hasCustomPostScannerFilterRow = true;
break out;
}
if (clazz == BaseRegionObserver.class) {
// we reached BaseRegionObserver, try next coprocessor
break;
}
try {
clazz.getDeclaredMethod("postScannerFilterRow", ObserverContext.class,
InternalScanner.class, Cell.class, boolean.class);

View File

@ -29,9 +29,9 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.util.Pair;
@ -40,7 +40,7 @@ import org.apache.hadoop.hbase.util.Pair;
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)
public class ReplicationObserver extends BaseRegionObserver {
public class ReplicationObserver implements RegionObserver {
private static final Log LOG = LogFactory.getLog(ReplicationObserver.class);
@Override

View File

@ -68,14 +68,15 @@ import org.apache.hadoop.hbase.client.Query;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseMasterAndRegionObserver;
import org.apache.hadoop.hbase.coprocessor.BulkLoadObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
import org.apache.hadoop.hbase.coprocessor.EndpointObserver;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionServerObserver;
import org.apache.hadoop.hbase.filter.ByteArrayComparable;
@ -168,8 +169,7 @@ import com.google.protobuf.Service;
* </p>
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)
public class AccessController extends BaseMasterAndRegionObserver
implements RegionServerObserver,
public class AccessController implements MasterObserver, RegionObserver, RegionServerObserver,
AccessControlService.Interface, CoprocessorService, EndpointObserver, BulkLoadObserver {
private static final Log LOG = LogFactory.getLog(AccessController.class);
@ -2125,7 +2125,7 @@ public class AccessController extends BaseMasterAndRegionObserver
@Override
public boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> e,
final InternalScanner s, final Cell curRowCell, final boolean hasMore) throws IOException {
// Impl in BaseRegionObserver might do unnecessary copy for Off heap backed Cells.
// 'default' in RegionObserver might do unnecessary copy for Off heap backed Cells.
return hasMore;
}

View File

@ -33,7 +33,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.coprocessor.BaseMasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
@ -48,7 +48,7 @@ import org.apache.hadoop.hbase.util.Bytes;
* Master observer for restricting coprocessor assignments.
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)
public class CoprocessorWhitelistMasterObserver extends BaseMasterObserver {
public class CoprocessorWhitelistMasterObserver implements MasterObserver {
public static final String CP_COPROCESSOR_WHITELIST_PATHS_KEY =
"hbase.coprocessor.region.whitelist.paths";

View File

@ -60,15 +60,16 @@ import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.constraint.ConstraintException;
import org.apache.hadoop.hbase.coprocessor.BaseMasterAndRegionObserver;
import org.apache.hadoop.hbase.coprocessor.BaseRegionServerObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionServerObserver;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
import org.apache.hadoop.hbase.filter.Filter;
@ -120,7 +121,7 @@ import com.google.protobuf.Service;
* visibility labels
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)
public class VisibilityController extends BaseMasterAndRegionObserver implements
public class VisibilityController implements MasterObserver, RegionObserver,
VisibilityLabelsService.Interface, CoprocessorService {
private static final Log LOG = LogFactory.getLog(VisibilityController.class);
@ -766,7 +767,7 @@ public class VisibilityController extends BaseMasterAndRegionObserver implements
@Override
public boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> e,
final InternalScanner s, final Cell curRowCell, final boolean hasMore) throws IOException {
// Impl in BaseRegionObserver might do unnecessary copy for Off heap backed Cells.
// 'default' in RegionObserver might do unnecessary copy for Off heap backed Cells.
return hasMore;
}
@ -1087,7 +1088,7 @@ public class VisibilityController extends BaseMasterAndRegionObserver implements
* replicated as string. The value for the configuration should be
* 'org.apache.hadoop.hbase.security.visibility.VisibilityController$VisibilityReplication'.
*/
public static class VisibilityReplication extends BaseRegionServerObserver {
public static class VisibilityReplication implements RegionServerObserver {
private Configuration conf;
private VisibilityLabelService visibilityLabelService;

View File

@ -22,9 +22,9 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
import org.apache.hadoop.hbase.regionserver.OperationStatus;
@ -58,7 +58,7 @@ import java.util.concurrent.atomic.AtomicLong;
* 0 row(s) in 0.0050 seconds
* </p>
*/
public class WriteSinkCoprocessor extends BaseRegionObserver {
public class WriteSinkCoprocessor implements RegionObserver {
private static final Log LOG = LogFactory.getLog(WriteSinkCoprocessor.class);
private final AtomicLong ops = new AtomicLong();
private String regionName;

View File

@ -23,15 +23,14 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.RegionLocations;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
@ -160,7 +159,7 @@ public class HConnectionTestingUtility {
/**
* This coproceesor sleep 2s at first increment/append rpc call.
*/
public static class SleepAtFirstRpcCall extends BaseRegionObserver {
public static class SleepAtFirstRpcCall implements RegionObserver {
static final AtomicLong ct = new AtomicLong(0);
static final String SLEEP_TIME_CONF_KEY =
"hbase.coprocessor.SleepAtFirstRpcCall.sleepTime";

View File

@ -37,9 +37,9 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
import org.apache.hadoop.hbase.security.User;
@ -73,7 +73,7 @@ public class TestAsyncNonMetaRegionLocatorConcurrenyLimit {
private static AtomicInteger MAX_CONCURRENCY = new AtomicInteger(0);
public static final class CountingRegionObserver extends BaseRegionObserver {
public static final class CountingRegionObserver implements RegionObserver {
@Override
public RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> e, Scan scan,

View File

@ -35,9 +35,9 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.exceptions.TimeoutIOException;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
import org.apache.hadoop.hbase.security.User;
@ -65,7 +65,7 @@ public class TestAsyncRegionLocatorTimeout {
private static volatile long SLEEP_MS = 0L;
public static class SleepRegionObserver extends BaseRegionObserver {
public static class SleepRegionObserver implements RegionObserver {
@Override
public RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> e, Scan scan,
@ -73,7 +73,7 @@ public class TestAsyncRegionLocatorTimeout {
if (SLEEP_MS > 0) {
Threads.sleepWithoutInterrupt(SLEEP_MS);
}
return super.preScannerOpen(e, scan, s);
return s;
}
}

View File

@ -39,9 +39,9 @@ import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
@ -202,7 +202,7 @@ public class TestAsyncTableBatch {
assertEquals(4, Bytes.toInt(appendValue, 8));
}
public static final class ErrorInjectObserver extends BaseRegionObserver {
public static final class ErrorInjectObserver implements RegionObserver {
@Override
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get,

View File

@ -34,11 +34,11 @@ import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.MultiRowMutationEndpoint;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.io.hfile.BlockCache;
import org.apache.hadoop.hbase.io.hfile.BlockCacheKey;
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
@ -251,7 +251,7 @@ public class TestAvoidCellReferencesIntoShippedBlocks {
}
}
public static class CompactorRegionObserver extends BaseRegionObserver {
public static class CompactorRegionObserver implements RegionObserver {
@Override
public InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store, List<? extends KeyValueScanner> scanners, ScanType scanType,

View File

@ -40,11 +40,11 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.MultiRowMutationEndpoint;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.io.hfile.BlockCache;
import org.apache.hadoop.hbase.io.hfile.BlockCacheKey;
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
@ -1558,7 +1558,7 @@ public class TestBlockEvictionFromClient {
}
}
public static class CustomInnerRegionObserver extends BaseRegionObserver {
public static class CustomInnerRegionObserver implements RegionObserver {
static final AtomicLong sleepTime = new AtomicLong(0);
static final AtomicBoolean slowDownNext = new AtomicBoolean(false);
static final AtomicInteger countOfNext = new AtomicInteger(0);
@ -1578,14 +1578,13 @@ public class TestBlockEvictionFromClient {
} catch (InterruptedException e1) {
}
}
return super.postScannerNext(e, s, results, limit, hasMore);
return hasMore;
}
@Override
public void postGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get,
List<Cell> results) throws IOException {
slowdownCode(e, true);
super.postGetOp(e, get, results);
}
public static AtomicReference<CountDownLatch> getCdl() {

View File

@ -26,10 +26,10 @@ import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
@ -58,7 +58,7 @@ public class TestClientOperationInterrupt {
private static final byte[] test = Bytes.toBytes("test");
private static Configuration conf;
public static class TestCoprocessor extends BaseRegionObserver {
public static class TestCoprocessor implements RegionObserver {
@Override
public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e,
final Get get, final List<Cell> results) throws IOException {

View File

@ -42,7 +42,7 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.coprocessor.BaseMasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
@ -192,7 +192,7 @@ public class TestEnableTable {
}
}
public static class MasterSyncObserver extends BaseMasterObserver {
public static class MasterSyncObserver implements MasterObserver {
volatile CountDownLatch tableCreationLatch = null;
volatile CountDownLatch tableDeletionLatch = null;

View File

@ -68,11 +68,11 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.client.metrics.ScanMetrics;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.MultiRowMutationEndpoint;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.exceptions.ScannerResetException;
import org.apache.hadoop.hbase.filter.BinaryComparator;
import org.apache.hadoop.hbase.filter.CompareFilter;
@ -554,7 +554,7 @@ public class TestFromClientSide {
* This is a coprocessor to inject a test failure so that a store scanner.reseek() call will
* fail with an IOException() on the first call.
*/
public static class ExceptionInReseekRegionObserver extends BaseRegionObserver {
public static class ExceptionInReseekRegionObserver implements RegionObserver {
static AtomicLong reqCount = new AtomicLong(0);
static AtomicBoolean isDoNotRetry = new AtomicBoolean(false); // whether to throw DNRIOE
static AtomicBoolean throwOnce = new AtomicBoolean(true); // whether to only throw once

View File

@ -41,7 +41,6 @@ import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.regionserver.Region;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
import org.apache.hadoop.hbase.HBaseTestingUtility;
@ -827,7 +826,7 @@ public class TestFromClientSide3 {
return clz.cast(cp);
}
public static class WatiingForMultiMutationsObserver extends BaseRegionObserver {
public static class WatiingForMultiMutationsObserver implements RegionObserver {
final CountDownLatch latch = new CountDownLatch(1);
@Override
public void postBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
@ -840,7 +839,7 @@ public class TestFromClientSide3 {
}
}
public static class WatiingForScanObserver extends BaseRegionObserver {
public static class WatiingForScanObserver implements RegionObserver {
private final CountDownLatch latch = new CountDownLatch(1);
@Override
public void postBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,

View File

@ -49,9 +49,9 @@ import org.apache.hadoop.hbase.RegionLocations;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.exceptions.ClientExceptionsUtil;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.exceptions.RegionMovedException;
@ -120,7 +120,7 @@ public class TestHCM {
/**
* This copro sleeps 20 second. The first call it fails. The second time, it works.
*/
public static class SleepAndFailFirstTime extends BaseRegionObserver {
public static class SleepAndFailFirstTime implements RegionObserver {
static final AtomicLong ct = new AtomicLong(0);
static final String SLEEP_TIME_CONF_KEY =
"hbase.coprocessor.SleepAndFailFirstTime.sleepTime";
@ -172,12 +172,12 @@ public class TestHCM {
if (ct.incrementAndGet() == 1) {
throw new IOException("first call I fail");
}
return super.preIncrement(e, increment);
return null;
}
}
public static class SleepCoprocessor extends BaseRegionObserver {
public static class SleepCoprocessor implements RegionObserver {
public static final int SLEEP_TIME = 5000;
@Override
public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e,
@ -195,7 +195,7 @@ public class TestHCM {
public Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> e,
final Increment increment) throws IOException {
Threads.sleep(SLEEP_TIME);
return super.preIncrement(e, increment);
return null;
}
@Override
@ -206,7 +206,7 @@ public class TestHCM {
}
public static class SleepLongerAtFirstCoprocessor extends BaseRegionObserver {
public static class SleepLongerAtFirstCoprocessor implements RegionObserver {
public static final int SLEEP_TIME = 2000;
static final AtomicLong ct = new AtomicLong(0);
@Override

View File

@ -27,9 +27,9 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.master.cleaner.TimeToLiveHFileCleaner;
import org.apache.hadoop.hbase.mob.MobConstants;
import org.apache.hadoop.hbase.snapshot.MobSnapshotTestingUtils;
@ -137,7 +137,7 @@ public class TestMobCloneSnapshotFromClient extends TestCloneSnapshotFromClient
/**
* This coprocessor is used to delay the flush.
*/
public static class DelayFlushCoprocessor extends BaseRegionObserver {
public static class DelayFlushCoprocessor implements RegionObserver {
@Override
public void preFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
if (delayFlush) {
@ -150,7 +150,6 @@ public class TestMobCloneSnapshotFromClient extends TestCloneSnapshotFromClient
throw new InterruptedIOException(e1.getMessage());
}
}
super.preFlush(e);
}
}

View File

@ -41,9 +41,9 @@ import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.client.replication.ReplicationAdmin;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
import org.apache.hadoop.hbase.regionserver.RegionServerStoppedException;
@ -78,7 +78,7 @@ public class TestReplicaWithCluster {
/**
* This copro is used to synchronize the tests.
*/
public static class SlowMeCopro extends BaseRegionObserver {
public static class SlowMeCopro implements RegionObserver {
static final AtomicLong sleepTime = new AtomicLong(0);
static final AtomicReference<CountDownLatch> cdl = new AtomicReference<>(new CountDownLatch(0));
@ -114,7 +114,7 @@ public class TestReplicaWithCluster {
/**
* This copro is used to simulate region server down exception for Get and Scan
*/
public static class RegionServerStoppedCopro extends BaseRegionObserver {
public static class RegionServerStoppedCopro implements RegionObserver {
public RegionServerStoppedCopro() {
}

View File

@ -46,9 +46,9 @@ import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.NotServingRegionException;
import org.apache.hadoop.hbase.RegionLocations;
import org.apache.hadoop.hbase.TableNotFoundException;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.shaded.protobuf.RequestConverter;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos;
@ -98,7 +98,7 @@ public class TestReplicasClient {
/**
* This copro is used to synchronize the tests.
*/
public static class SlowMeCopro extends BaseRegionObserver {
public static class SlowMeCopro implements RegionObserver {
static final AtomicLong sleepTime = new AtomicLong(0);
static final AtomicBoolean slowDownNext = new AtomicBoolean(false);
static final AtomicInteger countOfNext = new AtomicInteger(0);

View File

@ -39,7 +39,7 @@ import org.apache.hadoop.hbase.wal.WALKey;
* passed-in WALEdit, i.e, ignore specified columns when writing, or add a KeyValue. On the other
* side, it checks whether the ignored column is still in WAL when Restoreed at region reconstruct.
*/
public class SampleRegionWALObserver extends BaseRegionObserver implements WALObserver {
public class SampleRegionWALObserver implements WALObserver, RegionObserver {
private static final Log LOG = LogFactory.getLog(SampleRegionWALObserver.class);

View File

@ -74,7 +74,7 @@ import org.apache.hadoop.hbase.wal.WALKey;
* A sample region observer that tests the RegionObserver interface.
* It works with TestRegionObserverInterface to provide the test case.
*/
public class SimpleRegionObserver extends BaseRegionObserver {
public class SimpleRegionObserver implements RegionObserver {
final AtomicInteger ctBeforeDelete = new AtomicInteger(1);
final AtomicInteger ctPreOpen = new AtomicInteger(0);

View File

@ -144,7 +144,7 @@ public class TestCoprocessorInterface {
}
}
public static class CoprocessorImpl extends BaseRegionObserver {
public static class CoprocessorImpl implements RegionObserver {
private boolean startCalled;
private boolean stopCalled;
@ -237,7 +237,7 @@ public class TestCoprocessorInterface {
}
}
public static class CoprocessorII extends BaseRegionObserver {
public static class CoprocessorII implements RegionObserver {
private ConcurrentMap<String, Object> sharedData;
@Override
public void start(CoprocessorEnvironment e) {

View File

@ -95,15 +95,13 @@ public class TestCoprocessorMetrics {
/**
* MasterObserver that has a Timer metric for create table operation.
*/
public static class CustomMasterObserver extends BaseMasterObserver {
public static class CustomMasterObserver implements MasterObserver {
private Timer createTableTimer;
private long start = Long.MIN_VALUE;
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
super.preCreateTable(ctx, desc, regions);
// we rely on the fact that there is only 1 instance of our MasterObserver
this.start = System.currentTimeMillis();
}
@ -111,7 +109,6 @@ public class TestCoprocessorMetrics {
@Override
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> ctx,
HTableDescriptor desc, HRegionInfo[] regions) throws IOException {
super.postCreateTable(ctx, desc, regions);
if (this.start > 0) {
long time = System.currentTimeMillis() - start;
LOG.info("Create table took: " + time);
@ -121,7 +118,6 @@ public class TestCoprocessorMetrics {
@Override
public void start(CoprocessorEnvironment env) throws IOException {
super.start(env);
if (env instanceof MasterCoprocessorEnvironment) {
MetricRegistry registry =
((MasterCoprocessorEnvironment) env).getMetricRegistryForMaster();
@ -134,7 +130,7 @@ public class TestCoprocessorMetrics {
/**
* RegionServerObserver that has a Counter for rollWAL requests.
*/
public static class CustomRegionServerObserver extends BaseRegionServerObserver {
public static class CustomRegionServerObserver implements RegionServerObserver {
/** This is the Counter metric object to keep track of the current count across invocations */
private Counter rollWALCounter;
@Override
@ -142,12 +138,10 @@ public class TestCoprocessorMetrics {
throws IOException {
// Increment the Counter whenever the coprocessor is called
rollWALCounter.increment();
super.postRollWALWriterRequest(ctx);
}
@Override
public void start(CoprocessorEnvironment env) throws IOException {
super.start(env);
if (env instanceof RegionServerCoprocessorEnvironment) {
MetricRegistry registry =
((RegionServerCoprocessorEnvironment) env).getMetricRegistryForRegionServer();
@ -162,20 +156,18 @@ public class TestCoprocessorMetrics {
/**
* WALObserver that has a Counter for walEdits written.
*/
public static class CustomWALObserver extends BaseWALObserver {
public static class CustomWALObserver implements WALObserver {
private Counter walEditsCount;
@Override
public void postWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
HRegionInfo info, org.apache.hadoop.hbase.wal.WALKey logKey,
WALEdit logEdit) throws IOException {
super.postWALWrite(ctx, info, logKey, logEdit);
walEditsCount.increment();
}
@Override
public void start(CoprocessorEnvironment env) throws IOException {
super.start(env);
if (env instanceof WALCoprocessorEnvironment) {
MetricRegistry registry =
((WALCoprocessorEnvironment) env).getMetricRegistryForRegionServer();
@ -190,20 +182,17 @@ public class TestCoprocessorMetrics {
/**
* RegionObserver that has a Counter for preGet()
*/
public static class CustomRegionObserver extends BaseRegionObserver {
public static class CustomRegionObserver implements RegionObserver {
private Counter preGetCounter;
@Override
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get,
List<Cell> results) throws IOException {
super.preGetOp(e, get, results);
preGetCounter.increment();
}
@Override
public void start(CoprocessorEnvironment env) throws IOException {
super.start(env);
if (env instanceof RegionCoprocessorEnvironment) {
MetricRegistry registry =
((RegionCoprocessorEnvironment) env).getMetricRegistryForRegionServer();

View File

@ -87,7 +87,7 @@ public class TestHTableWrapper {
private static final byte[] bytes4 = Bytes.toBytes(4);
private static final byte[] bytes5 = Bytes.toBytes(5);
static class DummyRegionObserver extends BaseRegionObserver {
static class DummyRegionObserver implements RegionObserver {
}
private Table hTableInterface;

View File

@ -96,7 +96,7 @@ public class TestMasterCoprocessorExceptionWithAbort {
}
}
public static class BuggyMasterObserver extends BaseMasterObserver {
public static class BuggyMasterObserver implements MasterObserver {
private boolean preCreateTableCalled;
private boolean postCreateTableCalled;
private boolean startCalled;

View File

@ -72,7 +72,7 @@ public class TestMasterCoprocessorExceptionWithRemove {
}
}
public static class BuggyMasterObserver extends BaseMasterObserver {
public static class BuggyMasterObserver implements MasterObserver {
private boolean preCreateTableCalled;
private boolean postCreateTableCalled;
private boolean startCalled;

View File

@ -63,7 +63,7 @@ public class TestOpenTableInCoprocessor {
/**
* Custom coprocessor that just copies the write to another table.
*/
public static class SendToOtherTableCoprocessor extends BaseRegionObserver {
public static class SendToOtherTableCoprocessor implements RegionObserver {
@Override
public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e, final Put put,
@ -80,7 +80,7 @@ public class TestOpenTableInCoprocessor {
/**
* Coprocessor that creates an HTable with a pool to write to another table
*/
public static class CustomThreadPoolCoprocessor extends BaseRegionObserver {
public static class CustomThreadPoolCoprocessor implements RegionObserver {
/**
* Get a pool that has only ever one thread. A second action added to the pool (running
@ -145,8 +145,10 @@ public class TestOpenTableInCoprocessor {
runCoprocessorConnectionToRemoteTable(CustomThreadPoolCoprocessor.class, completedWithPool);
}
private void runCoprocessorConnectionToRemoteTable(Class<? extends BaseRegionObserver> clazz,
boolean[] completeCheck) throws Throwable {
private void runCoprocessorConnectionToRemoteTable(Class clazz, boolean[] completeCheck)
throws Throwable {
// Check if given class implements RegionObserver.
assert(RegionObserver.class.isAssignableFrom(clazz));
HTableDescriptor primary = new HTableDescriptor(primaryTable);
primary.addFamily(new HColumnDescriptor(family));
// add our coprocessor

View File

@ -204,7 +204,7 @@ public class TestRegionObserverBypass {
t.delete(d);
}
public static class TestCoprocessor extends BaseRegionObserver {
public static class TestCoprocessor implements RegionObserver {
@Override
public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e,
final Put put, final WALEdit edit, final Durability durability)

View File

@ -194,7 +194,7 @@ public class TestRegionObserverForAddingMutationsFromCoprocessors {
}
}
public static class TestMultiMutationCoprocessor extends BaseRegionObserver {
public static class TestMultiMutationCoprocessor implements RegionObserver {
@Override
public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
@ -211,7 +211,7 @@ public class TestRegionObserverForAddingMutationsFromCoprocessors {
}
}
public static class TestDeleteCellCoprocessor extends BaseRegionObserver {
public static class TestDeleteCellCoprocessor implements RegionObserver {
@Override
public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
@ -230,7 +230,7 @@ public class TestRegionObserverForAddingMutationsFromCoprocessors {
}
}
public static class TestDeleteFamilyCoprocessor extends BaseRegionObserver {
public static class TestDeleteFamilyCoprocessor implements RegionObserver {
@Override
public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
@ -249,7 +249,7 @@ public class TestRegionObserverForAddingMutationsFromCoprocessors {
}
}
public static class TestDeleteRowCoprocessor extends BaseRegionObserver {
public static class TestDeleteRowCoprocessor implements RegionObserver {
@Override
public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
@ -268,7 +268,7 @@ public class TestRegionObserverForAddingMutationsFromCoprocessors {
}
}
public static class TestWALObserver extends BaseWALObserver {
public static class TestWALObserver implements WALObserver {
static WALEdit savedEdit = null;
@Override
public void postWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
@ -276,7 +276,6 @@ public class TestRegionObserverForAddingMutationsFromCoprocessors {
if (info.getTable().equals(TableName.valueOf("testCPMutationsAreWrittenToWALEdit"))) {
savedEdit = logEdit;
}
super.postWALWrite(ctx, info, logKey, logEdit);
}
}
}

View File

@ -409,7 +409,7 @@ public class TestRegionObserverInterface {
}
/* Overrides compaction to only output rows with keys that are even numbers */
public static class EvenOnlyCompactor extends BaseRegionObserver {
public static class EvenOnlyCompactor implements RegionObserver {
long lastCompaction;
long lastFlush;

View File

@ -98,16 +98,15 @@ public class TestRegionObserverScannerOpenHook {
}
/**
* Do the same logic as the {@link BaseRegionObserver}. Needed since {@link BaseRegionObserver} is
* an abstract class.
* Do the default logic in {@link RegionObserver} interface.
*/
public static class EmptyRegionObsever extends BaseRegionObserver {
public static class EmptyRegionObsever implements RegionObserver {
}
/**
* Don't return any data from a scan by creating a custom {@link StoreScanner}.
*/
public static class NoDataFromScan extends BaseRegionObserver {
public static class NoDataFromScan implements RegionObserver {
@Override
public KeyValueScanner preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store, Scan scan, NavigableSet<byte[]> targetCols, KeyValueScanner s, long readPt)
@ -120,7 +119,7 @@ public class TestRegionObserverScannerOpenHook {
/**
* Don't allow any data in a flush by creating a custom {@link StoreScanner}.
*/
public static class NoDataFromFlush extends BaseRegionObserver {
public static class NoDataFromFlush implements RegionObserver {
@Override
public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store, KeyValueScanner memstoreScanner, InternalScanner s) throws IOException {
@ -136,7 +135,7 @@ public class TestRegionObserverScannerOpenHook {
* Don't allow any data to be written out in the compaction by creating a custom
* {@link StoreScanner}.
*/
public static class NoDataFromCompaction extends BaseRegionObserver {
public static class NoDataFromCompaction implements RegionObserver {
@Override
public InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store, List<? extends KeyValueScanner> scanners, ScanType scanType,

View File

@ -48,7 +48,7 @@ public class TestRegionObserverStacking extends TestCase {
= new HBaseTestingUtility();
static final Path DIR = TEST_UTIL.getDataTestDir();
public static class ObserverA extends BaseRegionObserver {
public static class ObserverA implements RegionObserver {
long id;
@Override
public void postPut(final ObserverContext<RegionCoprocessorEnvironment> c,
@ -63,7 +63,7 @@ public class TestRegionObserverStacking extends TestCase {
}
}
public static class ObserverB extends BaseRegionObserver {
public static class ObserverB implements RegionObserver {
long id;
@Override
public void postPut(final ObserverContext<RegionCoprocessorEnvironment> c,
@ -78,7 +78,7 @@ public class TestRegionObserverStacking extends TestCase {
}
}
public static class ObserverC extends BaseRegionObserver {
public static class ObserverC implements RegionObserver {
long id;
@Override

View File

@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.MapReduceTests;
import org.apache.hadoop.hbase.client.Durability;
@ -49,7 +50,6 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.regionserver.Region;
@ -247,7 +247,7 @@ public class TestImportTSVWithOperationAttributes implements Configurable {
assertTrue(verified);
}
public static class OperationAttributesTestController extends BaseRegionObserver {
public static class OperationAttributesTestController implements RegionObserver {
@Override
public void prePut(ObserverContext<RegionCoprocessorEnvironment> e, Put put, WALEdit edit,

View File

@ -34,11 +34,11 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.MapReduceTests;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.regionserver.Region;
@ -156,7 +156,7 @@ public class TestImportTSVWithTTLs implements Configurable {
return tool;
}
public static class TTLCheckingObserver extends BaseRegionObserver {
public static class TTLCheckingObserver implements RegionObserver {
@Override
public void prePut(ObserverContext<RegionCoprocessorEnvironment> e, Put put, WALEdit edit,

View File

@ -27,7 +27,6 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -59,7 +58,6 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coordination.ZkCoordinatedStateManager;
import org.apache.hadoop.hbase.client.TableState;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
@ -1359,7 +1357,7 @@ public class TestAssignmentManagerOnCluster {
}
}
public static class MyRegionObserver extends BaseRegionObserver {
public static class MyRegionObserver implements RegionObserver {
// If enabled, fail all preClose calls
static AtomicBoolean preCloseEnabled = new AtomicBoolean(false);

View File

@ -68,9 +68,9 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.io.HFileLink;
import org.apache.hadoop.hbase.io.crypto.KeyProviderForTesting;
import org.apache.hadoop.hbase.io.crypto.aes.AES;
@ -750,7 +750,7 @@ public class TestMobCompactor {
* This copro overwrites the default compaction policy. It always chooses two latest
* hfiles and compacts them into a new one.
*/
public static class CompactTwoLatestHfilesCopro extends BaseRegionObserver {
public static class CompactTwoLatestHfilesCopro implements RegionObserver {
@Override
public void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final List<StoreFile> candidates, final CompactionRequest request)

View File

@ -55,13 +55,12 @@ import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseMasterObserver;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.BaseRegionServerObserver;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionServerObserver;
import org.apache.hadoop.hbase.mapreduce.TableInputFormatBase;
@ -282,7 +281,7 @@ public class TestNamespaceAuditor {
assertNull("Namespace state not found to be null.", stateInfo);
}
public static class CPRegionServerObserver extends BaseRegionServerObserver {
public static class CPRegionServerObserver implements RegionServerObserver {
private volatile boolean shouldFailMerge = false;
public void failMerge(boolean fail) {
@ -308,7 +307,7 @@ public class TestNamespaceAuditor {
}
}
public static class CPMasterObserver extends BaseMasterObserver {
public static class CPMasterObserver implements MasterObserver {
private volatile boolean shouldFailMerge = false;
public void failMerge(boolean fail) {
@ -591,7 +590,7 @@ public class TestNamespaceAuditor {
return Bytes.toBytes("" + key);
}
public static class CustomObserver extends BaseRegionObserver{
public static class CustomObserver implements RegionObserver {
volatile CountDownLatch postSplit;
volatile CountDownLatch postCompact;
@ -676,7 +675,7 @@ public class TestNamespaceAuditor {
.getMasterQuotaManager().getNamespaceQuotaManager();
}
public static class MasterSyncObserver extends BaseMasterObserver {
public static class MasterSyncObserver implements MasterObserver {
volatile CountDownLatch tableDeletionLatch;
static boolean throwExceptionInPreCreateTableAction;

View File

@ -26,9 +26,9 @@ import java.util.NavigableSet;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.TestFromClientSideWithCoprocessor;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
/**
* RegionObserver that just reimplements the default behavior,
@ -37,7 +37,7 @@ import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
* {@link TestCompactionWithCoprocessor} to make sure that a wide range
* of functionality still behaves as expected.
*/
public class NoOpScanPolicyObserver extends BaseRegionObserver {
public class NoOpScanPolicyObserver implements RegionObserver {
/**
* Reimplement the default behavior
*/

View File

@ -53,9 +53,9 @@ import org.apache.hadoop.hbase.client.RpcRetryingCallerFactory;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.SecureBulkLoadClient;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
@ -248,7 +248,7 @@ public class TestHRegionServerBulkLoad {
}
}
public static class MyObserver extends BaseRegionObserver {
public static class MyObserver implements RegionObserver {
static int sleepDuration;
@Override
public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e,

View File

@ -36,9 +36,9 @@ import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
@ -64,7 +64,7 @@ public class TestScannerRetriableFailure {
@Rule public TestTableName TEST_TABLE = new TestTableName();
public static class FaultyScannerObserver extends BaseRegionObserver {
public static class FaultyScannerObserver implements RegionObserver {
private int faults = 0;
@Override

View File

@ -32,9 +32,9 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.io.hfile.CorruptHFileException;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
@ -65,7 +65,7 @@ public class TestScannerWithCorruptHFile {
TEST_UTIL.shutdownMiniCluster();
}
public static class CorruptHFileCoprocessor extends BaseRegionObserver {
public static class CorruptHFileCoprocessor implements RegionObserver {
@Override
public boolean preScannerNext(ObserverContext<RegionCoprocessorEnvironment> e,
InternalScanner s, List<Result> results, int limit, boolean hasMore) throws IOException {

View File

@ -29,9 +29,9 @@ import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Threads;
@ -68,14 +68,14 @@ public class TestSettingTimeoutOnBlockingPoint {
TEST_UTIL.shutdownMiniCluster();
}
public static class SleepCoprocessor extends BaseRegionObserver {
public static class SleepCoprocessor implements RegionObserver {
public static final int SLEEP_TIME = 10000;
@Override
public Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> e,
final Increment increment) throws IOException {
Threads.sleep(SLEEP_TIME);
return super.preIncrementAfterRowLock(e, increment);
return null;
}
}

View File

@ -66,7 +66,7 @@ import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.TestReplicasClient.SlowMeCopro;
import org.apache.hadoop.hbase.coprocessor.BaseMasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.master.AssignmentManager;
@ -268,7 +268,7 @@ public class TestSplitTransactionOnCluster {
assertEquals(2, cluster.getRegions(tableName).size());
}
public static class FailingSplitMasterObserver extends BaseMasterObserver {
public static class FailingSplitMasterObserver implements MasterObserver {
volatile CountDownLatch latch;
@Override
public void start(CoprocessorEnvironment e) throws IOException {

View File

@ -49,10 +49,10 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.testclassification.MediumTests;
@ -543,7 +543,7 @@ public class TestTags {
}
}
public static class TestCoprocessorForTags extends BaseRegionObserver {
public static class TestCoprocessorForTags implements RegionObserver {
public static volatile boolean checkTagPresence = false;
public static List<Tag> tags = null;
@ -587,14 +587,14 @@ public class TestTags {
public Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> e, Increment increment)
throws IOException {
updateMutationAddingTags(increment);
return super.preIncrement(e, increment);
return null;
}
@Override
public Result preAppend(ObserverContext<RegionCoprocessorEnvironment> e, Append append)
throws IOException {
updateMutationAddingTags(append);
return super.preAppend(e, append);
return null;
}
@Override

View File

@ -55,16 +55,13 @@ import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.replication.ReplicationAdmin;
import org.apache.hadoop.hbase.client.replication.ReplicationSerDeHelper;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.regionserver.RSRpcServices;
import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.replication.regionserver.TestSourceFSConfigurationProvider;
@ -80,8 +77,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import com.google.protobuf.ServiceException;
@Category({ReplicationTests.class, LargeTests.class})
public class TestMasterReplication {
@ -717,7 +712,7 @@ public class TestMasterReplication {
* Use a coprocessor to count puts and deletes. as KVs would be replicated back with the same
* timestamp there is otherwise no way to count them.
*/
public static class CoprocessorCounter extends BaseRegionObserver {
public static class CoprocessorCounter implements RegionObserver {
private int nCount = 0;
private int nDelete = 0;

View File

@ -51,10 +51,10 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.replication.ReplicationAdmin;
import org.apache.hadoop.hbase.codec.KeyValueCodecWithTags;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.ReplicationTests;
@ -197,7 +197,7 @@ public class TestReplicationWithTags {
}
}
public static class TestCoprocessorForTagsAtSource extends BaseRegionObserver {
public static class TestCoprocessorForTagsAtSource implements RegionObserver {
@Override
public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e, final Put put,
final WALEdit edit, final Durability durability) throws IOException {
@ -230,7 +230,7 @@ public class TestReplicationWithTags {
}
}
public static class TestCoprocessorForTagsAtSink extends BaseRegionObserver {
public static class TestCoprocessorForTagsAtSink implements RegionObserver {
public static List<Tag> tags = null;
@Override

View File

@ -42,10 +42,10 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.RpcRetryingCallerFactory;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseWALObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.WALCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.WALObserver;
import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.ReplicateWALEntryResponse;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
@ -148,7 +148,7 @@ public class TestRegionReplicaReplicationEndpointNoMaster {
static ConcurrentLinkedQueue<Entry> entries = new ConcurrentLinkedQueue<Entry>();
public static class WALEditCopro extends BaseWALObserver {
public static class WALEditCopro implements WALObserver {
public WALEditCopro() {
entries.clear();
}

View File

@ -49,7 +49,7 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseMasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
@ -622,7 +622,7 @@ public class SecureTestUtil {
});
}
public static class MasterSyncObserver extends BaseMasterObserver {
public static class MasterSyncObserver implements MasterObserver {
volatile CountDownLatch tableCreationLatch = null;
volatile CountDownLatch tableDeletionLatch = null;

View File

@ -39,6 +39,7 @@ import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.SecurityTests;
import org.apache.hadoop.hbase.util.Bytes;
@ -289,6 +290,8 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil {
admin.listTables("^" + TEST_TABLE.getNameAsString() + "$"));
}
public static class TestRegionObserver implements RegionObserver {}
/**
* Test a table creation including a coprocessor path
* which is on the classpath
@ -308,7 +311,7 @@ public class TestCoprocessorWhitelistMasterObserver extends SecureTestUtil {
HTableDescriptor htd = new HTableDescriptor(TEST_TABLE);
HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY);
htd.addFamily(hcd);
htd.addCoprocessor("org.apache.hadoop.hbase.coprocessor.BaseRegionObserver");
htd.addCoprocessor(TestRegionObserver.class.getName());
Connection connection = ConnectionFactory.createConnection(conf);
Admin admin = connection.getAdmin();
LOG.info("Creating Table");

View File

@ -56,12 +56,11 @@ import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.client.replication.ReplicationAdmin;
import org.apache.hadoop.hbase.codec.KeyValueCodecWithTags;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabelsResponse;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.replication.ReplicationEndpoint;
@ -394,7 +393,7 @@ public class TestVisibilityLabelsReplication {
// A simple BaseRegionbserver impl that allows to add a non-visibility tag from the
// attributes of the Put mutation. The existing cells in the put mutation is overwritten
// with a new cell that has the visibility tags and the non visibility tag
public static class SimpleCP extends BaseRegionObserver {
public static class SimpleCP implements RegionObserver {
@Override
public void prePut(ObserverContext<RegionCoprocessorEnvironment> e, Put m, WALEdit edit,
Durability durability) throws IOException {
@ -423,7 +422,7 @@ public class TestVisibilityLabelsReplication {
}
}
public static class TestCoprocessorForTagsAtSink extends BaseRegionObserver {
public static class TestCoprocessorForTagsAtSink implements RegionObserver {
public static List<Tag> tags = null;
@Override

View File

@ -28,7 +28,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.BaseMasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
@ -74,7 +74,7 @@ public class TestSnapshotClientRetries {
cloneAndAssertOneRetry(snapshotName, TEST_TABLE.getTableName());
}
public static class MasterSyncObserver extends BaseMasterObserver {
public static class MasterSyncObserver implements MasterObserver {
volatile AtomicInteger snapshotCount = null;
volatile AtomicInteger cloneCount = null;

View File

@ -58,7 +58,7 @@ import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseMasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterObserver;
import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.master.RegionStates;
@ -590,7 +590,7 @@ public class BaseTestHBaseFsck {
@org.junit.Rule
public TestName name = new TestName();
public static class MasterSyncObserver extends BaseMasterObserver {
public static class MasterSyncObserver implements MasterObserver {
volatile CountDownLatch tableCreationLatch = null;
volatile CountDownLatch tableDeletionLatch = null;

View File

@ -41,16 +41,14 @@ import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.IsolationLevel;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.regionserver.HStore;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
import org.apache.hadoop.hbase.regionserver.ScanInfo;
@ -211,7 +209,7 @@ public class TestCoprocessorScanPolicy {
EnvironmentEdgeManager.reset();
}
public static class ScanObserver extends BaseRegionObserver {
public static class ScanObserver implements RegionObserver {
private Map<TableName, Long> ttls =
new HashMap<TableName, Long>();
private Map<TableName, Integer> versions =

View File

@ -26,9 +26,9 @@ import org.apache.hadoop.hbase.NotServingRegionException;
import org.apache.hadoop.hbase.RegionTooBusyException;
import org.apache.hadoop.hbase.UnknownScannerException;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
import org.apache.hadoop.hbase.exceptions.OutOfOrderScannerNextException;
import org.apache.hadoop.hbase.exceptions.RegionMovedException;
@ -42,7 +42,7 @@ import java.util.List;
/**
* Simple test coprocessor for injecting exceptions on Get requests.
*/
public class ErrorThrowingGetObserver extends BaseRegionObserver {
public class ErrorThrowingGetObserver implements RegionObserver {
public static final String SHOULD_ERROR_ATTRIBUTE = "error";
@Override
@ -75,7 +75,6 @@ public class ErrorThrowingGetObserver extends BaseRegionObserver {
throw new DoNotRetryIOException("Failing for test");
}
}
super.preGetOp(e, get, results);
}
public enum ErrorType {

View File

@ -37,11 +37,10 @@ import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.filter.ParseFilter;
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos;
import org.apache.hadoop.hbase.security.UserProvider;
import org.apache.hadoop.hbase.test.MetricsAssertHelper;
import org.apache.hadoop.hbase.testclassification.ClientTests;
@ -1333,7 +1332,7 @@ public class TestThriftHBaseServiceHandler {
assertTColumnValueEqual(columnValueB, result.getColumnValues().get(1));
}
public static class DelayingRegionObserver extends BaseRegionObserver {
public static class DelayingRegionObserver implements RegionObserver {
private static final Log LOG = LogFactory.getLog(DelayingRegionObserver.class);
// sleep time in msec
private long delayMillis;

View File

@ -100,12 +100,10 @@ AOP::
=== Coprocessor Implementation Overview
. Either your class should extend one of the Coprocessor classes, such as
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/BaseRegionObserver.html[BaseRegionObserver],
or it should implement the link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/Coprocessor.html[Coprocessor]
or
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/CoprocessorService.html[CoprocessorService]
interface.
. Your class should implement one of the Coprocessor interfaces -
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/Coprocessor.html[Coprocessor],
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/RegionObserver.html[RegionObserver],
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/CoprocessorService.html[CoprocessorService] - to name a few.
. Load the coprocessor, either statically (from the configuration) or dynamically,
using HBase Shell. For more details see <<cp_loading,Loading Coprocessors>>.
@ -150,36 +148,22 @@ RegionObserver::
A RegionObserver coprocessor allows you to observe events on a region, such as `Get`
and `Put` operations. See
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/RegionObserver.html[RegionObserver].
Consider overriding the convenience class
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/BaseRegionObserver.html[BaseRegionObserver],
which implements the `RegionObserver` interface and will not break if new methods are added.
RegionServerObserver::
A RegionServerObserver allows you to observe events related to the RegionServer's
operation, such as starting, stopping, or performing merges, commits, or rollbacks.
See
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/RegionServerObserver.html[RegionServerObserver].
Consider overriding the convenience class
https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/BaseMasterAndRegionObserver.html[BaseMasterAndRegionObserver]
which implements both `MasterObserver` and `RegionServerObserver` interfaces and
will not break if new methods are added.
MasterOvserver::
MasterObserver::
A MasterObserver allows you to observe events related to the HBase Master, such
as table creation, deletion, or schema modification. See
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/MasterObserver.html[MasterObserver].
Consider overriding the convenience class
https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/BaseMasterAndRegionObserver.html[BaseMasterAndRegionObserver],
which implements both `MasterObserver` and `RegionServerObserver` interfaces and
will not break if new methods are added.
WalObserver::
A WalObserver allows you to observe events related to writes to the Write-Ahead
Log (WAL). See
link:http://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/WALObserver.html[WALObserver].
Consider overriding the convenience class
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/BaseWALObserver.html[BaseWALObserver],
which implements the `WalObserver` interface and will not break if new methods are added.
<<cp_example,Examples>> provides working examples of observer coprocessors.
@ -499,8 +483,8 @@ of the `users` table.
The following Observer coprocessor prevents the details of the user `admin` from being
returned in a `Get` or `Scan` of the `users` table.
. Write a class that extends the
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/BaseRegionObserver.html[BaseRegionObserver]
. Write a class that implements the
link:https://hbase.apache.org/devapidocs/org/apache/hadoop/hbase/coprocessor/RegionObserver.html[RegionObserver]
class.
. Override the `preGetOp()` method (the `preGet()` method is deprecated) to check
@ -520,7 +504,7 @@ Following are the implementation of the above steps:
[source,java]
----
public class RegionObserverExample extends BaseRegionObserver {
public class RegionObserverExample implements RegionObserver {
private static final byte[] ADMIN = Bytes.toBytes("admin");
private static final byte[] COLUMN_FAMILY = Bytes.toBytes("details");