/** * @return List of Regions associated with this <code>server</code>. */ private List<RegionInfo> getRegions(final Address server) { LinkedList<RegionInfo> regions = new LinkedList<>(); for (Map.Entry<RegionInfo, ServerName> el : master.getAssignmentManager().getRegionStates().getRegionAssignments().entrySet()) { if (el.getValue() == null) { continue; } if (el.getValue().getAddress().equals(server)) { addRegion(regions, el.getKey()); } } for (RegionStateNode state : master.getAssignmentManager().getRegionsInTransition()) { if (state.getRegionLocation().getAddress().equals(server)) { addRegion(regions, state.getRegionInfo()); } } return regions; }
private void updateFailedAssignments() { // Kick all regions in FAILED_OPEN state List<RegionInfo> stuckAssignments = Lists.newArrayList(); for (RegionStateNode state: masterServices.getAssignmentManager().getRegionStates().getRegionsInTransition()) { if (state.isStuck()) { stuckAssignments.add(state.getRegionInfo()); } } for (RegionInfo region: stuckAssignments) { LOG.info("Retrying assignment of " + region); try { masterServices.getAssignmentManager().unassign(region); } catch (IOException e) { LOG.warn("Unable to reassign " + region, e); } } }
RegionStates.RegionStateNode rsn = new RegionStates.RegionStateNode(ri); rsn.setRegionLocation(ServerName.valueOf("server.example.org", 0, 0)); MasterProcedureEnv env = Mockito.mock(MasterProcedureEnv.class); AssignmentManager am = Mockito.mock(AssignmentManager.class);
RegionInfo regionInfo = regionState.getRegionInfo(); LOG.debug("Region in transition after stopping FN's: " + regionInfo); rit.add(regionInfo);
RegionInfo regionInfo = regionState.getRegionInfo(); List<ServerName> newFavoredNodes = helper.generateFavoredNodes(regionInfo); assertNotNull(newFavoredNodes);
long openSeqNum; synchronized (regionNode) { openSeqNum = regionNode.getOpenSeqNum(); regionNode.setState(State.OPENING); regionNode.setOpenSeqNum(-1L); regionNode.setState(State.OPEN); regionNode.setOpenSeqNum(openSeqNum); assertTrue(regionNode.getOpenSeqNum() > openSeqNum);
/** * @return List of Regions associated with this <code>server</code>. */ private List<RegionInfo> getRegions(final Address server) { LinkedList<RegionInfo> regions = new LinkedList<>(); for (Map.Entry<RegionInfo, ServerName> el : master.getAssignmentManager().getRegionStates().getRegionAssignments().entrySet()) { if (el.getValue() == null) { continue; } if (el.getValue().getAddress().equals(server)) { addRegion(regions, el.getKey()); } } for (RegionStateNode state : master.getAssignmentManager().getRegionsInTransition()) { if (state.getRegionLocation().getAddress().equals(server)) { addRegion(regions, state.getRegionInfo()); } } return regions; }
public static boolean waitForAssignment(AssignmentManager am, RegionInfo regionInfo) throws IOException { // This method can be called before the regionInfo has made it into the regionStateMap // so wait around here a while. Waiter.waitFor(am.getConfiguration(), 10000, () -> am.getRegionStates().getRegionStateNode(regionInfo) != null); RegionStateNode regionNode = am.getRegionStates().getRegionStateNode(regionInfo); // Wait until the region has already been open, or we have a TRSP along with it. Waiter.waitFor(am.getConfiguration(), 30000, () -> regionNode.isInState(State.OPEN) || regionNode.isInTransition()); RegionTransitionProcedure proc = regionNode.getProcedure(); synchronized (regionNode) { if (regionNode.isInState(State.OPEN)) { return true; } proc = regionNode.getProcedure(); } assertNotNull(proc); ProcedureSyncWait.waitForProcedureToCompleteIOE(am.getMaster().getMasterProcedureExecutor(), proc, 5L * 60 * 1000); return true; } }
private void updateFailedAssignments() { // Kick all regions in FAILED_OPEN state List<RegionInfo> stuckAssignments = Lists.newArrayList(); for (RegionStateNode state: masterServices.getAssignmentManager().getRegionStates().getRegionsInTransition()) { if (state.isStuck()) { stuckAssignments.add(state.getRegionInfo()); } } for (RegionInfo region: stuckAssignments) { LOG.info("Retrying assignment of " + region); try { masterServices.getAssignmentManager().unassign(region); } catch (IOException e) { LOG.warn("Unable to reassign " + region, e); } } }