org.apache.hadoop.hbase.regionserver.RegionServerServices Java Examples

The following examples show how to use org.apache.hadoop.hbase.regionserver.RegionServerServices. 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: SpaceViolationPolicyEnforcementFactory.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the "default" {@link SpaceViolationPolicyEnforcement} for a table that isn't in
 * violation. This is used to have uniform policy checking for tables in and not quotas. This
 * policy will still verify that new bulk loads do not exceed the configured quota limit.
 *
 * @param rss RegionServerServices instance the policy enforcement should use.
 * @param tableName The target HBase table.
 * @param snapshot The current quota snapshot for the {@code tableName}, can be null.
 */
public SpaceViolationPolicyEnforcement createWithoutViolation(
    RegionServerServices rss, TableName tableName, SpaceQuotaSnapshot snapshot) {
  if (snapshot == null) {
    // If we have no snapshot, this is equivalent to no quota for this table.
    // We should do use the (singleton instance) of this policy to do nothing.
    return MissingSnapshotViolationPolicyEnforcement.getInstance();
  }
  // We have a snapshot which means that there is a quota set on this table, but it's not in
  // violation of that quota. We need to construct a policy for this table.
  SpaceQuotaStatus status = snapshot.getQuotaStatus();
  if (status.isInViolation()) {
    throw new IllegalArgumentException(
        tableName + " is in violation. Logic error. Snapshot=" + snapshot);
  }
  // We have a unique size snapshot to use. Create an instance for this tablename + snapshot.
  DefaultViolationPolicyEnforcement enforcement = new DefaultViolationPolicyEnforcement();
  enforcement.initialize(rss, tableName, snapshot);
  return enforcement;
}
 
Example #2
Source File: RegionServerSnapshotManager.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Create a default snapshot handler - uses a zookeeper based member controller.
 * @param rss region server running the handler
 * @throws KeeperException if the zookeeper cluster cannot be reached
 */
@Override
public void initialize(RegionServerServices rss) throws KeeperException {
  this.rss = rss;
  ZKWatcher zkw = rss.getZooKeeper();
  this.memberRpcs = new ZKProcedureMemberRpcs(zkw,
      SnapshotManager.ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION);

  // read in the snapshot request configuration properties
  Configuration conf = rss.getConfiguration();
  long keepAlive = conf.getLong(SNAPSHOT_TIMEOUT_MILLIS_KEY, SNAPSHOT_TIMEOUT_MILLIS_DEFAULT);
  int opThreads = conf.getInt(SNAPSHOT_REQUEST_THREADS_KEY, SNAPSHOT_REQUEST_THREADS_DEFAULT);

  // create the actual snapshot procedure member
  ThreadPoolExecutor pool = ProcedureMember.defaultPool(rss.getServerName().toString(),
    opThreads, keepAlive);
  this.member = new ProcedureMember(memberRpcs, pool, new SnapshotSubprocedureBuilder());
}
 
Example #3
Source File: LogRollRegionServerProcedureManager.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(RegionServerServices rss) throws KeeperException {
  this.rss = rss;
  if (!BackupManager.isBackupEnabled(rss.getConfiguration())) {
    LOG.warn("Backup is not enabled. Check your " + BackupRestoreConstants.BACKUP_ENABLE_KEY
        + " setting");
    return;
  }
  ProcedureCoordinationManager coordManager = new ZKProcedureCoordinationManager(rss);
  this.memberRpcs = coordManager
          .getProcedureMemberRpcs(LogRollMasterProcedureManager.ROLLLOG_PROCEDURE_SIGNATURE);

  // read in the backup handler configuration properties
  Configuration conf = rss.getConfiguration();
  long keepAlive = conf.getLong(BACKUP_TIMEOUT_MILLIS_KEY, BACKUP_TIMEOUT_MILLIS_DEFAULT);
  int opThreads = conf.getInt(BACKUP_REQUEST_THREADS_KEY, BACKUP_REQUEST_THREADS_DEFAULT);
  // create the actual cohort member
  ThreadPoolExecutor pool =
      ProcedureMember.defaultPool(rss.getServerName().toString(), opThreads, keepAlive);
  this.member = new ProcedureMember(memberRpcs, pool, new BackupSubprocedureBuilder());
}
 
Example #4
Source File: TestZooKeeperTableArchiveClient.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Setup the config for the cluster
 */
