From bc476b40395cd027975b18217fed748a55943748 Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Tue, 24 Nov 2026 11:23:37 -0800 Subject: [PATCH 1/3] PHOENIX-8106 Region move tests should turn off the balancer The region move tests move regions on their own schedule. The balancer also moves regions. A balancer move can drop an admin compaction request, so a region skips its compaction and the test sees stale guideposts. A balancer move can also move SYSTEM.CATALOG during DDL. The base class now turns off the balancer before each test. Co-Authored-By: Claude Opus 5.5 --- .../ParallelStatsDisabledWithRegionMovesIT.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledWithRegionMovesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledWithRegionMovesIT.java index e556f808d7c..7b964ded5db 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledWithRegionMovesIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledWithRegionMovesIT.java @@ -56,6 +56,7 @@ import org.apache.phoenix.util.QueryBuilder; import org.apache.phoenix.util.ReadOnlyProps; import org.junit.AfterClass; +import org.junit.Before; import org.junit.BeforeClass; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -119,6 +120,16 @@ public static synchronized void doSetup() throws Exception { setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } + /** + * The tests move regions on their own schedule. Balancer moves can drop admin compaction requests + * and can move SYSTEM.CATALOG during DDL. Thus the balancer stays off. This method is not static + * and has a distinct name, so subclasses that hide doSetup also use it. + */ + @Before + public void disableBalancer() throws Exception { + getUtility().getAdmin().balancerSwitch(false, true); + } + @AfterClass public static synchronized void freeResources() throws Exception { BaseTest.freeResourcesIfBeyondThreshold(); From 146a28f1eef4088eae066a190f2b319b57b74d8b Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Thu, 3 Dec 2026 19:03:49 -0800 Subject: [PATCH 2/3] PHOENIX-8106 Turn the balancer off before parameter setup creates tables The per-test hook runs after the per-parameter setup, which already creates tables and indexes. The class setup now turns the balancer off right after the cluster starts. The per-test hook stays for the subclass that replaces the class setup. Co-Authored-By: Claude Opus 5.5 --- .../end2end/ParallelStatsDisabledWithRegionMovesIT.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledWithRegionMovesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledWithRegionMovesIT.java index 7b964ded5db..b089a2237ab 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledWithRegionMovesIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledWithRegionMovesIT.java @@ -118,12 +118,15 @@ public static synchronized void doSetup() throws Exception { TestScanningResultPostDummyResultCaller.class.getName()); props.put(PHOENIX_INDEX_CDC_CONSUMER_ENABLED, Boolean.toString(false)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); + // Turn the balancer off before any parameter setup creates tables. + getUtility().getAdmin().balancerSwitch(false, true); } /** * The tests move regions on their own schedule. Balancer moves can drop admin compaction requests - * and can move SYSTEM.CATALOG during DDL. Thus the balancer stays off. This method is not static - * and has a distinct name, so subclasses that hide doSetup also use it. + * and can move SYSTEM.CATALOG during DDL. Thus the balancer stays off. The class setup turns it + * off first. This method is not static and has a distinct name, so subclasses that hide doSetup + * also use it. */ @Before public void disableBalancer() throws Exception { From aba29ce72d14e37329c55048bc3b1c3783677f1a Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Fri, 4 Dec 2026 12:44:12 -0800 Subject: [PATCH 3/3] PHOENIX-8106 Turn the balancer off before parameter setup creates tables The parameter setup of the query suites creates tables before the per-test hook runs, and one subclass replaces the class setup. The parameter setup now turns the balancer off first, so the first parameter set also creates its tables with the balancer off. Co-Authored-By: Claude Opus 5.5 --- .../org/apache/phoenix/end2end/BaseQueryWithRegionMovesIT.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryWithRegionMovesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryWithRegionMovesIT.java index f6c122b5017..2bdeefbb141 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryWithRegionMovesIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryWithRegionMovesIT.java @@ -72,6 +72,9 @@ public abstract class BaseQueryWithRegionMovesIT extends ParallelStatsDisabledWi @BeforeParam public static synchronized void initTables(String idxDdl, boolean columnEncoded, boolean keepDeletedCells) throws Exception { + // Parameter setup runs before the per-test hook, and a subclass can replace the class setup. + // Thus turn the balancer off here too, before the tables are created. + getUtility().getAdmin().balancerSwitch(false, true); StringBuilder optionBuilder = new StringBuilder(); if (!columnEncoded) { optionBuilder.append("COLUMN_ENCODED_BYTES=0");