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

The following examples show how to use org.apache.hadoop.hbase.coprocessor.RegionServerObserver. These examples are extracted from open source projects. 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 Project: hbase   Source File: RegionServerCoprocessorHost.java    License: 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 2
Source Project: hbase   Source File: TestNamespaceAuditor.java    License: 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 3
Source Project: atlas   Source File: HBaseAtlasCoprocessor.java    License: 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 4
Source Project: phoenix   Source File: BaseTest.java    License: 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 5
Source Project: hbase   Source File: CurrentCoprocessorMethods.java    License: 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 6
Source Project: hbase   Source File: RegionServerCoprocessorHost.java    License: 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 7
Source Project: hbase   Source File: RegionServerCoprocessorHost.java    License: 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 8
Source Project: hbase   Source File: RegionServerCoprocessorHost.java    License: 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 9
Source Project: hbase   Source File: RegionServerCoprocessorHost.java    License: 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 Project: hbase   Source File: RegionServerCoprocessorHost.java    License: 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 11
Source Project: hbase   Source File: RegionServerCoprocessorHost.java    License: 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 12
Source Project: hbase   Source File: RegionServerCoprocessorHost.java    License: 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 13
Source Project: hbase   Source File: RegionServerCoprocessorHost.java    License: 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 14
Source Project: hbase   Source File: RegionServerCoprocessorHost.java    License: 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 15
Source Project: hbase   Source File: VisibilityReplication.java    License: Apache License 2.0 4 votes vote down vote up
@Override public Optional<RegionServerObserver> getRegionServerObserver() {
  return Optional.of(this);
}
 
Example 16
Source Project: hbase   Source File: AccessController.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Optional<RegionServerObserver> getRegionServerObserver() {
  return Optional.of(this);
}
 
Example 17
@Override
public Optional<RegionServerObserver> getRegionServerObserver() {
  return Optional.of(this);
}
 
Example 18
@BeforeClass
public static void setUp() throws Exception {
  UTIL1.getConfiguration().setClass(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY,
    HaltCP.class, RegionServerObserver.class);
  SyncReplicationTestBase.setUp();
}
 
Example 19
Source Project: hbase   Source File: TestRegionServerAbort.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Optional<RegionServerObserver> getRegionServerObserver() {
  return Optional.of(this);
}
 
Example 20
Source Project: hbase   Source File: TestNamespaceAuditor.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Optional<RegionServerObserver> getRegionServerObserver() {
  return Optional.of(this);
}