@BeforeClass
public static void setupCluster() throws Exception {
  setupConf(UTIL.getConfiguration());
  UTIL.startMiniZKCluster();
  UTIL.getConfiguration().setClass(MockRegistry.REGISTRY_IMPL_CONF_KEY, MockRegistry.class,
    DummyConnectionRegistry.class);
  CONNECTION = ConnectionFactory.createConnection(UTIL.getConfiguration());
  archivingClient = new ZKTableArchiveClient(UTIL.getConfiguration(), CONNECTION);
  // make hfile archiving node so we can archive files
  ZKWatcher watcher = UTIL.getZooKeeperWatcher();
  String archivingZNode = ZKTableArchiveClient.getArchiveZNode(UTIL.getConfiguration(), watcher);
  ZKUtil.createWithParents(watcher, archivingZNode);
  rss = mock(RegionServerServices.class);
  POOL = new DirScanPool(UTIL.getConfiguration());
}
 
Example #5
Source File: ReplicationObserver.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Override
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_NULL_ON_SOME_PATH",
    justification="NPE should never happen; if it does it is a bigger issue")
public void preCommitStoreFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
    final byte[] family, final List<Pair<Path, Path>> pairs) throws IOException {
  RegionCoprocessorEnvironment env = ctx.getEnvironment();
  Configuration c = env.getConfiguration();
  if (pairs == null || pairs.isEmpty() ||
      !c.getBoolean(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY,
        HConstants.REPLICATION_BULKLOAD_ENABLE_DEFAULT)) {
    LOG.debug("Skipping recording bulk load entries in preCommitStoreFile for bulkloaded "
        + "data replication.");
    return;
  }
  // This is completely cheating AND getting a HRegionServer from a RegionServerEnvironment is
  // just going to break. This is all private. Not allowed. Regions shouldn't assume they are
  // hosted in a RegionServer. TODO: fix.
  RegionServerServices rss = ((HasRegionServerServices)env).getRegionServerServices();
  Replication rep = (Replication)((HRegionServer)rss).getReplicationSourceService();
  rep.addHFileRefsToQueue(env.getRegionInfo().getTable(), family, pairs);
}
 
Example #6
Source File: TokenProvider.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) {
  // if running at region
  if (env instanceof RegionCoprocessorEnvironment) {
    RegionCoprocessorEnvironment regionEnv = (RegionCoprocessorEnvironment)env;
    /* Getting the RpcServer from a RegionCE is wrong. There cannot be an expectation that Region
     is hosted inside a RegionServer. If you need RpcServer, then pass in a RegionServerCE.
     TODO: FIX.
     */
    RegionServerServices rss = ((HasRegionServerServices)regionEnv).getRegionServerServices();
    RpcServerInterface server = rss.getRpcServer();
    SecretManager<?> mgr = ((RpcServer)server).getSecretManager();
    if (mgr instanceof AuthenticationTokenSecretManager) {
      secretManager = (AuthenticationTokenSecretManager)mgr;
    }
  }
}
 
Example #7
Source File: TestTokenAuthentication.java    From hbase with Apache License 2.0 6 votes vote down vote up
private void initialize() throws IOException {
  // ZK configuration must _not_ have hbase.security.authentication or it will require SASL auth
  Configuration zkConf = new Configuration(conf);
  zkConf.set(User.HBASE_SECURITY_CONF_KEY, "simple");
  this.zookeeper = new ZKWatcher(zkConf, TokenServer.class.getSimpleName(),
      this, true);
  this.rpcServer.start();

  // Mock up region coprocessor environment
  RegionCoprocessorEnvironment mockRegionCpEnv = mock(RegionCoprocessorEnvironment.class,
      Mockito.withSettings().extraInterfaces(HasRegionServerServices.class));
  when(mockRegionCpEnv.getConfiguration()).thenReturn(conf);
  when(mockRegionCpEnv.getClassLoader()).then(
      (var1) -> Thread.currentThread().getContextClassLoader());
  RegionServerServices mockRss = mock(RegionServerServices.class);
  when(mockRss.getRpcServer()).thenReturn(rpcServer);
  when(((HasRegionServerServices) mockRegionCpEnv).getRegionServerServices())
      .thenReturn(mockRss);

  super.start(mockRegionCpEnv);
  started = true;
}
 
