From 61e59879a06f3128f9de6b41229a5480ab62a26a Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Mon, 29 Jun 2026 11:30:31 -0700 Subject: [PATCH 1/2] PHOENIX-7829 TaskRegionObserver.SelfHealingTask runs unexpectedly during tests Co-authored-by: Claude Opus 4.8[1m] --- .../phoenix/cache/ServerMetadataCacheIT.java | 2 -- .../end2end/BackwardCompatibilityIT.java | 2 -- .../org/apache/phoenix/end2end/CDCStreamIT.java | 2 -- .../end2end/MetadataGetTableReadLockIT.java | 3 --- .../end2end/MetadataServerConnectionsIT.java | 2 -- .../phoenix/end2end/ParallelStatsEnabledIT.java | 1 - .../phoenix/end2end/UCFWithDisabledIndexIT.java | 1 - ...UCFWithDisabledIndexWithDDLValidationIT.java | 1 - .../end2end/UCFWithServerMetadataIT.java | 1 - .../apache/phoenix/end2end/UpsertSelectIT.java | 4 ---- .../end2end/UpsertSelectWithRegionMovesIT.java | 4 ---- .../phoenix/end2end/index/IndexMetadataIT.java | 8 ++++++++ .../index/PartialSystemCatalogIndexIT.java | 4 ---- .../monitoring/BasePhoenixMetricsIT.java | 2 -- .../phoenix/monitoring/IndexMetricsIT.java | 1 - .../phoenix/monitoring/MetadataMetricsIT.java | 1 - .../ConnectionQueryServicesMetricsIT.java | 2 -- .../apache/phoenix/query/MetaDataCachingIT.java | 11 ++++------- .../java/org/apache/phoenix/query/BaseTest.java | 4 ++++ .../java/org/apache/phoenix/util/TestUtil.java | 17 +++++++++++++++++ 20 files changed, 33 insertions(+), 40 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java b/phoenix-core/src/it/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java index 5650728718c..1070ae8021b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/cache/ServerMetadataCacheIT.java @@ -101,8 +101,6 @@ public static synchronized void doSetup() throws Exception { props.put(QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB, "NEVER"); props.put(QueryServices.LAST_DDL_TIMESTAMP_VALIDATION_ENABLED, Boolean.toString(true)); props.put(PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED, Boolean.toString(true)); - props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); assertEquals(1, getUtility().getHBaseCluster().getNumLiveRegionServers()); serverName = getUtility().getHBaseCluster().getRegionServer(0).getServerName(); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java index a2487cd7789..e57766a05ab 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java @@ -115,8 +115,6 @@ public static synchronized Collection data() throws Exception public synchronized void doSetup() throws Exception { tmpDir = System.getProperty("java.io.tmpdir"); conf = HBaseConfiguration.create(); - conf.set(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); - conf.set(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); hbaseTestUtil = new HBaseTestingUtility(conf); setUpConfigForMiniCluster(conf); conf.set(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCStreamIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCStreamIT.java index cb805bfcccc..74f6c4e0d70 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCStreamIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCStreamIT.java @@ -86,8 +86,6 @@ public static synchronized void doSetup() throws Exception { Map props = Maps.newHashMapWithExpectedSize(1); props.put(PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY, Integer.toString(60 * 60)); // An hour props.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(false)); - props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); props.put("hbase.coprocessor.master.classes", PhoenixMasterObserver.class.getName()); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); taskRegionEnvironment = diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetadataGetTableReadLockIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetadataGetTableReadLockIT.java index 392e74ddbe0..87d1de9c4f7 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetadataGetTableReadLockIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetadataGetTableReadLockIT.java @@ -27,7 +27,6 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.coprocessor.MetaDataEndpointImpl; import org.apache.phoenix.query.BaseTest; -import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.TestUtil; import org.junit.AfterClass; @@ -48,8 +47,6 @@ public class MetadataGetTableReadLockIT extends BaseTest { @BeforeClass public static synchronized void doSetup() throws Exception { Map props = Maps.newHashMapWithExpectedSize(1); - // Disable system task handling - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); setUpTestDriver(new ReadOnlyProps(props)); } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetadataServerConnectionsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetadataServerConnectionsIT.java index bebabc9bbfd..e07ad3c8b83 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetadataServerConnectionsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MetadataServerConnectionsIT.java @@ -52,7 +52,6 @@ import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.protobuf.ProtobufUtil; import org.apache.phoenix.query.BaseTest; -import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.ClientUtil; import org.apache.phoenix.util.MetaDataUtil; import org.apache.phoenix.util.ReadOnlyProps; @@ -80,7 +79,6 @@ public class MetadataServerConnectionsIT extends BaseTest { @BeforeClass public static synchronized void doSetup() throws Exception { Map props = Maps.newHashMapWithExpectedSize(1); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); props.put(DISABLE_VIEW_SUBTREE_VALIDATION, "true"); props.put(PHOENIX_INDEX_CDC_CONSUMER_ENABLED, Boolean.toString(false)); setUpTestDriver(new ReadOnlyProps(props)); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsEnabledIT.java index c82dbf1f1e3..095306c7ddd 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsEnabledIT.java @@ -45,7 +45,6 @@ public static synchronized final void doSetup() throws Exception { props.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5)); props.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, Long.toString(5)); props.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true)); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); TaskRegionEnvironment = diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithDisabledIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithDisabledIndexIT.java index a1372be5496..57436d2bc8a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithDisabledIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithDisabledIndexIT.java @@ -74,7 +74,6 @@ private static void initCluster() throws Exception { props.put(QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB, "ALWAYS"); props.put(QueryServices.LAST_DDL_TIMESTAMP_VALIDATION_ENABLED, Boolean.toString(false)); props.put(QueryServices.PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED, Boolean.toString(false)); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); props.put(DISABLE_VIEW_SUBTREE_VALIDATION, "true"); props.put(INDEX_USE_SERVER_METADATA_ATTRIB, Boolean.toString(false)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithDisabledIndexWithDDLValidationIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithDisabledIndexWithDDLValidationIT.java index 8c63fd90d81..44b703dc808 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithDisabledIndexWithDDLValidationIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithDisabledIndexWithDDLValidationIT.java @@ -44,7 +44,6 @@ private static void initCluster() throws Exception { props.put(QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB, "NEVER"); props.put(QueryServices.LAST_DDL_TIMESTAMP_VALIDATION_ENABLED, Boolean.toString(true)); props.put(QueryServices.PHOENIX_METADATA_INVALIDATE_CACHE_ENABLED, Boolean.toString(true)); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); props.put(INDEX_USE_SERVER_METADATA_ATTRIB, Boolean.toString(false)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithServerMetadataIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithServerMetadataIT.java index fe299294569..e9b56c205fa 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithServerMetadataIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UCFWithServerMetadataIT.java @@ -100,7 +100,6 @@ public void addServerCache(RpcController controller, AddServerCacheRequest reque @BeforeClass public static synchronized void doSetup() throws Exception { Map props = new HashMap<>(1); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); props.put(PHOENIX_INDEX_CDC_CONSUMER_ENABLED, Boolean.toString(false)); setUpTestDriver(new ReadOnlyProps(props)); } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index 1bf090cdae1..c92b02623ca 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -85,10 +85,6 @@ public static synchronized void doSetup() throws Exception { // An hour - inherited from ParallelStatsDisabledIT props.put(BaseScannerRegionObserverConstants.PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY, Integer.toString(60 * 60)); - // Postpone scans of SYSTEM.TASK indefinitely so as to prevent - // any addition to GLOBAL_OPEN_PHOENIX_CONNECTIONS - props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); props.put(PHOENIX_INDEX_CDC_CONSUMER_ENABLED, Boolean.toString(false)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectWithRegionMovesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectWithRegionMovesIT.java index c2ffbc30a57..0603eb3c72c 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectWithRegionMovesIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectWithRegionMovesIT.java @@ -86,10 +86,6 @@ public static synchronized void doSetup() throws Exception { // An hour - inherited from ParallelStatsDisabledIT props.put(BaseScannerRegionObserverConstants.PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY, Integer.toString(60 * 60)); - // Postpone scans of SYSTEM.TASK indefinitely so as to prevent - // any addition to GLOBAL_OPEN_PHOENIX_CONNECTIONS - props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); props.put(QueryServices.PHOENIX_SERVER_PAGE_SIZE_MS, Long.toString(0)); props.put(QueryServices.TESTS_MINI_CLUSTER_NUM_REGION_SERVERS, String.valueOf(2)); props.put(HConstants.HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY, String.valueOf(1)); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java index f6f946257a4..3127073ed40 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java @@ -767,8 +767,16 @@ public void testAsyncRebuildAll() throws Exception { assertEquals(testTable, rs.getString(TABLE_NAME)); assertFalse(rs.next()); + // The SelfHealingTask scheduler is quiesced by default in mini-cluster ITs, so drive it + // manually to pick up the CREATED INDEX_REBUILD task and launch the rebuild job. + TestUtil.runSelfHealingTaskOnce(); + TestUtil.waitForIndexState(conn, indexName, PIndexState.ACTIVE); + // Once the index is ACTIVE the rebuild job has completed, drive the task again so it observes + // the finished job and transitions from STARTED to COMPLETED. + TestUtil.runSelfHealingTaskOnce(); + // Check task status String query = "SELECT * " + " FROM " + PhoenixDatabaseMetaData.SYSTEM_TASK_NAME + " WHERE " + PhoenixDatabaseMetaData.TASK_TYPE + " = " diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/PartialSystemCatalogIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/PartialSystemCatalogIndexIT.java index 8184f923962..97b01a3177c 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/PartialSystemCatalogIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/PartialSystemCatalogIndexIT.java @@ -197,8 +197,6 @@ public Configuration getConfiguration(Configuration confToClone) { } }); Configuration conf = HBaseFactoryProvider.getConfigurationFactory().getConfiguration(); - conf.set(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); - conf.set(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); hbaseTestUtil = new HBaseTestingUtility(conf); setUpConfigForMiniCluster(conf); conf.set(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, @@ -214,8 +212,6 @@ public Configuration getConfiguration(Configuration confToClone) { Integer.toString(0)); put(QueryServices.PHOENIX_VIEW_TTL_ENABLED, Boolean.toString(true)); put(QueryServices.PHOENIX_VIEW_TTL_TENANT_VIEWS_PER_SCAN_LIMIT, String.valueOf(1)); - put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); - put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); } }; diff --git a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/BasePhoenixMetricsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/BasePhoenixMetricsIT.java index fe059f8451f..b38a6ab7e6f 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/BasePhoenixMetricsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/BasePhoenixMetricsIT.java @@ -59,8 +59,6 @@ public abstract class BasePhoenixMetricsIT extends BaseTest { @BeforeClass public static synchronized void doSetup() throws Exception { Map props = Maps.newHashMapWithExpectedSize(3); - // Disable system task handling - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); // Phoenix Global client metrics are enabled by default // Enable request metric collection at the driver level props.put(QueryServices.COLLECT_REQUEST_LEVEL_METRICS, String.valueOf(true)); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/IndexMetricsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/IndexMetricsIT.java index 0d4c7ecba51..715bec2ce40 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/IndexMetricsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/IndexMetricsIT.java @@ -47,7 +47,6 @@ public class IndexMetricsIT extends ParallelStatsDisabledIT { @BeforeClass public static synchronized void doSetup() throws Exception { Map props = Maps.newHashMapWithExpectedSize(3); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); // disable renewing leases as this will force spooling to happen. props.put(QueryServices.RENEW_LEASE_ENABLED, String.valueOf(false)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/MetadataMetricsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/MetadataMetricsIT.java index 93a112e2cf3..e92d9e93ea0 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/MetadataMetricsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/MetadataMetricsIT.java @@ -37,7 +37,6 @@ public class MetadataMetricsIT extends ParallelStatsDisabledIT { @BeforeClass public static void setup() throws Exception { Map props = Maps.newHashMapWithExpectedSize(3); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); // disable renewing leases as this will force spooling to happen. props.put(QueryServices.RENEW_LEASE_ENABLED, String.valueOf(false)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/connectionqueryservice/ConnectionQueryServicesMetricsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/connectionqueryservice/ConnectionQueryServicesMetricsIT.java index 57791072cda..3caea05dc46 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/connectionqueryservice/ConnectionQueryServicesMetricsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/connectionqueryservice/ConnectionQueryServicesMetricsIT.java @@ -118,8 +118,6 @@ public Configuration getConfiguration(Configuration confToClone) { } }); Configuration conf = HBaseFactoryProvider.getConfigurationFactory().getConfiguration(); - conf.set(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); - conf.set(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); conf.set(PHOENIX_INDEX_CDC_CONSUMER_ENABLED, Boolean.toString(false)); hbaseTestUtil = new HBaseTestingUtility(conf); setUpConfigForMiniCluster(conf); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/query/MetaDataCachingIT.java b/phoenix-core/src/it/java/org/apache/phoenix/query/MetaDataCachingIT.java index c84d62c76a0..616a4e2afc3 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/query/MetaDataCachingIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/query/MetaDataCachingIT.java @@ -59,15 +59,12 @@ public class MetaDataCachingIT extends BaseTest { @BeforeClass public static synchronized void doSetup() throws Exception { Map props = Maps.newHashMapWithExpectedSize(1); - // We set here a tiny cache to verify that even if the total size of the cache is just enough to - // hold - // system tables and Phoenix is still functional. Please note the cache weight for system tables - // is set to - // zero to allow insertion of system tables even when the cache reaches its maximum weight. + // We set here a tiny cache to verify that even if the total size of the cache is just enough + // to hold system tables and Phoenix is still functional. Please note the cache weight for + // system tables is set to zero to allow insertion of system tables even when the cache reaches + // its maximum weight. props.put(QueryServices.MAX_CLIENT_METADATA_CACHE_SIZE_ATTRIB, "50000"); props.put(QueryServices.CLIENT_CACHE_ENCODING, "object"); - props.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); - props.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.toString(Long.MAX_VALUE)); props.put(PHOENIX_INDEX_CDC_CONSUMER_ENABLED, Boolean.toString(false)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } 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 e2e3afedef2..ee80d66fe31 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 @@ -579,6 +579,10 @@ public static Configuration setUpConfigForMiniCluster(Configuration conf, conf.set(IndexManagementUtil.WAL_EDIT_CODEC_CLASS_KEY, "org.apache.hadoop.hbase.regionserver.wal.IndexedWALEditCodec"); + if (conf.get(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB) == null) { + conf.setLong(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB, Long.MAX_VALUE); + } + // This results in processing one row at a time in each next operation of the aggregate region // scanner, i.e., one row pages. In other words, 0ms page allows only one row to be processed // within one page; 0ms page is equivalent to one-row page diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java index 69a191b5c2d..05db4d4e8dc 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java @@ -87,6 +87,7 @@ import org.apache.hadoop.hbase.client.TableDescriptor; import org.apache.hadoop.hbase.client.TableDescriptorBuilder; import org.apache.hadoop.hbase.client.coprocessor.Batch; +import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.filter.Filter; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.ipc.CoprocessorRpcUtils.BlockingRpcCallback; @@ -104,6 +105,7 @@ import org.apache.phoenix.compile.SubqueryRewriter; import org.apache.phoenix.compile.SubselectRewriter; import org.apache.phoenix.coprocessor.CompactionScanner; +import org.apache.phoenix.coprocessor.TaskRegionObserver; import org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearCacheRequest; import org.apache.phoenix.coprocessor.generated.MetaDataProtos.ClearCacheResponse; import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService; @@ -139,6 +141,7 @@ import org.apache.phoenix.parse.LikeParseNode.LikeType; import org.apache.phoenix.parse.SQLParser; import org.apache.phoenix.parse.SelectStatement; +import org.apache.phoenix.query.BaseTest; import org.apache.phoenix.query.ConnectionQueryServices; import org.apache.phoenix.query.KeyRange; import org.apache.phoenix.query.QueryConstants; @@ -1152,6 +1155,20 @@ public static void waitForIndexRebuild(Connection conn, String fullIndexName, waitForIndexState(conn, fullIndexName, indexState, 0L); } + /** + * Runs a single synchronous tick of {@link TaskRegionObserver.SelfHealingTask} against the + * SYSTEM.TASK region on the running mini-cluster. + */ + public static void runSelfHealingTaskOnce() throws Exception { + RegionCoprocessorEnvironment taskRegionEnvironment = BaseTest.getUtility() + .getRSForFirstRegionInTable(PhoenixDatabaseMetaData.SYSTEM_TASK_HBASE_TABLE_NAME) + .getRegions(PhoenixDatabaseMetaData.SYSTEM_TASK_HBASE_TABLE_NAME).get(0).getCoprocessorHost() + .findCoprocessorEnvironment(TaskRegionObserver.class.getName()); + TaskRegionObserver.SelfHealingTask task = new TaskRegionObserver.SelfHealingTask( + taskRegionEnvironment, QueryServicesOptions.DEFAULT_TASK_HANDLING_MAX_INTERVAL_MS); + task.run(); + } + private static class IndexStateCheck { public final PIndexState indexState; public final Long indexDisableTimestamp; From 12376efc680630dede6b7f1708da7c96eed5986e Mon Sep 17 00:00:00 2001 From: Andrew Purtell Date: Mon, 29 Jun 2026 11:57:06 -0700 Subject: [PATCH 2/2] Fix spotless nit --- .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java index 22833e24945..e70aba774ff 100644 --- a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java +++ b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java @@ -4923,9 +4923,9 @@ public MutationState addColumn(PTable table, List origColumnDefs, /** * To check if TTL is defined at any of the child below we are checking it at * {@link org.apache.phoenix.coprocessor.MetaDataEndpointImpl#mutateColumn(List, ColumnMutator, int, PTable, PTable, boolean)} - * level where in function - * {@link org.apache.phoenix.coprocessor.MetaDataEndpointImpl# validateIfMutationAllowedOnParent(PTable, List, PTableType, long, byte[], byte[], byte[], List, int)} - * we are already traversing through allDescendantViews. + * level where in function {@link org.apache.phoenix.coprocessor.MetaDataEndpointImpl# + * validateIfMutationAllowedOnParent(PTable, List, PTableType, long, byte[], byte[], + * byte[], List, int)} we are already traversing through allDescendantViews. */ }