Examples of RegionState


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

        metaHRIs.remove(rs.getRegion());
      }
    }

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

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

    // RIT to be as we need it to be instead. This cannot happen in a real cluster as we
    // update the RIT before sending the openRegion request.

    boolean wait = true;
    while (wait) {
      RegionState state = am.getRegionsInTransition().get(encodedName);
      if (state != null && state.isPendingOpen()){
        wait = false;
      } else {
        Thread.sleep(1);
      }
    }
View Full Code Here

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

  static void waitForRegionOfflineInRIT(AssignmentManager am, String encodedName)
      throws InterruptedException {
    boolean wait = true;
    while (wait) {
      RegionState state = am.getRegionsInTransition().get(encodedName);
      if (state != null && state.isOffline()) {
        wait = false;
      } else {
        Thread.sleep(1);
      }
    }
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

    AssignmentManager am = new AssignmentManager(this.server, this.serverManager, ct, balancer,
        executor);
    // 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

    // 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

    // Fake AssignmentManager and RIT
    AssignmentManager am = Mockito.mock(AssignmentManager.class);
    NavigableMap<String, RegionState> regionsInTransition =
      Maps.newTreeMap();
    regionsInTransition.put("r1",
        new RegionState(FAKE_HRI, RegionState.State.CLOSING, 12345L, FAKE_HOST));
    Mockito.doReturn(regionsInTransition).when(am).getRegionsInTransition();
    Mockito.doReturn(am).when(master).getAssignmentManager();
   
    // Fake ZKW
    ZooKeeperWatcher zkw = Mockito.mock(ZooKeeperWatcher.class);
View Full Code Here

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

      Maps.newTreeMap();
    for (byte i = 0; i < 100; i++) {
      HRegionInfo hri = new HRegionInfo(FAKE_TABLE.getName(),
          new byte[]{i}, new byte[]{(byte) (i+1)});
      regionsInTransition.put(hri.getEncodedName(),
          new RegionState(hri, RegionState.State.CLOSING, 12345L, FAKE_HOST));
    }
    // Add META in transition as well
    regionsInTransition.put(
        HRegionInfo.FIRST_META_REGIONINFO.getEncodedName(),
        new RegionState(HRegionInfo.FIRST_META_REGIONINFO,
                        RegionState.State.CLOSING, 12345L, FAKE_HOST));
    Mockito.doReturn(regionsInTransition).when(am).getRegionsInTransition();

    // Render to a string
    StringWriter sw = new StringWriter();
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.