Example #8
Source File: TestCompactedHFilesDischarger.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  TableName tableName = TableName.valueOf(getClass().getSimpleName());
  TableDescriptorBuilder.ModifyableTableDescriptor tableDescriptor =
    new TableDescriptorBuilder.ModifyableTableDescriptor(tableName);
  tableDescriptor.setColumnFamily(
    new ColumnFamilyDescriptorBuilder.ModifyableColumnFamilyDescriptor(fam));
  RegionInfo info = RegionInfoBuilder.newBuilder(tableName).build();
  Path path = testUtil.getDataTestDir(getClass().getSimpleName());
  region = HBaseTestingUtility.createRegionAndWAL(info, path,
    testUtil.getConfiguration(), tableDescriptor);
  rss = mock(RegionServerServices.class);
  List<HRegion> regions = new ArrayList<>(1);
  regions.add(region);
  Mockito.doReturn(regions).when(rss).getRegions();
}
 
Example #9
Source File: TestRegionObserverStacking.java    From hbase with Apache License 2.0 6 votes vote down vote up
HRegion initHRegion (byte [] tableName, String callingMethod,
    Configuration conf, byte [] ... families) throws IOException {

  TableDescriptorBuilder.ModifyableTableDescriptor tableDescriptor =
    new TableDescriptorBuilder.ModifyableTableDescriptor(TableName.valueOf(tableName));

  for (byte[] family : families) {
    tableDescriptor.setColumnFamily(
      new ColumnFamilyDescriptorBuilder.ModifyableColumnFamilyDescriptor(family));
  }
  ChunkCreator.initialize(MemStoreLABImpl.CHUNK_SIZE_DEFAULT, false, 0, 0, 0, null);
  RegionInfo info = RegionInfoBuilder.newBuilder(tableDescriptor.getTableName()).build();
  Path path = new Path(DIR + callingMethod);
  HRegion r = HBaseTestingUtility.createRegionAndWAL(info, path, conf, tableDescriptor);
  // this following piece is a hack. currently a coprocessorHost
  // is secretly loaded at OpenRegionHandler. we don't really
  // start a region server here, so just manually create cphost
  // and set it to region.
  RegionCoprocessorHost host = new RegionCoprocessorHost(r,
      Mockito.mock(RegionServerServices.class), conf);
  r.setCoprocessorHost(host);
  return r;
}
 
Example #10
Source File: TestRegionServerSpaceQuotaManager.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testExceptionOnPolicyEnforcementEnable() throws Exception {
  final TableName tableName = TableName.valueOf("foo");
  final SpaceQuotaSnapshot snapshot = new SpaceQuotaSnapshot(
      new SpaceQuotaStatus(SpaceViolationPolicy.DISABLE), 1024L, 2048L);
  RegionServerServices rss = mock(RegionServerServices.class);
  SpaceViolationPolicyEnforcementFactory factory = mock(
      SpaceViolationPolicyEnforcementFactory.class);
  SpaceViolationPolicyEnforcement enforcement = mock(SpaceViolationPolicyEnforcement.class);
  RegionServerSpaceQuotaManager realManager = new RegionServerSpaceQuotaManager(rss, factory);

  when(factory.create(rss, tableName, snapshot)).thenReturn(enforcement);
  doThrow(new IOException("Failed for test!")).when(enforcement).enable();

  realManager.enforceViolationPolicy(tableName, snapshot);
  Map<TableName, SpaceViolationPolicyEnforcement> enforcements =
      realManager.copyActiveEnforcements();
  assertTrue("Expected active enforcements to be empty, but were " + enforcements,
      enforcements.isEmpty());
}
 
Example #11
Source File: TestCoprocessorConfiguration.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Rough test that Coprocessor Environment is Read-Only.
 * Just check a random CP and see that it returns a read-only config.
 */
@Test
public void testReadOnlyConfiguration() throws Exception {
  Configuration conf = new Configuration(CONF);
  HRegion region = mock(HRegion.class);
  when(region.getRegionInfo()).thenReturn(REGIONINFO);
  when(region.getTableDescriptor()).thenReturn(TABLEDESC);
  RegionServerServices rsServices = mock(RegionServerServices.class);
  RegionCoprocessorHost rcp = new RegionCoprocessorHost(region, rsServices, conf);
  boolean found = false;
  for (String cpStr: rcp.getCoprocessors()) {
    CoprocessorEnvironment cpenv = rcp.findCoprocessorEnvironment(cpStr);
    if (cpenv != null) {
      found = true;
    }
    Configuration c = cpenv.getConfiguration();
    thrown.expect(UnsupportedOperationException.class);
    c.set("one.two.three", "four.five.six");
  }
  assertTrue("Should be at least one CP found", found);
}
 
