/** * Remove mention of daughters from parent row. * @param parent * @throws IOException */ private void removeDaughtersFromParent(final HRegionInfo parent) throws IOException { MetaEditor.deleteDaughtersReferencesInParent(this.server.getCatalogTracker(), parent); }
public void run() { try { this.services.postOpenDeployTasks(this.region, this.server.getCatalogTracker(), false); } catch (Exception e) { LOG.warn("Exception running postOpenDeployTasks; region=" + this.region.getRegionInfo().getEncodedName(), e); this.exception = e; } // We're done. Set flag then wake up anyone waiting on thread to complete. this.signaller.set(true); synchronized (this.signaller) { this.signaller.notify(); } }
/** * Before assign the ROOT region, ensure it haven't * been assigned by other place * <p> * Under some scenarios, the ROOT region can be opened twice, so it seemed online * in two regionserver at the same time. * If the ROOT region has been assigned, so the operation can be canceled. * @throws InterruptedException * @throws IOException * @throws KeeperException */ private void verifyAndAssignRoot() throws InterruptedException, IOException, KeeperException { long timeout = this.server.getConfiguration(). getLong("hbase.catalog.verification.timeout", 1000); if (!this.server.getCatalogTracker().verifyRootRegionLocation(timeout)) { this.services.getAssignmentManager().assignRoot(); } else if (serverName.equals(server.getCatalogTracker().getRootLocation())) { throw new IOException("-ROOT- is onlined on the dead server " + serverName); } else { LOG.info("Skip assigning -ROOT-, because it is online on the " + server.getCatalogTracker().getRootLocation()); } }
@Override public void process() { try { LOG.info("Handling table operation " + eventType + " on table " + Bytes.toString(tableName)); List<HRegionInfo> hris = MetaReader.getTableRegions(this.server.getCatalogTracker(), tableName); handleTableOperation(hris); if (eventType.isOnlineSchemaChangeSupported() && this.masterServices. getAssignmentManager().getZKTable(). isEnabledTable(Bytes.toString(tableName))) { if (reOpenAllRegions(hris)) { LOG.info("Completed table operation " + eventType + " on table " + Bytes.toString(tableName)); } else { LOG.warn("Error on reopening the regions"); } } } catch (IOException e) { LOG.error("Error manipulating table " + Bytes.toString(tableName), e); } catch (KeeperException e) { LOG.error("Error manipulating table " + Bytes.toString(tableName), e); } finally { notifyEventBeingHandled(); } }
/** * Used by the client to identify if all regions have the schema updates * * @param tableName * @return Pair indicating the status of the alter command * @throws IOException */ public Pair<Integer, Integer> getReopenStatus(byte[] tableName) throws IOException { List <HRegionInfo> hris = MetaReader.getTableRegions(this.master.getCatalogTracker(), tableName); Integer pending = 0; for(HRegionInfo hri : hris) { String name = hri.getEncodedName(); if (regionsToReopen.containsKey(name) || regionsInTransition.containsKey(name)) { pending++; } } return new Pair<Integer, Integer>(pending, hris.size()); } /**
/** * Scans META and returns a number of scanned rows, and * an ordered map of split parents. */ Pair<Integer, Map<HRegionInfo, Result>> getSplitParents() throws IOException { // TODO: Only works with single .META. region currently. Fix. final AtomicInteger count = new AtomicInteger(0); // Keep Map of found split parents. There are candidates for cleanup. // Use a comparator that has split parents come before its daughters. final Map<HRegionInfo, Result> splitParents = new TreeMap<HRegionInfo, Result>(new SplitParentFirstComparator()); // This visitor collects split parents and counts rows in the .META. table MetaReader.Visitor visitor = new MetaReader.Visitor() { @Override public boolean visit(Result r) throws IOException { if (r == null || r.isEmpty()) return true; count.incrementAndGet(); HRegionInfo info = getHRegionInfo(r); if (info == null) return true; // Keep scanning if (info.isSplitParent()) splitParents.put(info, r); // Returning true means "keep scanning" return true; } }; // Run full scan of .META. catalog table passing in our custom visitor MetaReader.fullScan(this.server.getCatalogTracker(), visitor); return new Pair<Integer, Map<HRegionInfo, Result>>(count.get(), splitParents); }
MetaEditor.deleteRegions(this.server.getCatalogTracker(), regions);
MetaReader.getTableRegionsAndLocations(this.server.getCatalogTracker(), Bytes.toBytes(snapshot.getTable()), true);
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()
try { services.postOpenDeployTasks(b, server.getCatalogTracker(), true); services.postOpenDeployTasks(a, server.getCatalogTracker(), true); services.addToOnlineRegions(a); } catch (KeeperException ke) {
MetaEditor.offlineParentInMeta(server.getCatalogTracker(), this.parent.getRegionInfo(), a.getRegionInfo(), b.getRegionInfo());
while (!this.server.isStopped()) { try { this.server.getCatalogTracker().waitForMeta(); hris = MetaReader.getServerUserRegions(this.server.getCatalogTracker(), this.serverName); break;
MetaEditor.deleteRegion(this.server.getCatalogTracker(), parent); result = true;