@Test
  public void testOnConfigurationChange() throws IOException {
    final int COMMON_MAX_FILES_TO_COMPACT = 10;
    final int NEW_COMMON_MAX_FILES_TO_COMPACT = 8;
    final int STORE_MAX_FILES_TO_COMPACT = 6;

    // Build a table that its maxFileToCompact different from common configuration.
    Configuration conf = HBaseConfiguration.create();
    conf.setInt(CompactionConfiguration.HBASE_HSTORE_COMPACTION_MAX_KEY,
      COMMON_MAX_FILES_TO_COMPACT);
    conf.setBoolean(CACHE_DATA_ON_READ_KEY, false);
    conf.setBoolean(CACHE_BLOCKS_ON_WRITE_KEY, true);
    conf.setBoolean(EVICT_BLOCKS_ON_CLOSE_KEY, true);
    ColumnFamilyDescriptor hcd = ColumnFamilyDescriptorBuilder.newBuilder(family)
      .setConfiguration(CompactionConfiguration.HBASE_HSTORE_COMPACTION_MAX_KEY,
        String.valueOf(STORE_MAX_FILES_TO_COMPACT))
      .build();
    init(this.name.getMethodName(), conf, hcd);

    // After updating common configuration, the conf in HStore itself must not be changed.
    conf.setInt(CompactionConfiguration.HBASE_HSTORE_COMPACTION_MAX_KEY,
      NEW_COMMON_MAX_FILES_TO_COMPACT);
    this.store.onConfigurationChange(conf);

    assertEquals(STORE_MAX_FILES_TO_COMPACT,
      store.getStoreEngine().getCompactionPolicy().getConf().getMaxFilesToCompact());

    assertEquals(conf.getBoolean(CACHE_DATA_ON_READ_KEY, DEFAULT_CACHE_DATA_ON_READ), false);
    assertEquals(conf.getBoolean(CACHE_BLOCKS_ON_WRITE_KEY, DEFAULT_CACHE_DATA_ON_WRITE), true);
    assertEquals(conf.getBoolean(EVICT_BLOCKS_ON_CLOSE_KEY, DEFAULT_EVICT_ON_CLOSE), true);

    // reset to default values
    conf.getBoolean(CACHE_DATA_ON_READ_KEY, DEFAULT_CACHE_DATA_ON_READ);
    conf.getBoolean(CACHE_BLOCKS_ON_WRITE_KEY, DEFAULT_CACHE_DATA_ON_WRITE);
    conf.getBoolean(EVICT_BLOCKS_ON_CLOSE_KEY, DEFAULT_EVICT_ON_CLOSE);
    this.store.onConfigurationChange(conf);
  }
Wait flush thread stopping before {@link DefaultMemStore#doClearSnapshot}
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHStore.java