Example #12
Source File: TestCoprocessorConfiguration.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testRegionCoprocessorHostTableLoadingDisabled() throws Exception {
  Configuration conf = new Configuration(CONF);
  conf.setBoolean(CoprocessorHost.COPROCESSORS_ENABLED_CONF_KEY, true); // if defaults change
  conf.setBoolean(CoprocessorHost.USER_COPROCESSORS_ENABLED_CONF_KEY, false);
  HRegion region = mock(HRegion.class);
  when(region.getRegionInfo()).thenReturn(REGIONINFO);
  when(region.getTableDescriptor()).thenReturn(TABLEDESC);
  RegionServerServices rsServices = mock(RegionServerServices.class);
  systemCoprocessorLoaded.set(false);
  tableCoprocessorLoaded.set(false);
  new RegionCoprocessorHost(region, rsServices, conf);
  assertTrue("System coprocessors should have been loaded",
    systemCoprocessorLoaded.get());
  assertFalse("Table coprocessors should not have been loaded",
    tableCoprocessorLoaded.get());
}
 
Example #13
Source File: TestSpaceQuotaViolationPolicyRefresherChore.java    From hbase with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Before
public void setup() throws IOException {
  conf = HBaseConfiguration.create();
  rss = mock(RegionServerServices.class);
  manager = mock(RegionServerSpaceQuotaManager.class);
  conn = mock(Connection.class);
  when(manager.getRegionServerServices()).thenReturn(rss);
  when(rss.getConfiguration()).thenReturn(conf);


  chore = mock(SpaceQuotaRefresherChore.class);
  when(chore.getConnection()).thenReturn(conn);
  when(chore.getManager()).thenReturn(manager);
  when(chore.checkQuotaTableExists()).thenReturn(true);
  doCallRealMethod().when(chore).chore();
  when(chore.isInViolation(any())).thenCallRealMethod();
  doCallRealMethod().when(chore).extractQuotaSnapshot(any(), any());
}
 
Example #14
Source File: TestCoprocessorConfiguration.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testRegionCoprocessorHostAllDisabled() throws Exception {
  Configuration conf = new Configuration(CONF);
  conf.setBoolean(CoprocessorHost.COPROCESSORS_ENABLED_CONF_KEY, false);
  HRegion region = mock(HRegion.class);
  when(region.getRegionInfo()).thenReturn(REGIONINFO);
  when(region.getTableDescriptor()).thenReturn(TABLEDESC);
  RegionServerServices rsServices = mock(RegionServerServices.class);
  systemCoprocessorLoaded.set(false);
  tableCoprocessorLoaded.set(false);
  new RegionCoprocessorHost(region, rsServices, conf);
  assertFalse("System coprocessors should not have been loaded",
    systemCoprocessorLoaded.get());
  assertFalse("Table coprocessors should not have been loaded",
    tableCoprocessorLoaded.get());
}
 
Example #15
Source File: TestRegionServerSpaceQuotaManager.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testExceptionOnPolicyEnforcementDisable() throws Exception {
  final TableName tableName = TableName.valueOf("foo");
  final SpaceQuotaSnapshot snapshot = new SpaceQuotaSnapshot(
      new SpaceQuotaStatus(SpaceViolationPolicy.DISABLE), 1024L, 2048L);
  RegionServerServices rss = mock(RegionServerServices.class);
  SpaceViolationPolicyEnforcementFactory factory = mock(
      SpaceViolationPolicyEnforcementFactory.class);
  SpaceViolationPolicyEnforcement enforcement = mock(SpaceViolationPolicyEnforcement.class);
  RegionServerSpaceQuotaManager realManager = new RegionServerSpaceQuotaManager(rss, factory);

  when(factory.create(rss, tableName, snapshot)).thenReturn(enforcement);
  doNothing().when(enforcement).enable();
  doThrow(new IOException("Failed for test!")).when(enforcement).disable();

  // Enabling should work
  realManager.enforceViolationPolicy(tableName, snapshot);
  Map<TableName, SpaceViolationPolicyEnforcement> enforcements =
      realManager.copyActiveEnforcements();
  assertEquals(1, enforcements.size());

  // If the disable fails, we should still treat it as "active"
  realManager.disableViolationPolicyEnforcement(tableName);
  enforcements = realManager.copyActiveEnforcements();
  assertEquals(1, enforcements.size());
}
 
