/** * Its OK to construct this object even when region-servers are not online. It does lookup the * orphan tasks in coordination engine but it doesn't block waiting for them to be done. * @param server the server instance * @param conf the HBase configuration * @param stopper the stoppable in case anything is wrong * @param master the master services * @param serverName the master server name * @throws IOException */ public SplitLogManager(Server server, Configuration conf, Stoppable stopper, MasterServices master, ServerName serverName) throws IOException { this.server = server; this.conf = conf; 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>()); SplitLogManagerDetails details = new SplitLogManagerDetails(tasks, master, failedDeletions, serverName); coordination.setDetails(details); coordination.init(); // Determine recovery mode } this.unassignedTimeout = conf.getInt("hbase.splitlog.manager.unassigned.timeout", DEFAULT_UNASSIGNED_TIMEOUT); this.timeoutMonitor = new TimeoutMonitor(conf.getInt("hbase.splitlog.manager.timeoutmonitor.period", 1000), stopper); choreService.scheduleChore(timeoutMonitor); }
/** * Its OK to construct this object even when region-servers are not online. It does lookup the * orphan tasks in coordination engine but it doesn't block waiting for them to be done. * @param server the server instance * @param conf the HBase configuration * @param stopper the stoppable in case anything is wrong * @param master the master services * @param serverName the master server name * @throws IOException */ public SplitLogManager(Server server, Configuration conf, Stoppable stopper, MasterServices master, ServerName serverName) throws IOException { this.server = server; this.conf = conf; this.stopper = stopper; if (server.getCoordinatedStateManager() != null) { SplitLogManagerCoordination coordination = ((BaseCoordinatedStateManager) server.getCoordinatedStateManager()) .getSplitLogManagerCoordination(); Set<String> failedDeletions = Collections.synchronizedSet(new HashSet<String>()); SplitLogManagerDetails details = new SplitLogManagerDetails(tasks, master, failedDeletions, serverName); coordination.init(); coordination.setDetails(details); // Determine recovery mode } this.unassignedTimeout = conf.getInt("hbase.splitlog.manager.unassigned.timeout", DEFAULT_UNASSIGNED_TIMEOUT); this.timeoutMonitor = new TimeoutMonitor(conf.getInt("hbase.splitlog.manager.timeoutmonitor.period", 1000), stopper); Threads.setDaemonThreadRunning(timeoutMonitor.getThread(), serverName + ".splitLogManagerTimeoutMonitor"); }
/** * Its OK to construct this object even when region-servers are not online. It does lookup the * orphan tasks in coordination engine but it doesn't block waiting for them to be done. * @param master the master services * @param conf the HBase configuration * @throws IOException */ public SplitLogManager(MasterServices master, Configuration conf) throws IOException { this.server = master; this.conf = conf; // Get Server Thread name. Sometimes the Server is mocked so may not implement HasThread. // For example, in tests. String name = master instanceof HasThread? ((HasThread)master).getName(): master.getServerName().toShortString(); this.choreService = new ChoreService(name + ".splitLogManager."); if (server.getCoordinatedStateManager() != null) { SplitLogManagerCoordination coordination = getSplitLogManagerCoordination(); Set<String> failedDeletions = Collections.synchronizedSet(new HashSet<String>()); SplitLogManagerDetails details = new SplitLogManagerDetails(tasks, master, failedDeletions); coordination.setDetails(details); coordination.init(); } this.unassignedTimeout = conf.getInt("hbase.splitlog.manager.unassigned.timeout", DEFAULT_UNASSIGNED_TIMEOUT); this.timeoutMonitor = new TimeoutMonitor(conf.getInt("hbase.splitlog.manager.timeoutmonitor.period", 1000), master); choreService.scheduleChore(timeoutMonitor); }
@Override public CoordinatedStateManager getCoordinatedStateManager() { BaseCoordinatedStateManager m = Mockito.mock(BaseCoordinatedStateManager.class); SplitLogManagerCoordination c = Mockito.mock(SplitLogManagerCoordination.class); Mockito.when(m.getSplitLogManagerCoordination()).thenReturn(c); SplitLogManagerDetails d = Mockito.mock(SplitLogManagerDetails.class); Mockito.when(c.getDetails()).thenReturn(d); return m; }
private SplitLogManagerCoordination getSplitLogManagerCoordination() { return server.getCoordinatedStateManager().getSplitLogManagerCoordination(); }
/** * Method to retrieve coordination for split log manager */ SplitLogManagerCoordination getSplitLogManagerCoordination();