From 452237f488cefbe6f14fbe3af3e266fc32e5443f Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Thu, 26 Nov 2026 20:06:29 -0800 Subject: [PATCH] PHOENIX-8117 Minicluster ITs abort the master when an injected clock runs ahead of the WAL roller Some ITs inject an EnvironmentEdge that runs many minutes ahead of the wall clock. In HBase 2.x, AbstractWALRoller checks for a periodic roll with the injected clock, but it records the last roll time with the wall clock. When the difference is more than the roll period, the roller rolls the WAL on each pass. The master local region has a roll period of 15 minutes, so TableTTLIT causes thousands of empty WAL rolls. The async WAL output stream times datanode acknowledgments with the injected clock. A clock jump during a write thus looks like a slow datanode. After three such events, the WAL excludes the only datanode of the mini cluster. The next WAL create has no target, and the HMaster aborts with "IOE in log roller". BaseTest.setUpConfigForMiniCluster now disables the periodic WAL roll for the region servers and for the master local region, and it disables the exclusion of slow datanodes. It sets these values after the default test configuration, because that configuration copies the HBase defaults. An override property for one of these keys has priority. Co-Authored-By: Claude Opus 5.5 --- .../org/apache/phoenix/query/BaseTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) 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