Example #16
Source File: TestRegionObserverPreFlushAndPreCompact.java    From hbase with Apache License 2.0 5 votes vote down vote up
private RegionCoprocessorHost getRegionCoprocessorHost() {
  // Make up an HRegion instance. Use the hbase:meta first region as our RegionInfo. Use
  // hbase:meta table name for building the TableDescriptor our mock returns when asked schema
  // down inside RegionCoprocessorHost. Pass in mocked RegionServerServices too.
  RegionInfo ri = RegionInfoBuilder.FIRST_META_REGIONINFO;
  HRegion mockedHRegion = Mockito.mock(HRegion.class);
  Mockito.when(mockedHRegion.getRegionInfo()).thenReturn(ri);
  TableDescriptor td = TableDescriptorBuilder.newBuilder(ri.getTable()).build();
  Mockito.when(mockedHRegion.getTableDescriptor()).thenReturn(td);
  RegionServerServices mockedServices = Mockito.mock(RegionServerServices.class);
  Configuration conf = HBaseConfiguration.create();
  // Load our test coprocessor defined above.
  conf.set(REGION_COPROCESSOR_CONF_KEY, TestRegionObserver.class.getName());
  return new RegionCoprocessorHost(mockedHRegion, mockedServices, conf);
}
 
Example #17
Source File: TestActivePolicyEnforcement.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testNoBulkLoadChecksOnNoSnapshot() {
  ActivePolicyEnforcement ape = new ActivePolicyEnforcement(
      new HashMap<TableName, SpaceViolationPolicyEnforcement>(),
      Collections.<TableName,SpaceQuotaSnapshot> emptyMap(),
      mock(RegionServerServices.class));
  SpaceViolationPolicyEnforcement enforcement = ape.getPolicyEnforcement(
      TableName.valueOf("nonexistent"));
  assertFalse("Should not check bulkloads", enforcement.shouldCheckBulkLoads());
}
 
Example #18
Source File: TestReplicationSourceManager.java    From hbase with Apache License 2.0 5 votes vote down vote up
private static long getSizeOfLatestPath() {
  // If no mini cluster is running, there are extra replication manager influencing the metrics.
  if (utility.getMiniHBaseCluster() == null) {
    return 0;
  }
  return utility.getMiniHBaseCluster().getRegionServerThreads()
      .stream().map(JVMClusterUtil.RegionServerThread::getRegionServer)
      .map(RegionServerServices::getReplicationSourceService)
      .map(r -> (Replication)r)
      .map(Replication::getReplicationManager)
      .mapToLong(ReplicationSourceManager::getSizeOfLatestPath)
      .sum();
}
 
Example #19
Source File: FlushThroughputControllerFactory.java    From hbase with Apache License 2.0 5 votes vote down vote up
public static ThroughputController create(RegionServerServices server,
    Configuration conf) {
  Class<? extends ThroughputController> clazz = getThroughputControllerClass(conf);
  ThroughputController controller = ReflectionUtils.newInstance(clazz, conf);
  controller.setup(server);
  return controller;
}
 
Example #20
Source File: PressureAwareFlushThroughputController.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(final RegionServerServices server) {
  server.getChoreService().scheduleChore(
    new ScheduledChore("FlushThroughputTuner", this, tuningPeriod, this.tuningPeriod) {

      @Override
      protected void chore() {
        tune(server.getFlushPressure());
      }
    });
}
 
Example #21
Source File: PressureAwareCompactionThroughputController.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(final RegionServerServices server) {
  server.getChoreService().scheduleChore(
    new ScheduledChore("CompactionThroughputTuner", this, tuningPeriod) {

      @Override
      protected void chore() {
        tune(server.getCompactionPressure());
      }
    });
}
 
Example #22
Source File: TestBulkLoadCheckingViolationPolicyEnforcement.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  fs = mock(FileSystem.class);
  rss = mock(RegionServerServices.class);
  tableName = TableName.valueOf("foo");
  policy = new DefaultViolationPolicyEnforcement();
}
 
