@Override public Object call() throws Exception { assignmentManager.unassign(hri, true); return null; } }
@Override public Object call() throws Exception { assignmentManager.unassign(hri, true); return null; } }
@Override public void run() { assignmentManager.unassign(region); } }));
public void run() { assignmentManager.unassign(hri); } });
public void run() { assignmentManager.unassign(hri, true); } }));
public void run() { assignmentManager.unassign(hris); } });
public void unassign(HRegionInfo region, boolean force){ unassign(region, force, null); }
/** * Unassigns the specified region. * <p> * Updates the RegionState and sends the CLOSE RPC unless region is being * split by regionserver; then the unassign fails (silently) because we * presume the region being unassigned no longer exists (its been split out * of existence). TODO: What to do if split fails and is rolled back and * parent is revivified? * <p> * If a RegionPlan is already set, it will remain. * * @param region server to be unassigned */ public void unassign(HRegionInfo region) { unassign(region, false); }
/** * Unassigns the specified region. * <p> * Updates the RegionState and sends the CLOSE RPC unless region is being * split by regionserver; then the unassign fails (silently) because we * presume the region being unassigned no longer exists (its been split out * of existence). TODO: What to do if split fails and is rolled back and * parent is revivified? * <p> * If a RegionPlan is already set, it will remain. * * @param region server to be unassigned */ public void unassign(HRegionInfo region) { unassign(region, false); }
@Override public void process() { if (!coordination.commitOpenOnMasterSide(assignmentManager,regionInfo, ord)) { assignmentManager.unassign(regionInfo); } } }
/** * Run through remaining regionservers and unassign all catalog regions. */ void unassignCatalogRegions() { synchronized (this.regions) { for (Map.Entry<ServerName, Set<HRegionInfo>> e: this.servers.entrySet()) { Set<HRegionInfo> regions = e.getValue(); if (regions == null || regions.isEmpty()) continue; for (HRegionInfo hri: regions) { if (hri.isMetaRegion()) { unassign(hri); } } } } }
/** * @param plan Plan to execute. */ void balance(final RegionPlan plan) { synchronized (this.regionPlans) { this.regionPlans.put(plan.getRegionName(), plan); } unassign(plan.getRegionInfo()); }
/** * Unassign the list of regions. Configuration knobs: * hbase.bulk.waitbetween.reopen indicates the number of milliseconds to * wait before unassigning another region from this region server * * @param regions * @throws InterruptedException */ public void unassign(List<HRegionInfo> regions) { int waitTime = this.master.getConfiguration().getInt( "hbase.bulk.waitbetween.reopen", 0); for (HRegionInfo region : regions) { if (isRegionInTransition(region) != null) continue; unassign(region, false); while (isRegionInTransition(region) != null) { try { Thread.sleep(10); } catch (InterruptedException e) { // Do nothing, continue } } if (waitTime > 0) try { Thread.sleep(waitTime); } catch (InterruptedException e) { // Do nothing, continue } } }
/** * Update inmemory structures. * @param sn Server that reported the split * @param parent Parent region that was split * @param a Daughter region A * @param b Daughter region B */ public void handleSplitReport(final ServerName sn, final HRegionInfo parent, final HRegionInfo a, final HRegionInfo b) { regionOffline(parent); regionOnline(a, sn); regionOnline(b, sn); // There's a possibility that the region was splitting while a user asked // the master to disable, we need to make sure we close those regions in // that case. This is not racing with the region server itself since RS // report is done after the split transaction completed. if (this.zkTable.isDisablingOrDisabledTable( parent.getTableNameAsString())) { unassign(a); unassign(b); } }
private void makeRegionOnline(RegionState rs, HRegionInfo regionInfo) { regionOnline(regionInfo, rs.serverName); LOG.info("The master has opened the region " + regionInfo.getRegionNameAsString() + " that was online on " + rs.serverName); if (this.getZKTable().isDisablingOrDisabledTable( regionInfo.getTableNameAsString())) { LOG.debug("Opened region " + regionInfo.getRegionNameAsString() + " but " + "this table is disabled, triggering close of region"); unassign(regionInfo); } }
private void onlineMergingRegion(boolean disabled, final HRegionInfo hri, final ServerName serverName) { RegionState regionState = regionStates.getRegionState(hri); if (regionState != null && regionState.isMerging() && regionState.isOnServer(serverName)) { regionOnline(regionState.getRegion(), serverName); if (disabled) { unassign(hri); } } } });
continue; assignmentManager.unassign(region, false); while (regionStates.isRegionInTransition(region) && !server.isStopped()) {
@Override public void unassign(final byte [] regionName, final boolean force) throws IOException { checkInitialized(); Pair<HRegionInfo, ServerName> pair = MetaReader.getRegion(this.catalogTracker, regionName); if (pair == null) throw new UnknownRegionException(Bytes.toString(regionName)); HRegionInfo hri = pair.getFirst(); if (cpHost != null) { if (cpHost.preUnassign(hri, force)) { return; } } if (force) { this.assignmentManager.regionOffline(hri); assignRegion(hri); } else { this.assignmentManager.unassign(hri, force); } if (cpHost != null) { cpHost.postUnassign(hri, force); } }
@Override public void process() { // Code to defend against case where we get SPLIT before region open // processing completes; temporary till we make SPLITs go via zk -- 0.92. RegionState regionState = this.assignmentManager.isRegionInTransition(regionInfo); boolean openedNodeDeleted = false; if (regionState != null && regionState.getState().equals(RegionState.State.OPEN)) { openedNodeDeleted = deleteOpenedNode(expectedVersion); if (!openedNodeDeleted) { LOG.error("The znode of region " + regionInfo.getRegionNameAsString() + " could not be deleted."); } } else { LOG.warn("Skipping the onlining of " + regionInfo.getRegionNameAsString() + " because regions is NOT in RIT -- presuming this is because it SPLIT"); } if (!openedNodeDeleted) { if (this.assignmentManager.getZKTable().isDisablingOrDisabledTable( regionInfo.getTableNameAsString())) { debugLog(regionInfo, "Opened region " + regionInfo.getRegionNameAsString() + " but " + "this table is disabled, triggering close of region"); assignmentManager.unassign(regionInfo); } } }
/** * @param plan Plan to execute. */ public void balance(final RegionPlan plan) { HRegionInfo hri = plan.getRegionInfo(); TableName tableName = hri.getTable(); if (tableStateManager.isTableState(tableName, ZooKeeperProtos.Table.State.DISABLED, ZooKeeperProtos.Table.State.DISABLING)) { LOG.info("Ignored moving region of disabling/disabled table " + tableName); return; } // Move the region only if it's assigned String encodedName = hri.getEncodedName(); ReentrantLock lock = locker.acquireLock(encodedName); try { if (!regionStates.isRegionOnline(hri)) { RegionState state = regionStates.getRegionState(encodedName); LOG.info("Ignored moving region not assigned: " + hri + ", " + (state == null ? "not in region states" : state)); return; } synchronized (this.regionPlans) { this.regionPlans.put(plan.getRegionName(), plan); } unassign(hri, false, plan.getDestination()); } finally { lock.unlock(); } }