@Test
  public void testCompactionConfigurationOnlineChange() throws IOException {
    String strPrefix = "hbase.hstore.compaction.";
    Store s = r1.getStore(COLUMN_FAMILY1);
    if (!(s instanceof HStore)) {
      LOG.error("Can't test the compaction configuration of HStore class. "
        + "Got a different implementation other than HStore");
      return;
    }
    HStore hstore = (HStore) s;

    // Set the new compaction ratio to a different value.
    double newCompactionRatio =
      hstore.getStoreEngine().getCompactionPolicy().getConf().getCompactionRatio() + 0.1;
    conf.setFloat(strPrefix + "ratio", (float) newCompactionRatio);

    // Notify all the observers, which includes the Store object.
    rs1.getConfigurationManager().notifyAllObservers(conf);

    // Check if the compaction ratio got updated in the Compaction Configuration
    assertEquals(newCompactionRatio,
      hstore.getStoreEngine().getCompactionPolicy().getConf().getCompactionRatio(), 0.00001);

    // Check if the off peak compaction ratio gets updated.
    double newOffPeakCompactionRatio =
      hstore.getStoreEngine().getCompactionPolicy().getConf().getCompactionRatioOffPeak() + 0.1;
    conf.setFloat(strPrefix + "ratio.offpeak", (float) newOffPeakCompactionRatio);
    rs1.getConfigurationManager().notifyAllObservers(conf);
    assertEquals(newOffPeakCompactionRatio,
      hstore.getStoreEngine().getCompactionPolicy().getConf().getCompactionRatioOffPeak(), 0.00001);

    // Check if the throttle point gets updated.
    long newThrottlePoint =
      hstore.getStoreEngine().getCompactionPolicy().getConf().getThrottlePoint() + 10;
    conf.setLong("hbase.regionserver.thread.compaction.throttle", newThrottlePoint);
    rs1.getConfigurationManager().notifyAllObservers(conf);
    assertEquals(newThrottlePoint,
      hstore.getStoreEngine().getCompactionPolicy().getConf().getThrottlePoint());

    // Check if the minFilesToCompact gets updated.
    int newMinFilesToCompact =
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMinFilesToCompact() + 1;
    conf.setLong(strPrefix + "min", newMinFilesToCompact);
    rs1.getConfigurationManager().notifyAllObservers(conf);
    assertEquals(newMinFilesToCompact,
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMinFilesToCompact());

    // Check if the maxFilesToCompact gets updated.
    int newMaxFilesToCompact =
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMaxFilesToCompact() + 1;
    conf.setLong(strPrefix + "max", newMaxFilesToCompact);
    rs1.getConfigurationManager().notifyAllObservers(conf);
    assertEquals(newMaxFilesToCompact,
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMaxFilesToCompact());

    // Check OffPeak hours is updated in an online fashion.
    conf.setLong(CompactionConfiguration.HBASE_HSTORE_OFFPEAK_START_HOUR, 6);
    conf.setLong(CompactionConfiguration.HBASE_HSTORE_OFFPEAK_END_HOUR, 7);
    rs1.getConfigurationManager().notifyAllObservers(conf);
    assertFalse(hstore.getOffPeakHours().isOffPeakHour(4));

    // Check if the minCompactSize gets updated.
    long newMinCompactSize =
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMinCompactSize() + 1;
    conf.setLong(strPrefix + "min.size", newMinCompactSize);
    rs1.getConfigurationManager().notifyAllObservers(conf);
    assertEquals(newMinCompactSize,
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMinCompactSize());

    // Check if the maxCompactSize gets updated.
    long newMaxCompactSize =
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMaxCompactSize() - 1;
    conf.setLong(strPrefix + "max.size", newMaxCompactSize);
    rs1.getConfigurationManager().notifyAllObservers(conf);
    assertEquals(newMaxCompactSize,
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMaxCompactSize());
    // Check if the offPeakMaxCompactSize gets updated.
    long newOffpeakMaxCompactSize =
      hstore.getStoreEngine().getCompactionPolicy().getConf().getOffPeakMaxCompactSize() - 1;
    conf.setLong(CompactionConfiguration.HBASE_HSTORE_COMPACTION_MAX_SIZE_OFFPEAK_KEY,
      newOffpeakMaxCompactSize);
    rs1.getConfigurationManager().notifyAllObservers(conf);
    assertEquals(newOffpeakMaxCompactSize,
      hstore.getStoreEngine().getCompactionPolicy().getConf().getOffPeakMaxCompactSize());

    // Check if majorCompactionPeriod gets updated.
    long newMajorCompactionPeriod =
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMajorCompactionPeriod() + 10;
    conf.setLong(HConstants.MAJOR_COMPACTION_PERIOD, newMajorCompactionPeriod);
    rs1.getConfigurationManager().notifyAllObservers(conf);
    assertEquals(newMajorCompactionPeriod,
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMajorCompactionPeriod());

    // Check if majorCompactionJitter gets updated.
    float newMajorCompactionJitter =
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMajorCompactionJitter() + 0.02F;
    conf.setFloat("hbase.hregion.majorcompaction.jitter", newMajorCompactionJitter);
    rs1.getConfigurationManager().notifyAllObservers(conf);
    assertEquals(newMajorCompactionJitter,
      hstore.getStoreEngine().getCompactionPolicy().getConf().getMajorCompactionJitter(), 0.00001);
  }
Test that the configurations in the CompactionConfiguration class change properly.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java