Examples of CatalogTracker


Examples of org.apache.hadoop.hbase.catalog.CatalogTracker

    // First amend the servermanager mock so that when we do send close of the
    // first meta region on SERVERNAME_A, it will return true rather than
    // default null.
    Mockito.when(this.serverManager.sendRegionClose(SERVERNAME_A, hri, -1)).thenReturn(true);
    // Need a mocked catalog tracker.
    CatalogTracker ct = Mockito.mock(CatalogTracker.class);
    LoadBalancer balancer = LoadBalancerFactory.getLoadBalancer(server
        .getConfiguration());
    // Create an AM.
    AssignmentManager am = new AssignmentManager(this.server,
      this.serverManager, ct, balancer, null, null, master.getTableLockManager());
View Full Code Here

Examples of org.apache.hadoop.hbase.catalog.CatalogTracker

    version = ZKAssign.getVersion(this.watcher, REGIONINFO);
    Mockito.when(this.serverManager.isServerOnline(SERVERNAME_A)).thenReturn(false);
    am.getRegionStates().logSplit(SERVERNAME_A); // Assume log splitting is done
    am.getRegionStates().createRegionState(REGIONINFO);
    am.gate.set(false);
    CatalogTracker ct = Mockito.mock(CatalogTracker.class);
    assertFalse(am.processRegionsInTransition(rt, REGIONINFO, version));
    am.getZKTable().setEnabledTable(REGIONINFO.getTable());
    processServerShutdownHandler(ct, am, false);
    // Waiting for the assignment to get completed.
    while (!am.gate.get()) {
View Full Code Here

Examples of org.apache.hadoop.hbase.catalog.CatalogTracker

   */
  @Test
  public void testSSHTimesOutOpeningRegionTransition()
      throws KeeperException, IOException, ServiceException {
    // We need a mocked catalog tracker.
    CatalogTracker ct = Mockito.mock(CatalogTracker.class);
    // Create an AM.
    AssignmentManagerWithExtrasForTesting am =
      setUpMockedAssignmentManager(this.server, this.serverManager);
    // adding region in pending open.
    RegionState state = new RegionState(REGIONINFO,
View Full Code Here

Examples of org.apache.hadoop.hbase.catalog.CatalogTracker

   * @throws KeeperException
   */
  private AssignmentManagerWithExtrasForTesting setUpMockedAssignmentManager(final Server server,
      final ServerManager manager) throws IOException, KeeperException, ServiceException {
    // We need a mocked catalog tracker. Its used by our AM instance.
    CatalogTracker ct = Mockito.mock(CatalogTracker.class);
    // Make an RS Interface implementation. Make it so a scanner can go against
    // it and a get to return the single region, REGIONINFO, this test is
    // messing with. Needed when "new master" joins cluster. AM will try and
    // rebuild its list of user regions and it will also get the HRI that goes
    // with an encoded name by doing a Get on hbase:meta
    ClientProtos.ClientService.BlockingInterface ri =
      Mockito.mock(ClientProtos.ClientService.BlockingInterface.class);
    // Get a meta row result that has region up on SERVERNAME_A for REGIONINFO
    Result r = MetaMockingUtil.getMetaTableRowResult(REGIONINFO, SERVERNAME_A);
    final ScanResponse.Builder builder = ScanResponse.newBuilder();
    builder.setMoreResults(true);
    builder.addCellsPerResult(r.size());
    final List<CellScannable> rows = new ArrayList<CellScannable>(1);
    rows.add(r);
    Answer<ScanResponse> ans = new Answer<ClientProtos.ScanResponse>() {
      public ScanResponse answer(InvocationOnMock invocation) throws Throwable {
        PayloadCarryingRpcController controller = (PayloadCarryingRpcController) invocation
            .getArguments()[0];
        if (controller != null) {
          controller.setCellScanner(CellUtil.createCellScanner(rows));
        }
        return builder.build();
      }
    };
    if (enabling) {
      Mockito.when(ri.scan((RpcController) Mockito.any(), (ScanRequest) Mockito.any()))
          .thenAnswer(ans).thenAnswer(ans).thenAnswer(ans).thenAnswer(ans).thenAnswer(ans)
          .thenReturn(ScanResponse.newBuilder().setMoreResults(false).build());
    } else {
      Mockito.when(ri.scan((RpcController) Mockito.any(), (ScanRequest) Mockito.any())).thenAnswer(
          ans);
    }
    // If a get, return the above result too for REGIONINFO
    GetResponse.Builder getBuilder = GetResponse.newBuilder();
    getBuilder.setResult(ProtobufUtil.toResult(r));
    Mockito.when(ri.get((RpcController)Mockito.any(), (GetRequest) Mockito.any())).
      thenReturn(getBuilder.build());
    // Get a connection w/ mocked up common methods.
    HConnection connection = HConnectionTestingUtility.
      getMockedConnectionAndDecorate(HTU.getConfiguration(), null,
        ri, SERVERNAME_B, REGIONINFO);
    // Make it so we can get the connection from our mocked catalogtracker
    Mockito.when(ct.getConnection()).thenReturn(connection);
    // Create and startup an executor. Used by AM handling zk callbacks.
    ExecutorService executor = startupMasterExecutor("mockedAMExecutor");
    this.balancer = LoadBalancerFactory.getLoadBalancer(server.getConfiguration());
    AssignmentManagerWithExtrasForTesting am = new AssignmentManagerWithExtrasForTesting(
      server, manager, ct, this.balancer, executor, new NullTableLockManager());
View Full Code Here

Examples of org.apache.hadoop.hbase.catalog.CatalogTracker

  @Test
  public void testForceAssignMergingRegion() throws Exception {
    // Region to use in test.
    final HRegionInfo hri = HRegionInfo.FIRST_META_REGIONINFO;
    // Need a mocked catalog tracker.
    CatalogTracker ct = Mockito.mock(CatalogTracker.class);
    LoadBalancer balancer = LoadBalancerFactory.getLoadBalancer(
      server.getConfiguration());
    // Create an AM.
    AssignmentManager am = new AssignmentManager(this.server,
      this.serverManager, ct, balancer, null, null, master.getTableLockManager());
View Full Code Here

Examples of org.apache.hadoop.hbase.catalog.CatalogTracker

  @Test
  public void testAssignmentEventIgnoredIfNotExpected() throws KeeperException, IOException {
    // Region to use in test.
    final HRegionInfo hri = HRegionInfo.FIRST_META_REGIONINFO;
    // Need a mocked catalog tracker.
    CatalogTracker ct = Mockito.mock(CatalogTracker.class);
    LoadBalancer balancer = LoadBalancerFactory.getLoadBalancer(
      server.getConfiguration());
    final AtomicBoolean zkEventProcessed = new AtomicBoolean(false);
    // Create an AM.
    AssignmentManager am = new AssignmentManager(this.server,
View Full Code Here

Examples of org.apache.hadoop.hbase.catalog.CatalogTracker

   * Otherwise, the region will be brought back.
   * @throws Exception
   */
  @Test
  public void testBalanceRegionOfDeletedTable() throws Exception {
    CatalogTracker ct = Mockito.mock(CatalogTracker.class);
    AssignmentManager am = new AssignmentManager(this.server, this.serverManager,
      ct, balancer, null, null, master.getTableLockManager());
    RegionStates regionStates = am.getRegionStates();
    HRegionInfo hri = REGIONINFO;
    regionStates.createRegionState(hri);
View Full Code Here

Examples of org.apache.hadoop.hbase.catalog.CatalogTracker

    final String name = "testGetRegion";
    LOG.info("Started " + name);
    final byte [] nameBytes = Bytes.toBytes(name);
    HTable t = TEST_UTIL.createTable(nameBytes, HConstants.CATALOG_FAMILY);
    TEST_UTIL.createMultiRegions(t, HConstants.CATALOG_FAMILY);
    CatalogTracker ct = new CatalogTracker(TEST_UTIL.getConfiguration());
    ct.start();
    try {
      HRegionLocation regionLocation = t.getRegionLocation("mmm");
      HRegionInfo region = regionLocation.getRegionInfo();
      byte[] regionName = region.getRegionName();
      Pair<HRegionInfo, ServerName> pair = admin.getRegion(regionName, ct);
      assertTrue(Bytes.equals(regionName, pair.getFirst().getRegionName()));
      pair = admin.getRegion(region.getEncodedNameAsBytes(), ct);
      assertTrue(Bytes.equals(regionName, pair.getFirst().getRegionName()));
    } finally {
      ct.stop();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.catalog.CatalogTracker

    this.clusterStatusTracker = new ClusterStatusTracker(this.zooKeeper, this);
    this.clusterStatusTracker.start();
    blockAndCheckIfStopped(this.clusterStatusTracker);

    // Create the catalog tracker and start it;
    this.catalogTracker = new CatalogTracker(this.zooKeeper, this.conf,
      this, this.conf.getInt("hbase.regionserver.catalog.timeout", Integer.MAX_VALUE));
    catalogTracker.start();
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.catalog.CatalogTracker

   * @throws IOException
   * @throws InterruptedException
   */
  private void initializeZKBasedSystemTrackers() throws IOException,
      InterruptedException, KeeperException {
    this.catalogTracker = new CatalogTracker(this.zooKeeper, this.conf,
        this, conf.getInt("hbase.master.catalog.timeout", Integer.MAX_VALUE));
    this.catalogTracker.start();

    this.balancer = LoadBalancerFactory.getLoadBalancer(conf);
    this.assignmentManager = new AssignmentManager(this, serverManager,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.