org.apache.hadoop.hbase.coprocessor.RegionServerObserver Java Examples

The following examples show how to use org.apache.hadoop.hbase.coprocessor.RegionServerObserver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestNamespaceAuditor.java    From hbase with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void before() throws Exception {
  Configuration conf = UTIL.getConfiguration();
  conf.set(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY, CustomObserver.class.getName());
  conf.setStrings(
    CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
    MasterSyncObserver.class.getName(), CPMasterObserver.class.getName());
  conf.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 5);
  conf.setBoolean(QuotaUtil.QUOTA_CONF_KEY, true);
  conf.setClass("hbase.coprocessor.regionserver.classes", CPRegionServerObserver.class,
    RegionServerObserver.class);
  StartMiniClusterOption option = StartMiniClusterOption.builder().numMasters(2).build();
  UTIL.startMiniCluster(option);
  waitForQuotaInitialize(UTIL);
  ADMIN = UTIL.getAdmin();
}
 
Example #2
Source File: RegionServerCoprocessorHost.java    From hbase with Apache License 2.0 6 votes vote down vote up
public void preStop(String message, User user) throws IOException {
  // While stopping the region server all coprocessors method should be executed first then the
  // coprocessor should be cleaned up.
  if (coprocEnvironments.isEmpty()) {
    return;
  }
  execShutdown(new RegionServerObserverOperation(user) {
    @Override
    public void call(RegionServerObserver observer) throws IOException {
      observer.preStopRegionServer(this);
    }

    @Override
    public void postEnvCall() {
      // invoke coprocessor stop method
      shutdown(this.getEnvironment());
    }
  });
}
 
Example #3
Source File: BaseTest.java    From phoenix with Apache License 2.0 5 votes vote down vote up
public static Configuration setUpConfigForMiniCluster(Configuration conf, ReadOnlyProps overrideProps) {
    assertNotNull(conf);
    setDefaultTestConfig(conf, overrideProps);
    /*
     * The default configuration of mini cluster ends up spawning a lot of threads
     * that are not really needed by phoenix for test purposes. Limiting these threads
     * helps us in running several mini clusters at the same time without hitting 
     * the threads limit imposed by the OS. 
     */
    conf.setInt(HConstants.REGION_SERVER_HANDLER_COUNT, 5);
    conf.setInt("hbase.regionserver.metahandler.count", 2);
    conf.setInt(HConstants.MASTER_HANDLER_COUNT, 2);
    conf.setClass("hbase.coprocessor.regionserver.classes", LocalIndexMerger.class,
        RegionServerObserver.class);
    conf.setInt("dfs.namenode.handler.count", 2);
    conf.setInt("dfs.namenode.service.handler.count", 2);
    conf.setInt("dfs.datanode.handler.count", 2);
    conf.setInt("ipc.server.read.threadpool.size", 2);
    conf.setInt("ipc.server.handler.threadpool.size", 2);
    conf.setInt("hbase.hconnection.threads.max", 2);
    conf.setInt("hbase.hconnection.threads.core", 2);
    conf.setInt("hbase.htable.threads.max", 2);
    conf.setInt("hbase.regionserver.hlog.syncer.count", 2);
    conf.setInt("hbase.hlog.asyncer.number", 2);
    conf.setInt("hbase.assignment.zkevent.workers", 5);
    conf.setInt("hbase.assignment.threads.max", 5);
    conf.setInt("hbase.catalogjanitor.interval", 5000);
    return conf;
}
 
Example #4
Source File: RegionServerCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postExecuteProcedures() throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new RegionServerObserverOperation() {
    @Override
    public void call(RegionServerObserver observer) throws IOException {
      observer.postExecuteProcedures(this);
    }
  });
}
 
Example #5
Source File: RegionServerCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preExecuteProcedures() throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new RegionServerObserverOperation() {
    @Override
    public void call(RegionServerObserver observer) throws IOException {
      observer.preExecuteProcedures(this);
    }
  });
}
 
Example #6
Source File: RegionServerCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postClearCompactionQueues() throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new RegionServerObserverOperation() {
    @Override
    public void call(RegionServerObserver observer) throws IOException {
      observer.postClearCompactionQueues(this);
    }
  });
}
 
Example #7
Source File: RegionServerCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preClearCompactionQueues() throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new RegionServerObserverOperation() {
    @Override
    public void call(RegionServerObserver observer) throws IOException {
      observer.preClearCompactionQueues(this);
    }
  });
}
 
