HBASE-18798 Remove the unused methods in RegionServerObserver
This commit is contained in:
parent
5c12e424e6
commit
190a660d17
|
@ -24,12 +24,9 @@ import java.util.List;
|
|||
import org.apache.hadoop.hbase.CellScanner;
|
||||
import org.apache.hadoop.hbase.Coprocessor;
|
||||
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
|
||||
import org.apache.hadoop.hbase.MetaMutationAnnotation;
|
||||
import org.apache.yetus.audience.InterfaceAudience;
|
||||
import org.apache.yetus.audience.InterfaceStability;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -67,65 +64,6 @@ public interface RegionServerObserver extends Coprocessor {
|
|||
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.
|
||||
* @param ctx the environment to interact with the framework and region server.
|
||||
* @param regionA region being merged.
|
||||
* @param regionB region being merged.
|
||||
*/
|
||||
default void preMerge(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
|
||||
final Region regionA, final Region regionB) throws IOException {}
|
||||
|
||||
/**
|
||||
* called after the regions merge.
|
||||
* @param ctx the environment to interact with the framework and region server.
|
||||
* @param regionA region being merged.
|
||||
* @param regionB region being merged.
|
||||
*/
|
||||
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 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.
|
||||
*/
|
||||
default void preMergeCommit(final ObserverContext<RegionServerCoprocessorEnvironment> ctx,
|
||||
final Region regionA, final Region regionB,
|
||||
@MetaMutationAnnotation List<Mutation> metaEntries) throws IOException {}
|
||||
|
||||
/**
|
||||
* This will be called after PONR step as part of regions merge transaction.
|
||||
* @param ctx the environment to interact with the framework and region server.
|
||||
* @param regionA region being merged.
|
||||
* @param regionB region being merged.
|
||||
*/
|
||||
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 the environment to interact with the framework and region server.
|
||||
* @param regionA region being merged.
|
||||
* @param regionB region being merged.
|
||||
*/
|
||||
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 the environment to interact with the framework and region server.
|
||||
* @param regionA region being merged.
|
||||
* @param regionB region being merged.
|
||||
*/
|
||||
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 the environment to interact with the framework and region server.
|
||||
|
|
|
@ -30,10 +30,8 @@ import org.apache.hadoop.hbase.CellScanner;
|
|||
import org.apache.hadoop.hbase.Coprocessor;
|
||||
import org.apache.hadoop.hbase.CoprocessorEnvironment;
|
||||
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
|
||||
import org.apache.hadoop.hbase.MetaMutationAnnotation;
|
||||
import org.apache.yetus.audience.InterfaceAudience;
|
||||
import org.apache.yetus.audience.InterfaceStability;
|
||||
import org.apache.hadoop.hbase.client.Mutation;
|
||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
|
||||
import org.apache.hadoop.hbase.coprocessor.MetricsCoprocessor;
|
||||
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
|
||||
|
@ -97,73 +95,6 @@ public class RegionServerCoprocessorHost extends
|
|||
});
|
||||
}
|
||||
|
||||
public boolean preMerge(final HRegion regionA, final HRegion regionB, final User user) throws IOException {
|
||||
return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) {
|
||||
@Override
|
||||
public void call(RegionServerObserver oserver,
|
||||
ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException {
|
||||
oserver.preMerge(ctx, regionA, regionB);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void postMerge(final HRegion regionA, final HRegion regionB, final HRegion mergedRegion,
|
||||
final User user)
|
||||
throws IOException {
|
||||
execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) {
|
||||
@Override
|
||||
public void call(RegionServerObserver oserver,
|
||||
ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException {
|
||||
oserver.postMerge(ctx, regionA, regionB, mergedRegion);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean preMergeCommit(final HRegion regionA, final HRegion regionB,
|
||||
final @MetaMutationAnnotation List<Mutation> metaEntries, final User user)
|
||||
throws IOException {
|
||||
return execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) {
|
||||
@Override
|
||||
public void call(RegionServerObserver oserver,
|
||||
ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException {
|
||||
oserver.preMergeCommit(ctx, regionA, regionB, metaEntries);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void postMergeCommit(final HRegion regionA, final HRegion regionB,
|
||||
final HRegion mergedRegion, final User user) throws IOException {
|
||||
execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) {
|
||||
@Override
|
||||
public void call(RegionServerObserver oserver,
|
||||
ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException {
|
||||
oserver.postMergeCommit(ctx, regionA, regionB, mergedRegion);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void preRollBackMerge(final HRegion regionA, final HRegion regionB, final User user)
|
||||
throws IOException {
|
||||
execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) {
|
||||
@Override
|
||||
public void call(RegionServerObserver oserver,
|
||||
ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException {
|
||||
oserver.preRollBackMerge(ctx, regionA, regionB);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void postRollBackMerge(final HRegion regionA, final HRegion regionB, final User user)
|
||||
throws IOException {
|
||||
execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation(user) {
|
||||
@Override
|
||||
public void call(RegionServerObserver oserver,
|
||||
ObserverContext<RegionServerCoprocessorEnvironment> ctx) throws IOException {
|
||||
oserver.postRollBackMerge(ctx, regionA, regionB);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void preRollWALWriterRequest() throws IOException {
|
||||
execOperation(coprocessors.isEmpty() ? null : new CoprocessorOperation() {
|
||||
@Override
|
||||
|
|
|
@ -2574,33 +2574,6 @@ public class AccessController implements MasterObserver, RegionObserver, RegionS
|
|||
Action.ADMIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preMerge(ObserverContext<RegionServerCoprocessorEnvironment> ctx, Region regionA,
|
||||
Region regionB) throws IOException {
|
||||
requirePermission(getActiveUser(ctx), "mergeRegions", regionA.getTableDescriptor().getTableName(),
|
||||
null, null, Action.ADMIN);
|
||||
}
|
||||
|
||||
@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 {
|
||||
|
|
|
@ -63,7 +63,6 @@ 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.master.HMaster;
|
||||
import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
|
||||
|
@ -71,11 +70,9 @@ import org.apache.hadoop.hbase.master.TableNamespaceManager;
|
|||
import org.apache.hadoop.hbase.quotas.MasterQuotaManager;
|
||||
import org.apache.hadoop.hbase.quotas.QuotaExceededException;
|
||||
import org.apache.hadoop.hbase.quotas.QuotaUtil;
|
||||
import org.apache.hadoop.hbase.regionserver.Region;
|
||||
import org.apache.hadoop.hbase.regionserver.Store;
|
||||
import org.apache.hadoop.hbase.regionserver.StoreFile;
|
||||
import org.apache.hadoop.hbase.regionserver.compactions.CompactionLifeCycleTracker;
|
||||
import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
|
||||
import org.apache.hadoop.hbase.snapshot.RestoreSnapshotException;
|
||||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
@ -294,16 +291,6 @@ public class TestNamespaceAuditor {
|
|||
wait();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void preMerge(ObserverContext<RegionServerCoprocessorEnvironment> ctx,
|
||||
Region regionA, Region regionB) throws IOException {
|
||||
triggered = true;
|
||||
notifyAll();
|
||||
if (shouldFailMerge) {
|
||||
throw new IOException("fail merge");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class CPMasterObserver implements MasterObserver {
|
||||
|
|
|
@ -856,31 +856,6 @@ public class TestAccessController extends SecureTestUtil {
|
|||
USER_GROUP_WRITE, USER_GROUP_CREATE);
|
||||
}
|
||||
|
||||
@Test (timeout=180000)
|
||||
public void testMergeRegions() throws Exception {
|
||||
final TableName tableName = TableName.valueOf(name.getMethodName());
|
||||
createTestTable(tableName);
|
||||
try {
|
||||
final List<HRegion> regions = TEST_UTIL.getHBaseCluster().findRegionsForTable(tableName);
|
||||
assertTrue("not enough regions: " + regions.size(), regions.size() >= 2);
|
||||
|
||||
AccessTestAction action = new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
ACCESS_CONTROLLER.preMerge(ObserverContext.createAndPrepare(RSCP_ENV, null),
|
||||
regions.get(0), regions.get(1));
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_GROUP_ADMIN);
|
||||
verifyDenied(action, USER_CREATE, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ,
|
||||
USER_GROUP_WRITE, USER_GROUP_CREATE);
|
||||
} finally {
|
||||
deleteTable(TEST_UTIL, tableName);
|
||||
}
|
||||
}
|
||||
|
||||
@Test (timeout=180000)
|
||||
public void testFlush() throws Exception {
|
||||
AccessTestAction action = new AccessTestAction() {
|
||||
|
|
|
@ -836,21 +836,6 @@ public class TestWithDisabledAuthorization extends SecureTestUtil {
|
|||
}
|
||||
}, SUPERUSER, USER_ADMIN, USER_RW, USER_RO, USER_OWNER, USER_CREATE, USER_QUAL, USER_NONE);
|
||||
|
||||
// preMerge
|
||||
verifyAllowed(new AccessTestAction() {
|
||||
@Override
|
||||
public Object run() throws Exception {
|
||||
HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
|
||||
Region region_a = mock(Region.class);
|
||||
when(region_a.getTableDescriptor()).thenReturn(htd);
|
||||
Region region_b = mock(Region.class);
|
||||
when(region_b.getTableDescriptor()).thenReturn(htd);
|
||||
ACCESS_CONTROLLER.preMerge(ObserverContext.createAndPrepare(RSCP_ENV, null), region_a,
|
||||
region_b);
|
||||
return null;
|
||||
}
|
||||
}, SUPERUSER, USER_ADMIN, USER_RW, USER_RO, USER_OWNER, USER_CREATE, USER_QUAL, USER_NONE);
|
||||
|
||||
// preRollWALWriterRequest
|
||||
verifyAllowed(new AccessTestAction() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue