diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java index 11e0b120315..a4ba034c6e3 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java @@ -577,6 +577,25 @@ public static Configuration setUpConfigForMiniCluster(Configuration conf, ReadOnlyProps overrideProps) throws Exception { assertNotNull(conf); setDefaultTestConfig(conf, overrideProps); + // Some tests inject a clock that runs ahead of the wall clock. The HBase 2.x WAL roller + // compares the injected clock with the wall clock. When the difference is more than the roll + // period, the roller rolls the WAL on each pass. For this reason, the first two values disable + // the periodic roll for the region server WALs and for the WAL of the master local region. + // Rolls for size and requested rolls continue to occur. + // + // The WAL output stream measures the datanode acknowledgment time with the injected clock. A + // forward jump of the clock thus looks like a slow datanode. A mini cluster often has only one + // datanode. When the WAL excludes it, the WAL cannot create its next file, and the server + // aborts. The third value prevents the exclusion of a datanode because of slow acknowledgments. + // + // The default test configuration copies the HBase defaults. Thus this method sets these values + // after it. An override property for one of these keys has priority. + setIfNotOverridden(conf, overrideProps, "hbase.regionserver.logroll.period", + Long.toString(Long.MAX_VALUE)); + setIfNotOverridden(conf, overrideProps, "hbase.master.store.region.walroll.period.ms", + Long.toString(Long.MAX_VALUE)); + setIfNotOverridden(conf, overrideProps, "hbase.regionserver.async.wal.min.slow.detect.count", + Integer.toString(Integer.MAX_VALUE)); /* * The default configuration of mini cluster ends up spawning a lot of threads that are not * really needed by phoenix for test purposes. Limiting these threads helps us in running @@ -614,6 +633,13 @@ public static Configuration setUpConfigForMiniCluster(Configuration conf, return conf; } + private static void setIfNotOverridden(Configuration conf, ReadOnlyProps overrideProps, + String key, String value) { + if (overrideProps.get(key) == null) { + conf.set(key, value); + } + } + /* * Set property hbase.coprocessor.regionserver.classes to include test implementation of * PhoenixRegionServerEndpoint by default, if some other regionserver coprocs are not already