Example #8
Source File: RegionServerCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public ReplicationEndpoint postCreateReplicationEndPoint(final ReplicationEndpoint endpoint)
    throws IOException {
  if (this.coprocEnvironments.isEmpty()) {
    return endpoint;
  }
  return execOperationWithResult(
      new ObserverOperationWithResult<RegionServerObserver, ReplicationEndpoint>(
          rsObserverGetter, endpoint) {
    @Override
    public ReplicationEndpoint call(RegionServerObserver observer) throws IOException {
      return observer.postCreateReplicationEndPoint(this, getResult());
    }
  });
}
 
Example #9
Source File: RegionServerCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postReplicateLogEntries()
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new RegionServerObserverOperation() {
    @Override
    public void call(RegionServerObserver observer) throws IOException {
      observer.postReplicateLogEntries(this);
    }
  });
}
 
Example #10
Source File: RegionServerCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preReplicateLogEntries()
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new RegionServerObserverOperation() {
    @Override
    public void call(RegionServerObserver observer) throws IOException {
      observer.preReplicateLogEntries(this);
    }
  });
}
 
Example #11
Source File: RegionServerCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postRollWALWriterRequest() throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new RegionServerObserverOperation() {
    @Override
    public void call(RegionServerObserver observer) throws IOException {
      observer.postRollWALWriterRequest(this);
    }
  });
}
 
Example #12
Source File: RegionServerCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preRollWALWriterRequest() throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new RegionServerObserverOperation() {
    @Override
    public void call(RegionServerObserver observer) throws IOException {
      observer.preRollWALWriterRequest(this);
    }
  });
}
 
Example #13
Source File: CurrentCoprocessorMethods.java    From hbase with Apache License 2.0 5 votes vote down vote up
public CurrentCoprocessorMethods() {
  addMethods(BulkLoadObserver.class);
  addMethods(EndpointObserver.class);
  addMethods(MasterObserver.class);
  addMethods(RegionObserver.class);
  addMethods(RegionServerObserver.class);
  addMethods(WALObserver.class);
}
 
Example #14
Source File: HBaseAtlasCoprocessor.java    From atlas with Apache License 2.0 5 votes vote down vote up
private void init(){
    if(LOG.isDebugEnabled()) {
        LOG.debug("==> HBaseAtlasCoprocessor.init()");
    }

    try {
        atlasPluginClassLoader = AtlasPluginClassLoader.getInstance(ATLAS_PLUGIN_TYPE, this.getClass());

        @SuppressWarnings("unchecked")
        Class<?> cls = Class.forName(ATLAS_HBASE_HOOK_IMPL_CLASSNAME, true, atlasPluginClassLoader);

        activatePluginClassLoader();

        impl                     = cls.newInstance();
        implMasterObserver       = (MasterObserver)impl;
        implRegionObserver       = (RegionObserver)impl;
        implRegionServerObserver = (RegionServerObserver)impl;
        implMasterCoprocessor 	 = (MasterCoprocessor)impl;

    } catch (Exception e) {
        // check what need to be done
        LOG.error("Error Enabling RangerHbasePlugin", e);
    } finally {
        deactivatePluginClassLoader();
    }

    if(LOG.isDebugEnabled()) {
        LOG.debug("<== HBaseAtlasCoprocessor.init()");
    }
}
 
Example #15
Source File: AccessController.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public Optional<RegionServerObserver> getRegionServerObserver() {
  return Optional.of(this);
}
 
Example #16
Source File: VisibilityReplication.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override public Optional<RegionServerObserver> getRegionServerObserver() {
  return Optional.of(this);
}
 
Example #17
Source File: TestSyncReplicationNewRSJoinBetweenRefreshes.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public Optional<RegionServerObserver> getRegionServerObserver() {
  return Optional.of(this);
}
 
Example #18
Source File: TestSyncReplicationNewRSJoinBetweenRefreshes.java    From hbase with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUp() throws Exception {
  UTIL1.getConfiguration().setClass(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY,
    HaltCP.class, RegionServerObserver.class);
  SyncReplicationTestBase.setUp();
}
 
Example #19
Source File: TestRegionServerAbort.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public Optional<RegionServerObserver> getRegionServerObserver() {
  return Optional.of(this);
}
 
Example #20
Source File: TestNamespaceAuditor.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public Optional<RegionServerObserver> getRegionServerObserver() {
  return Optional.of(this);
}