Example #23
Source File: CompactionThroughputControllerFactory.java    From hbase with Apache License 2.0 5 votes vote down vote up
public static ThroughputController create(RegionServerServices server,
    Configuration conf) {
  Class<? extends ThroughputController> clazz = getThroughputControllerClass(conf);
  ThroughputController controller = ReflectionUtils.newInstance(clazz, conf);
  controller.setup(server);
  return controller;
}
 
Example #24
Source File: TestActivePolicyEnforcement.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testNoPolicyReturnsNoopEnforcement() {
  ActivePolicyEnforcement ape = new ActivePolicyEnforcement(
      new HashMap<>(), Collections.emptyMap(), mock(RegionServerServices.class));
  SpaceViolationPolicyEnforcement enforcement = ape.getPolicyEnforcement(
      TableName.valueOf("nonexistent"));
  assertNotNull(enforcement);
  assertTrue(
      "Expected an instance of MissingSnapshotViolationPolicyEnforcement, but got "
          + enforcement.getClass(),
      enforcement instanceof MissingSnapshotViolationPolicyEnforcement);
}
 
Example #25
Source File: HBaseTestingUtility.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * Create a stubbed out RegionServerService, mainly for getting FS.
 * This version is used by TestTokenAuthentication
 */
public RegionServerServices createMockRegionServerService(RpcServerInterface rpc) throws
    IOException {
  final MockRegionServerServices rss = new MockRegionServerServices(getZooKeeperWatcher());
  rss.setFileSystem(getTestFileSystem());
  rss.setRpcServer(rpc);
  return rss;
}
 
Example #26
Source File: TestReplicationSourceManager.java    From hbase with Apache License 2.0 5 votes vote down vote up
private static ReplicationSourceManager getManagerFromCluster() {
  // TestReplicationSourceManagerZkImpl won't start the mini hbase cluster.
  if (utility.getMiniHBaseCluster() == null) {
    return null;
  }
  return utility.getMiniHBaseCluster().getRegionServerThreads()
      .stream().map(JVMClusterUtil.RegionServerThread::getRegionServer)
      .findAny()
      .map(RegionServerServices::getReplicationSourceService)
      .map(r -> (Replication)r)
      .map(Replication::getReplicationManager)
      .get();
}
 
Example #27
Source File: OpenRegionHandler.java    From hbase with Apache License 2.0 5 votes vote down vote up
PostOpenDeployTasksThread(final HRegion region, final Server server,
    final RegionServerServices services, final AtomicBoolean signaller, long masterSystemTime) {
  super("PostOpenDeployTasks:" + region.getRegionInfo().getEncodedName());
  this.setDaemon(true);
  this.server = server;
  this.services = services;
  this.region = region;
  this.signaller = signaller;
  this.masterSystemTime = masterSystemTime;
}
 
Example #28
Source File: SpliceRSRpcServices.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void start(CoprocessorEnvironment env) throws IOException {
    if (env instanceof RegionServerCoprocessorEnvironment) {
        this.regionServerServices = (RegionServerServices) ((RegionServerCoprocessorEnvironment) env).getOnlineRegions();
        SpliceLogUtils.info(LOG,"Started SpliceRSRpcServices");
    } else {
        throw new CoprocessorException("Must be loaded on a RegionServer!");
    }
}
 
Example #29
Source File: CloseRegionHandler.java    From hbase with Apache License 2.0 5 votes vote down vote up
protected CloseRegionHandler(final Server server,
    final RegionServerServices rsServices, RegionInfo regionInfo,
    boolean abort, EventType eventType, ServerName destination) {
  super(server, eventType);
  this.server = server;
  this.rsServices = rsServices;
  this.regionInfo = regionInfo;
  this.abort = abort;
  this.destination = destination;
}
 
Example #30
Source File: CloseRegionHandler.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * This method used internally by the RegionServer to close out regions.
 * @param abort If the regionserver is aborting.
 */
public CloseRegionHandler(final Server server,
    final RegionServerServices rsServices,
    final RegionInfo regionInfo, final boolean abort,
    ServerName destination) {
  this(server, rsServices, regionInfo, abort,
    EventType.M_RS_CLOSE_REGION, destination);
}