/** * @return Maximum time we should run balancer for */ private int getMaxBalancingTime() { int maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_MAX_BALANCING, -1); if (maxBalancingTime == -1) { // if max balancing time isn't set, defaulting it to period time maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_PERIOD, HConstants.DEFAULT_HBASE_BALANCER_PERIOD); } return maxBalancingTime; }
/** Creates a Thread that monitors the {@link #isInitialized()} state. */ InitializationMonitor(HMaster master) { super("MasterInitializationMonitor"); this.master = master; this.timeout = master.getConfiguration().getLong(TIMEOUT_KEY, TIMEOUT_DEFAULT); this.haltOnTimeout = master.getConfiguration().getBoolean(HALT_KEY, HALT_DEFAULT); this.setDaemon(true); }
public RegionNormalizerChore(HMaster master) { super(master.getServerName() + "-RegionNormalizerChore", master, master.getConfiguration().getInt("hbase.normalizer.period", 300000)); this.master = master; }
public ClusterStatusChore(HMaster master, LoadBalancer balancer) { super(master.getServerName() + "-ClusterStatusChore", master, master.getConfiguration().getInt( "hbase.balancer.statusPeriod", 60000)); this.master = master; this.balancer = balancer; }
public BalancerChore(HMaster master) { super(master.getServerName() + "-BalancerChore", master, master.getConfiguration().getInt( HConstants.HBASE_BALANCER_PERIOD, HConstants.DEFAULT_HBASE_BALANCER_PERIOD)); this.master = master; }
public ExpiredMobFileCleanerChore(HMaster master) { super(master.getServerName() + "-ExpiredMobFileCleanerChore", master, master.getConfiguration() .getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), master .getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), TimeUnit.SECONDS); this.master = master; cleaner = new ExpiredMobFileCleaner(); cleaner.setConf(master.getConfiguration()); }
/** * check configured hfile format version before to do compaction * @throws IOException throw IOException */ private void checkHFileFormatVersionForMob() throws IOException { if (HFile.getFormatVersion(master.getConfiguration()) < HFile.MIN_FORMAT_VERSION_WITH_TAGS) { LOG.error("A minimum HFile version of " + HFile.MIN_FORMAT_VERSION_WITH_TAGS + " is required for MOB compaction. Compaction will not run."); throw new IOException("A minimum HFile version of " + HFile.MIN_FORMAT_VERSION_WITH_TAGS + " is required for MOB feature. Consider setting " + HFile.FORMAT_VERSION_KEY + " accordingly."); } }
private SpaceQuotaSnapshotNotifier createQuotaSnapshotNotifier() { SpaceQuotaSnapshotNotifier notifier = SpaceQuotaSnapshotNotifierFactory.getInstance().create(getConfiguration()); return notifier; }
public MobCompactionChore(HMaster master, int period) { // use the period as initial delay. super(master.getServerName() + "-MobCompactionChore", master, period, period, TimeUnit.SECONDS); this.master = master; this.pool = MobUtils.createMobCompactorThreadPool(master.getConfiguration()); }
public SnapshotQuotaObserverChore(HMaster master, MetricsMaster metrics) { this( master.getConnection(), master.getConfiguration(), master.getFileSystem(), master, metrics); }
@VisibleForTesting protected void initClusterSchemaService() throws IOException, InterruptedException { this.clusterSchemaService = new ClusterSchemaServiceImpl(this); this.clusterSchemaService.startAsync(); try { this.clusterSchemaService.awaitRunning(getConfiguration().getInt( HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS, DEFAULT_HBASE_MASTER_WAIT_ON_SERVICE_IN_SECONDS), TimeUnit.SECONDS); } catch (TimeoutException toe) { throw new IOException("Timedout starting ClusterSchemaService", toe); } }
public QuotaObserverChore(HMaster master, MetricsMaster metrics) { this( master.getConnection(), master.getConfiguration(), master.getSpaceQuotaSnapshotNotifier(), master.getMasterQuotaManager(), master, metrics); }
private RegionServerStartupResponse.Builder addConfig( final RegionServerStartupResponse.Builder resp, final String key) { NameStringPair.Builder entry = NameStringPair.newBuilder() .setName(key) .setValue(master.getConfiguration().get(key)); resp.addMapEntries(entry.build()); return resp; }
public long requestNamespaceLock(final String namespace, final LockType type, final String description, final NonceKey nonceKey) throws IllegalArgumentException, IOException { master.getMasterCoprocessorHost().preRequestLock(namespace, null, null, type, description); final LockProcedure proc = new LockProcedure(master.getConfiguration(), namespace, type, description, null); submitProcedure(proc, nonceKey); master.getMasterCoprocessorHost().postRequestLock(namespace, null, null, type, description); return proc.getProcId(); }
public long requestTableLock(final TableName tableName, final LockType type, final String description, final NonceKey nonceKey) throws IllegalArgumentException, IOException { master.getMasterCoprocessorHost().preRequestLock(null, tableName, null, type, description); final LockProcedure proc = new LockProcedure(master.getConfiguration(), tableName, type, description, null); submitProcedure(proc, nonceKey); master.getMasterCoprocessorHost().postRequestLock(null, tableName, null, type, description); return proc.getProcId(); }
@Override public FileArchiveNotificationResponse reportFileArchival(RpcController controller, FileArchiveNotificationRequest request) throws ServiceException { try { master.checkInitialized(); if (!QuotaUtil.isQuotaEnabled(master.getConfiguration())) { return FileArchiveNotificationResponse.newBuilder().build(); } master.getMasterQuotaManager().processFileArchivals(request, master.getConnection(), master.getConfiguration(), master.getFileSystem()); return FileArchiveNotificationResponse.newBuilder().build(); } catch (Exception e) { throw new ServiceException(e); } }
/** * @throws IllegalArgumentException if all regions are not from same table. */ public long requestRegionsLock(final RegionInfo[] regionInfos, final String description, final NonceKey nonceKey) throws IllegalArgumentException, IOException { master.getMasterCoprocessorHost().preRequestLock(null, null, regionInfos, LockType.EXCLUSIVE, description); final LockProcedure proc = new LockProcedure(master.getConfiguration(), regionInfos, LockType.EXCLUSIVE, description, null); submitProcedure(proc, nonceKey); master.getMasterCoprocessorHost().postRequestLock(null, null, regionInfos, LockType.EXCLUSIVE, description); return proc.getProcId(); }
@Test public void testMasterOnlineConfigChange() throws Exception { replaceHBaseSiteXML(); ServerName master = admin.getMaster().get(); admin.updateConfiguration(master).join(); admin.getBackupMasters().get() .forEach(backupMaster -> admin.updateConfiguration(backupMaster).join()); // Check the configuration of the Masters TEST_UTIL.getMiniHBaseCluster().getMasterThreads().forEach(thread -> { Configuration conf = thread.getMaster().getConfiguration(); assertEquals(1000, conf.getInt("hbase.custom.config", 0)); }); restoreHBaseSiteXML(); }
@Test public void testAllClusterOnlineConfigChange() throws IOException { replaceHBaseSiteXML(); admin.updateConfiguration().join(); // Check the configuration of the Masters TEST_UTIL.getMiniHBaseCluster().getMasterThreads().forEach(thread -> { Configuration conf = thread.getMaster().getConfiguration(); assertEquals(1000, conf.getInt("hbase.custom.config", 0)); }); // Check the configuration of the RegionServers TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().forEach(thread -> { Configuration conf = thread.getRegionServer().getConfiguration(); assertEquals(1000, conf.getInt("hbase.custom.config", 0)); }); restoreHBaseSiteXML(); }
private void decrementMinRegionServerCount() { // decrement the count for this.conf, for newly spwaned master // this.hbaseCluster shares this configuration too decrementMinRegionServerCount(getConfiguration()); // each master thread keeps a copy of configuration for (MasterThread master : getHBaseCluster().getMasterThreads()) { decrementMinRegionServerCount(master.getMaster().getConfiguration()); } }