This is an automated email from the ASF dual-hosted git repository. virajjasani pushed a commit to branch 5.2 in repository https://gitbox.apache.org/repos/asf/phoenix.git
commit 8480406e3026158ee949b3ff49577038502777ad Author: Andrew Purtell <[email protected]> AuthorDate: Tue Jun 30 15:51:39 2026 -0700 PHOENIX-7826 MetadataGetTableReadLockIT wait for coprocessor swap to land (#2443) --- .../phoenix/end2end/MetadataGetTableReadLockIT.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 392e74ddbe..f2344fc8c9 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 @@ -23,6 +23,8 @@ import java.sql.DriverManager; import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.Region; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.coprocessor.MetaDataEndpointImpl; @@ -72,6 +74,7 @@ public class MetadataGetTableReadLockIT extends BaseTest { BlockingMetaDataEndpointImpl.setSleepSignal(sleepSignal); BlockingMetaDataEndpointImpl.setSleepDuration(SLEEP_DURATION); TestUtil.addCoprocessor(conn, "SYSTEM.CATALOG", BlockingMetaDataEndpointImpl.class); + waitForCoprocessorOnSystemCatalog(BlockingMetaDataEndpointImpl.class); // start thread-1 and wait for signal before it starts sleeping Thread t1 = getQueryThread(tableName); @@ -94,6 +97,23 @@ public class MetadataGetTableReadLockIT extends BaseTest { } } + private static void waitForCoprocessorOnSystemCatalog(Class<?> coprocessorClass) throws Exception { + final TableName sysCatalog = TableName.valueOf("SYSTEM.CATALOG"); + utility.waitFor(10000, 100, () -> { + List<HRegion> regions = utility.getHBaseCluster().getRegions(sysCatalog); + if (regions.isEmpty()) { + return false; + } + for (HRegion region : regions) { + if (region.getCoprocessorHost() + .findCoprocessor(coprocessorClass.getName()) == null) { + return false; + } + } + return true; + }); + } + private static Thread getQueryThread(String tableName) { Runnable runnable = () -> { try (Connection conn1 = DriverManager.getConnection(getUrl())) {
