public SplitLogWorker(Server hserver, Configuration conf, RegionServerServices server, TaskExecutor splitTaskExecutor) { this.server = server; this.coordination = hserver.getCoordinatedStateManager().getSplitLogWorkerCoordination(); coordination.init(server, conf, splitTaskExecutor, this); }
private boolean useCoordination(final Server server) { return server != null && useCoordinationForAssignment && server.getCoordinatedStateManager() != null; }
private boolean useCoordinatedStateManager(final Server server) { return server != null && useZKForAssignment && server.getCoordinatedStateManager() != null; }
/** * @return whether log is replaying */ public boolean isLogReplaying() { if (server.getCoordinatedStateManager() == null) return false; return ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination().isReplaying(); }
/** * @return whether log is splitting */ public boolean isLogSplitting() { if (server.getCoordinatedStateManager() == null) return false; return ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination().isSplitting(); }
public SplitLogWorker(Server hserver, Configuration conf, RegionServerServices server, TaskExecutor splitTaskExecutor) { this.server = server; this.conf = conf; this.coordination = ((BaseCoordinatedStateManager) hserver.getCoordinatedStateManager()) .getSplitLogWorkerCoordination(); this.server = server; coordination.init(server, conf, splitTaskExecutor, this); }
/** * This function is to set recovery mode from outstanding split log tasks from before or current * configuration setting * @param isForInitialization * @throws IOException throws if it's impossible to set recovery mode */ public void setRecoveryMode(boolean isForInitialization) throws IOException { ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination().setRecoveryMode(isForInitialization); }
/** * @return the current log recovery mode */ public RecoveryMode getRecoveryMode() { return ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination().getRecoveryMode(); }
public void markRegionsRecovering(ServerName server, Set<HRegionInfo> userRegions) throws InterruptedIOException, IOException { if (userRegions == null || (!isLogReplaying())) { return; } try { this.recoveringRegionLock.lock(); // mark that we're creating recovering regions ((BaseCoordinatedStateManager) this.server.getCoordinatedStateManager()) .getSplitLogManagerCoordination().markRegionsRecovering(server, userRegions); } finally { this.recoveringRegionLock.unlock(); } }
/** * It removes stale recovering regions under /hbase/recovering-regions/[encoded region name] * during master initialization phase. * @param failedServers A set of known failed servers * @throws IOException */ void removeStaleRecoveringRegions(final Set<ServerName> failedServers) throws IOException, InterruptedIOException { Set<String> knownFailedServers = new HashSet<String>(); if (failedServers != null) { for (ServerName tmpServerName : failedServers) { knownFailedServers.add(tmpServerName.getServerName()); } } this.recoveringRegionLock.lock(); try { ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination().removeStaleRecoveringRegions(knownFailedServers); } finally { this.recoveringRegionLock.unlock(); } }
((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination().removeRecoveringRegions(recoveredServerNameSet, isMetaRecovery);
/** * Add a task entry to coordination if it is not already there. * @param taskname the path of the log to be split * @param batch the batch this task belongs to * @return true if a new entry is created, false if it is already there. */ boolean enqueueSplitTask(String taskname, TaskBatch batch) { lastTaskCreateTime = EnvironmentEdgeManager.currentTime(); String task = ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination().prepareTask(taskname); Task oldtask = createTaskIfAbsent(task, batch); if (oldtask == null) { // publish the task in the coordination engine ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination().submitTask(task); return true; } return false; }
this.stopper = stopper; this.choreService = new ChoreService(serverName.toString() + "_splitLogManager_"); if (server.getCoordinatedStateManager() != null) { SplitLogManagerCoordination coordination = ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination(); Set<String> failedDeletions = Collections.synchronizedSet(new HashSet<String>());
public void stepsAfterPONR(final Server server, final RegionServerServices services, final HRegion mergedRegion, User user) throws IOException { openMergedRegion(server, services, mergedRegion); if (useCoordination(server)) { ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getRegionMergeCoordination().completeRegionMergeTransaction(services, mergedRegionInfo, region_a, region_b, rmd, mergedRegion); } if (rsCoprocessorHost != null) { if (user == null) { rsCoprocessorHost.postMerge(region_a, region_b, mergedRegion); } else { try { user.getUGI().doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { rsCoprocessorHost.postMerge(region_a, region_b, mergedRegion); return null; } }); } catch (InterruptedException ie) { InterruptedIOException iioe = new InterruptedIOException(); iioe.initCause(ie); throw iioe; } } } }
server == null ? true : ConfigUtil.useZKForAssignment(server.getConfiguration()); if (rmd == null) { rmd = server != null && server.getCoordinatedStateManager() != null ? ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getRegionMergeCoordination().getDefaultDetails() : null;
((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination().remainingTasksInCoordination(); if (remainingTasks >= 0 && actual > remainingTasks) {
if (useCoordinatedStateManager(server)) { std = ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitTransactionCoordination().getDefaultDetails();
openDaughters(server, services, regions.getFirst(), regions.getSecond()); if (useCoordinatedStateManager(server)) { ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitTransactionCoordination().completeSplitTransaction(services, regions.getFirst(), regions.getSecond(), std, parent);
public HRegion stepsBeforePONR(final Server server, final RegionServerServices services, boolean testing) throws IOException { if (rmd == null) { rmd = server != null && server.getCoordinatedStateManager() != null ? ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getRegionMergeCoordination().getDefaultDetails() : null; ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getRegionMergeCoordination().startRegionMergeTransaction(mergedRegionInfo, server.getServerName(), region_a.getRegionInfo(), region_b.getRegionInfo()); ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getRegionMergeCoordination().waitForRegionMergeTransaction(services, mergedRegionInfo, region_a, region_b, rmd); ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getRegionMergeCoordination().confirmRegionMergeTransaction(this.mergedRegionInfo, region_a.getRegionInfo(), region_b.getRegionInfo(), server.getServerName(), rmd);
ZkRegionMergeDetails zrmd = (ZkRegionMergeDetails) rmd; if (manager.getServer() == null || manager.getServer().getCoordinatedStateManager() == null) { return;