Examples of RegionState


Examples of org.apache.hadoop.hbase.master.AssignmentManager.RegionState

          Bytes.toBytes(testIndex), Bytes.toBytes(testIndex + 1));
      region = HRegion.createHRegion(hri, TEST_UTIL.getDataTestDir(), TEST_UTIL.getConfiguration(), htd);
      assertNotNull(region);
      AssignmentManager am = Mockito.mock(AssignmentManager.class);
      when(am.isRegionInTransition(hri)).thenReturn(
          new RegionState(region.getRegionInfo(), RegionState.State.OPEN,
              System.currentTimeMillis(), server.getServerName()));
      // create a node with OPENED state
      zkw = HBaseTestingUtility.createAndForceNodeToOpenedState(TEST_UTIL,
          region, server.getServerName());
      when(am.getZKTable()).thenReturn(new ZKTable(zkw));
View Full Code Here

Examples of org.apache.hadoop.hbase.master.AssignmentManager.RegionState

    // Create an AM.
    AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(this.server, this.serverManager);
    // adding region to regions and servers maps.
    am.regionOnline(REGIONINFO, SERVERNAME_A);
    // adding region in pending close.
    am.regionsInTransition.put(REGIONINFO.getEncodedName(), new RegionState(REGIONINFO,
        State.SPLITTING, System.currentTimeMillis(), SERVERNAME_A));
    am.getZKTable().setEnabledTable(REGIONINFO.getTableNameAsString());

    RegionTransitionData data = new RegionTransitionData(EventType.RS_ZK_REGION_SPLITTING,
        REGIONINFO.getRegionName(), SERVERNAME_A);
View Full Code Here

