setupWindows(getConfiguration(), getConfigurationManager());
/** * Check if the number of compaction threads changes online * @throws IOException */ @Test public void testNumCompactionThreadsOnlineChange() throws IOException { assertTrue(rs1.compactSplitThread != null); int newNumSmallThreads = rs1.compactSplitThread.getSmallCompactionThreadNum() + 1; int newNumLargeThreads = rs1.compactSplitThread.getLargeCompactionThreadNum() + 1; conf.setInt("hbase.regionserver.thread.compaction.small", newNumSmallThreads); conf.setInt("hbase.regionserver.thread.compaction.large", newNumLargeThreads); rs1.getConfigurationManager().notifyAllObservers(conf); assertEquals(newNumSmallThreads, rs1.compactSplitThread.getSmallCompactionThreadNum()); assertEquals(newNumLargeThreads, rs1.compactSplitThread.getLargeCompactionThreadNum()); }
rs1.getConfigurationManager().notifyAllObservers(conf); conf.setFloat(strPrefix + "ratio.offpeak", (float)newOffPeakCompactionRatio); rs1.getConfigurationManager().notifyAllObservers(conf); assertEquals(newOffPeakCompactionRatio, hstore.getStoreEngine().getCompactionPolicy().getConf().getCompactionRatioOffPeak(), conf.setLong("hbase.regionserver.thread.compaction.throttle", newThrottlePoint); rs1.getConfigurationManager().notifyAllObservers(conf); assertEquals(newThrottlePoint, hstore.getStoreEngine().getCompactionPolicy().getConf().getThrottlePoint()); hstore.getStoreEngine().getCompactionPolicy().getConf().getMinFilesToCompact() + 1; conf.setLong(strPrefix + "min", newMinFilesToCompact); rs1.getConfigurationManager().notifyAllObservers(conf); assertEquals(newMinFilesToCompact, hstore.getStoreEngine().getCompactionPolicy().getConf().getMinFilesToCompact()); hstore.getStoreEngine().getCompactionPolicy().getConf().getMaxFilesToCompact() + 1; conf.setLong(strPrefix + "max", newMaxFilesToCompact); rs1.getConfigurationManager().notifyAllObservers(conf); assertEquals(newMaxFilesToCompact, hstore.getStoreEngine().getCompactionPolicy().getConf().getMaxFilesToCompact()); rs1.getConfigurationManager().notifyAllObservers(conf); assertFalse(hstore.getOffPeakHours().isOffPeakHour(4));
/** * Check if the number of compaction threads changes online * @throws IOException */ @Test public void testNumCompactionThreadsOnlineChange() throws IOException { assertTrue(rs1.compactSplitThread != null); int newNumSmallThreads = rs1.compactSplitThread.getSmallCompactionThreadNum() + 1; int newNumLargeThreads = rs1.compactSplitThread.getLargeCompactionThreadNum() + 1; conf.setInt("hbase.regionserver.thread.compaction.small", newNumSmallThreads); conf.setInt("hbase.regionserver.thread.compaction.large", newNumLargeThreads); rs1.getConfigurationManager().notifyAllObservers(conf); assertEquals(newNumSmallThreads, rs1.compactSplitThread.getSmallCompactionThreadNum()); assertEquals(newNumLargeThreads, rs1.compactSplitThread.getLargeCompactionThreadNum()); }
rs1.getConfigurationManager().notifyAllObservers(conf); conf.setFloat(strPrefix + "ratio.offpeak", (float)newOffPeakCompactionRatio); rs1.getConfigurationManager().notifyAllObservers(conf); assertEquals(newOffPeakCompactionRatio, hstore.getStoreEngine().getCompactionPolicy().getConf().getCompactionRatioOffPeak(), conf.setLong("hbase.regionserver.thread.compaction.throttle", newThrottlePoint); rs1.getConfigurationManager().notifyAllObservers(conf); assertEquals(newThrottlePoint, hstore.getStoreEngine().getCompactionPolicy().getConf().getThrottlePoint()); hstore.getStoreEngine().getCompactionPolicy().getConf().getMinFilesToCompact() + 1; conf.setLong(strPrefix + "min", newMinFilesToCompact); rs1.getConfigurationManager().notifyAllObservers(conf); assertEquals(newMinFilesToCompact, hstore.getStoreEngine().getCompactionPolicy().getConf().getMinFilesToCompact()); hstore.getStoreEngine().getCompactionPolicy().getConf().getMaxFilesToCompact() + 1; conf.setLong(strPrefix + "max", newMaxFilesToCompact); rs1.getConfigurationManager().notifyAllObservers(conf); assertEquals(newMaxFilesToCompact, hstore.getStoreEngine().getCompactionPolicy().getConf().getMaxFilesToCompact()); rs1.getConfigurationManager().notifyAllObservers(conf); assertFalse(hstore.getOffPeakHours().isOffPeakHour(4));