public RegionSizeReportingChore(RegionServerServices rsServices) { super( RegionSizeReportingChore.class.getSimpleName(), rsServices, getPeriod(rsServices.getConfiguration()), getInitialDelay(rsServices.getConfiguration()), getTimeUnit(rsServices.getConfiguration())); this.rsServices = rsServices; this.metrics = rsServices.getMetrics(); }
public RegionServerRpcQuotaManager(final RegionServerServices rsServices) { this.rsServices = rsServices; rpcThrottleStorage = new RpcThrottleStorage(rsServices.getZooKeeper(), rsServices.getConfiguration()); }
public SpaceQuotaRefresherChore(RegionServerSpaceQuotaManager manager, Connection conn) { super(SpaceQuotaRefresherChore.class.getSimpleName(), manager.getRegionServerServices(), getPeriod(manager.getRegionServerServices().getConfiguration()), getInitialDelay(manager.getRegionServerServices().getConfiguration()), getTimeUnit(manager.getRegionServerServices().getConfiguration())); this.manager = manager; this.conn = conn; }
public void start(final RpcScheduler rpcScheduler) throws IOException { if (!QuotaUtil.isQuotaEnabled(rsServices.getConfiguration())) { LOG.info("Quota support disabled"); return; } LOG.info("Initializing RPC quota support"); // Initialize quota cache quotaCache = new QuotaCache(rsServices); quotaCache.start(); rpcThrottleEnabled = rpcThrottleStorage.isRpcThrottleEnabled(); LOG.info("Start rpc quota manager and rpc throttle enabled is {}", rpcThrottleEnabled); }
public void start() throws IOException { stopped = false; // TODO: This will be replaced once we have the notification bus ready. Configuration conf = rsServices.getConfiguration(); int period = conf.getInt(REFRESH_CONF_KEY, REFRESH_DEFAULT_PERIOD); refreshChore = new QuotaRefresherChore(period, this); rsServices.getChoreService().scheduleChore(refreshChore); }
/** * Start accepting backup procedure requests. */ @Override public void start() { if (!BackupManager.isBackupEnabled(rss.getConfiguration())) { LOG.warn("Backup is not enabled. Check your " + BackupRestoreConstants.BACKUP_ENABLE_KEY + " setting"); return; } this.memberRpcs.start(rss.getServerName().toString(), member); started = true; LOG.info("Started region server backup manager."); }
@Override public void initialize(RegionServerServices rss) throws KeeperException { this.rss = rss; if (!BackupManager.isBackupEnabled(rss.getConfiguration())) { LOG.warn("Backup is not enabled. Check your " + BackupRestoreConstants.BACKUP_ENABLE_KEY + " setting"); return; } ProcedureCoordinationManager coordManager = new ZKProcedureCoordinationManager(rss); this.memberRpcs = coordManager .getProcedureMemberRpcs(LogRollMasterProcedureManager.ROLLLOG_PROCEDURE_SIGNATURE); // read in the backup handler configuration properties Configuration conf = rss.getConfiguration(); long keepAlive = conf.getLong(BACKUP_TIMEOUT_MILLIS_KEY, BACKUP_TIMEOUT_MILLIS_DEFAULT); int opThreads = conf.getInt(BACKUP_REQUEST_THREADS_KEY, BACKUP_REQUEST_THREADS_DEFAULT); // create the actual cohort member ThreadPoolExecutor pool = ProcedureMember.defaultPool(rss.getServerName().toString(), opThreads, keepAlive); this.member = new ProcedureMember(memberRpcs, pool, new BackupSubprocedureBuilder()); }
/** * Create a mocked region server service instance */ private RegionServerServices getRegionServer(ServerName name) { RegionServerServices mockedServer = mock(RegionServerServices.class); when(mockedServer.getConfiguration()).thenReturn(TEST_UTIL.getConfiguration()); when(mockedServer.getServerName()).thenReturn(name); when(mockedServer.getZooKeeper()).thenReturn(zkw); when(mockedServer.isStopped()).thenReturn(false); when(mockedServer.getExecutorService()).thenReturn(executorService); return mockedServer; }
/** * If in a running state, creates the specified subprocedure for handling a backup procedure. * @return Subprocedure to submit to the ProcedureMemeber. */ public Subprocedure buildSubprocedure(byte[] data) { // don't run a backup if the parent is stop(ping) if (rss.isStopping() || rss.isStopped()) { throw new IllegalStateException("Can't start backup procedure on RS: " + rss.getServerName() + ", because stopping/stopped!"); } LOG.info("Attempting to run a roll log procedure for backup."); ForeignExceptionDispatcher errorDispatcher = new ForeignExceptionDispatcher(); Configuration conf = rss.getConfiguration(); long timeoutMillis = conf.getLong(BACKUP_TIMEOUT_MILLIS_KEY, BACKUP_TIMEOUT_MILLIS_DEFAULT); long wakeMillis = conf.getLong(BACKUP_REQUEST_WAKE_MILLIS_KEY, BACKUP_REQUEST_WAKE_MILLIS_DEFAULT); LogRollBackupSubprocedurePool taskManager = new LogRollBackupSubprocedurePool(rss.getServerName().toString(), conf); return new LogRollBackupSubprocedure(rss, member, errorDispatcher, wakeMillis, timeoutMillis, taskManager, data); }
@SuppressWarnings("unchecked") @Before public void setup() throws IOException { conf = HBaseConfiguration.create(); rss = mock(RegionServerServices.class); manager = mock(RegionServerSpaceQuotaManager.class); conn = mock(Connection.class); when(manager.getRegionServerServices()).thenReturn(rss); when(rss.getConfiguration()).thenReturn(conf); chore = mock(SpaceQuotaRefresherChore.class); when(chore.getConnection()).thenReturn(conn); when(chore.getManager()).thenReturn(manager); doCallRealMethod().when(chore).chore(); when(chore.isInViolation(any())).thenCallRealMethod(); doCallRealMethod().when(chore).extractQuotaSnapshot(any(), any()); }
Configuration conf = rss.getConfiguration(); long timeoutMillis = conf.getLong(FLUSH_TIMEOUT_MILLIS_KEY, FLUSH_TIMEOUT_MILLIS_DEFAULT);
/** * Initialize this region server flush procedure manager * Uses a zookeeper based member controller. * @param rss region server * @throws KeeperException if the zookeeper cannot be reached */ @Override public void initialize(RegionServerServices rss) throws KeeperException { this.rss = rss; ZKWatcher zkw = rss.getZooKeeper(); this.memberRpcs = new ZKProcedureMemberRpcs(zkw, MasterFlushTableProcedureManager.FLUSH_TABLE_PROCEDURE_SIGNATURE); Configuration conf = rss.getConfiguration(); long keepAlive = conf.getLong(FLUSH_TIMEOUT_MILLIS_KEY, FLUSH_TIMEOUT_MILLIS_DEFAULT); int opThreads = conf.getInt(FLUSH_REQUEST_THREADS_KEY, FLUSH_REQUEST_THREADS_DEFAULT); // create the actual flush table procedure member ThreadPoolExecutor pool = ProcedureMember.defaultPool(rss.getServerName().toString(), opThreads, keepAlive); this.member = new ProcedureMember(memberRpcs, pool, new FlushTableSubprocedureBuilder()); }
/** * Create a default snapshot handler - uses a zookeeper based member controller. * @param rss region server running the handler * @throws KeeperException if the zookeeper cluster cannot be reached */ @Override public void initialize(RegionServerServices rss) throws KeeperException { this.rss = rss; ZKWatcher zkw = rss.getZooKeeper(); this.memberRpcs = new ZKProcedureMemberRpcs(zkw, SnapshotManager.ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION); // read in the snapshot request configuration properties Configuration conf = rss.getConfiguration(); long keepAlive = conf.getLong(SNAPSHOT_TIMEOUT_MILLIS_KEY, SNAPSHOT_TIMEOUT_MILLIS_DEFAULT); int opThreads = conf.getInt(SNAPSHOT_REQUEST_THREADS_KEY, SNAPSHOT_REQUEST_THREADS_DEFAULT); // create the actual snapshot procedure member ThreadPoolExecutor pool = ProcedureMember.defaultPool(rss.getServerName().toString(), opThreads, keepAlive); this.member = new ProcedureMember(memberRpcs, pool, new SnapshotSubprocedureBuilder()); }
public synchronized void start() throws IOException { if (!QuotaUtil.isQuotaEnabled(rsServices.getConfiguration())) { LOG.info("Quota support disabled, not starting space quota manager."); return; } if (started) { LOG.warn("RegionServerSpaceQuotaManager has already been started!"); return; } // Start the chores this.spaceQuotaRefresher = new SpaceQuotaRefresherChore(this, rsServices.getClusterConnection()); rsServices.getChoreService().scheduleChore(spaceQuotaRefresher); this.regionSizeReporter = new RegionSizeReportingChore(rsServices); rsServices.getChoreService().scheduleChore(regionSizeReporter); // Instantiate the real RegionSizeStore this.regionSizeStore = RegionSizeStoreFactory.getInstance().createStore(); started = true; }
return new DefaultOperationQuota(this.rsServices.getConfiguration(), userLimiter); return new DefaultOperationQuota(this.rsServices.getConfiguration(), userLimiter, tableLimiter, nsLimiter, rsLimiter);
region = HRegion.openHRegion(regionInfo, htd, rs.getWAL(regionInfo), rs.getConfiguration(), rs, null); } catch (IOException e) {
+ snapshot.getTable() + " type " + snapshot.getType()); ForeignExceptionDispatcher exnDispatcher = new ForeignExceptionDispatcher(snapshot.getName()); Configuration conf = rss.getConfiguration(); long timeoutMillis = conf.getLong(SNAPSHOT_TIMEOUT_MILLIS_KEY, SNAPSHOT_TIMEOUT_MILLIS_DEFAULT);
/** * If in a running state, creates the specified subprocedure for handling a procedure. * @return Subprocedure to submit to the ProcedureMemeber. */ public Subprocedure buildSubprocedure(String name) { // don't run a procedure if the parent is stop(ping) if (rss.isStopping() || rss.isStopped()) { throw new IllegalStateException("Can't start procedure on RS: " + rss.getServerName() + ", because stopping/stopped!"); } LOG.info("Attempting to run a procedure."); ForeignExceptionDispatcher errorDispatcher = new ForeignExceptionDispatcher(); Configuration conf = rss.getConfiguration(); SimpleSubprocedurePool taskManager = new SimpleSubprocedurePool(rss.getServerName().toString(), conf); return new SimpleSubprocedure(rss, member, errorDispatcher, taskManager, name); }
when(rss.getConfiguration()).thenReturn(CONF); when(rss.getRegionServerAccounting()).thenReturn(new RegionServerAccounting(CONF)); String string = org.apache.hadoop.hbase.executor.EventType.RS_COMPACTED_FILES_DISCHARGER
/** * Create a mocked region server service instance */ private RegionServerServices getRegionServer(ServerName name) { RegionServerServices mockedServer = mock(RegionServerServices.class); when(mockedServer.getConfiguration()).thenReturn(TEST_UTIL.getConfiguration()); when(mockedServer.getServerName()).thenReturn(name); when(mockedServer.getZooKeeper()).thenReturn(zkw); when(mockedServer.isStopped()).thenReturn(false); when(mockedServer.getExecutorService()).thenReturn(executorService); return mockedServer; }