Examples of org.apache.hadoop.hbase.master.AssignmentManager.RegionState

    LoadBalancer balancer = LoadBalancerFactory.getLoadBalancer(server.getConfiguration());
    // Create an AM.
    AssignmentManager am = new AssignmentManager(this.server, this.serverManager, ct, balancer,
        executor);
    if (opening) {
      am.regionsInTransition.put(REGIONINFO.getEncodedName(), new RegionState(REGIONINFO,
          State.OPENING, System.currentTimeMillis(), SERVERNAME_A));
    } else {
      // adding region to regions and servers maps.
      am.regionOnline(REGIONINFO, SERVERNAME_A);
      // adding region in pending close.
      am.regionsInTransition.put(REGIONINFO.getEncodedName(), new RegionState(REGIONINFO,
          State.PENDING_CLOSE, System.currentTimeMillis(), SERVERNAME_A));
    }
    if (state == TableState.DISABLING) {
      am.getZKTable().setDisablingTable(REGIONINFO.getTableNameAsString());
    } else {
View Full Code Here

Examples of org.apache.hadoop.hbase.master.AssignmentManager.RegionState

      ZKAssign.createNodeOffline(this.watcher, REGIONINFO, SERVERNAME_A);
      int v = ZKAssign.getVersion(this.watcher, REGIONINFO);
      ZKAssign.transitionNode(this.watcher, REGIONINFO, SERVERNAME_A, EventType.M_ZK_REGION_OFFLINE,
          EventType.RS_ZK_REGION_FAILED_OPEN, v);
      String path = ZKAssign.getNodeName(this.watcher, REGIONINFO.getEncodedName());
      RegionState state = new RegionState(REGIONINFO, State.OPENING, System.currentTimeMillis(),
          SERVERNAME_A);
      am.regionsInTransition.put(REGIONINFO.getEncodedName(), state);
      // a dummy plan inserted into the regionPlans. This plan is cleared and new one is formed
      am.regionPlans.put(REGIONINFO.getEncodedName(), new RegionPlan(REGIONINFO, null, SERVERNAME_A));
      RegionPlan regionPlan = am.regionPlans.get(REGIONINFO.getEncodedName());
View Full Code Here

Examples of org.apache.hadoop.hbase.master.AssignmentManager.RegionState

    AssignmentManagerWithExtrasForTesting am =
        setUpMockedAssignmentManager(this.server, this.serverManager);
    // adding region in pending open.
    if (regionInOffline) {
      ServerName MASTER_SERVERNAME = new ServerName("example.org", 1111, 1111);
      am.regionsInTransition.put(REGIONINFO.getEncodedName(), new RegionState(REGIONINFO,
          State.OFFLINE, System.currentTimeMillis(), MASTER_SERVERNAME));
    } else {
      am.regionsInTransition.put(REGIONINFO.getEncodedName(), new RegionState(REGIONINFO,
          State.OPENING, System.currentTimeMillis(), SERVERNAME_B));
    }
    // adding region plan
    am.regionPlans.put(REGIONINFO.getEncodedName(), new RegionPlan(REGIONINFO, SERVERNAME_A, SERVERNAME_B));
    am.getZKTable().setEnabledTable(REGIONINFO.getTableNameAsString());
View Full Code Here

Examples of org.apache.hadoop.hbase.master.AssignmentManager.RegionState

          && i < 100; i++) {
        Thread.sleep(200);
      }
      assertTrue("region is not in transition "+region,
          am.getRegionsInTransition().containsKey(region.getRegionInfo().getEncodedName()));
      RegionState regionState = am.getRegionsInTransition().get(region.getRegionInfo()
          .getEncodedName());
      assertTrue(regionState.getState() == RegionState.State.SPLITTING);
      assertTrue(st.rollback(regionServer, regionServer));
      assertTrue(ZKUtil.checkExists(regionServer.getZooKeeper(), node) == -1);
      for (int i=0; am.getRegionsInTransition().containsKey(region.getRegionInfo().getEncodedName()) && i<100; i++) {
        // Just in case the nodeDeleted event did not get executed.
        Thread.sleep(200);
View Full Code Here

Examples of org.apache.hadoop.hbase.master.AssignmentManager.RegionState

    // PENDING_OPEN and enabled
    region = enabledRegions.remove(0);
    regionsThatShouldBeOnline.add(region);
    master.assignmentManager.regionsInTransition.put(region.getEncodedName(),
        new RegionState(region, RegionState.State.PENDING_OPEN, 0, null));
    ZKAssign.createNodeOffline(zkw, region, master.getServerName());
    // PENDING_OPEN and disabled
    region = disabledRegions.remove(0);
    regionsThatShouldBeOffline.add(region);
    master.assignmentManager.regionsInTransition.put(region.getEncodedName(),
        new RegionState(region, RegionState.State.PENDING_OPEN, 0, null));
    ZKAssign.createNodeOffline(zkw, region, master.getServerName());
    // This test is bad.  It puts up a PENDING_CLOSE but doesn't say what
    // server we were PENDING_CLOSE against -- i.e. an entry in
    // AssignmentManager#regions.  W/o a server, we NPE trying to resend close.
    // In past, there was wonky logic that had us reassign region if no server
View Full Code Here

Examples of org.apache.hadoop.hbase.master.AssignmentManager.RegionState

    zktable.setDisablingTable("disabledTable");

    // RS was opening a region of disabled table then died
    HRegionInfo region = assignedRegionsOnLiveRS.remove(0);
    master.assignmentManager.regionOffline(region);
    master.assignmentManager.regionsInTransition.put(region.getEncodedName(), new RegionState(
        region, RegionState.State.OPENING, System.currentTimeMillis(), deadServerName));
    ZKAssign.createNodeOffline(zkw, region, deadServerName);
    ZKAssign.transitionNodeOpening(zkw, region, deadServerName);

    // Kill the RS that had a hard death
View Full Code Here

Examples of org.apache.hadoop.hbase.master.AssignmentManager.RegionState

      List<HRegionInfo> regionsToAssign = getRegionsToAssign(hris, ritsOnServer, ritsGoingToServer);
      for (HRegionInfo hri : ritsGoingToServer) {
        if (!this.services.getAssignmentManager().isRegionAssigned(hri)) {
          if (!regionsToAssign.contains(hri)) {
            regionsToAssign.add(hri);
            RegionState rit =
                services.getAssignmentManager().getRegionsInTransition().get(hri.getEncodedName());
            removeRITsOfRregionInDisablingOrDisabledTables(regionsToAssign, rit,
              services.getAssignmentManager(), hri);
          }
        }
View Full Code Here

Examples of org.apache.hadoop.hbase.master.AssignmentManager.RegionState

      }
    }

    AssignmentManager assignmentManager = this.services.getAssignmentManager();
    for (Map.Entry<HRegionInfo, Result> e : metaHRIs.entrySet()) {
      RegionState rit =
          assignmentManager.getRegionsInTransition().get(e.getKey().getEncodedName());

      if (processDeadRegion(e.getKey(), e.getValue(), assignmentManager,
        this.server.getCatalogTracker())) {
        ServerName addressFromAM = assignmentManager.getRegionServerOfRegion(e.getKey());
        if (rit != null && !rit.isClosing() && !rit.isPendingClose() && !rit.isSplitting()
            && !ritsGoingToServer.contains(e.getKey())) {
          // Skip regions that were in transition unless CLOSING or
          // PENDING_CLOSE
          LOG.info("Skip assigning region " + rit.toString());
        } else if (addressFromAM != null && !addressFromAM.equals(this.serverName)) {
          LOG.debug("Skip assigning region " + e.getKey().getRegionNameAsString()
              + " because it has been opened in " + addressFromAM.getServerName());
          ritsGoingToServer.remove(e.getKey());
        } else {
          if (rit != null) {
            // clean zk node
            try {
              LOG.info("Reassigning region with rs =" + rit + " and deleting zk node if exists");
              ZKAssign.deleteNodeFailSilent(services.getZooKeeper(), e.getKey());
            } catch (KeeperException ke) {
              this.server.abort("Unexpected ZK exception deleting unassigned node " + e.getKey(),
                ke);
              return null;
            }
          }
          toAssign.add(e.getKey());
        }
      } else if (rit != null && (rit.isSplitting() || rit.isSplit())) {
        // This will happen when the RS went down and the call back for the SPLIITING or SPLIT
        // has not yet happened for node Deleted event. In that case if the region was actually
        // split but the RS had gone down before completing the split process then will not try
        // to assign the parent region again. In that case we should make the region offline
        // and also delete the region from RIT.
        HRegionInfo region = rit.getRegion();
        AssignmentManager am = assignmentManager;
        am.regionOffline(region);
        ritsGoingToServer.remove(region);
      }
      // If the table was partially disabled and the RS went down, we should clear the RIT
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.