From 381a2e5523674edaec42b6f28701365042fb336f Mon Sep 17 00:00:00 2001 From: Jing Yu Date: Thu, 23 Jul 2026 12:43:21 -0700 Subject: [PATCH 1/6] PHOENIX-7964: Wait for Phoenix system tables to initialize before starting REST server Before starting the REST server in integration tests, ensure Phoenix system tables are fully initialized by calling TestUtils.awaitPhoenixReady(). This eliminates the race condition that caused intermittent test failures with: org.apache.phoenix.exception.PhoenixIOException: SYSTEM.CATALOG Caused by: org.apache.hadoop.hbase.TableNotFoundException: SYSTEM.CATALOG The fix adds TestUtils.awaitPhoenixReady(url) calls to all 82 integration test classes, either directly in their @BeforeClass methods or through inheritance from base classes like BaseSegmentScanIT, KclTestBase, UpdateItemBaseTests, and SegmentScanIT. The awaitPhoenixReady() method polls for up to 30 seconds (vs RESTServer's 5 seconds) for Phoenix to become ready, providing sufficient time for SYSTEM.CATALOG initialization even on slow CI workers. Changes: - Added TestUtils.awaitPhoenixReady() calls to 58 integration test classes - Fixed DeleteTableIT to construct Phoenix JDBC URL before REST server initialization - 24 additional test classes inherit the fix through base class inheritance - Total coverage: 82/82 integration test classes --- .../java/org/apache/phoenix/ddb/AccessKeyAuthFilterIT.java | 7 ++++++- .../java/org/apache/phoenix/ddb/BaseSegmentScanIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/BatchGetItem2IT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/BatchGetItemIT.java | 2 ++ .../java/org/apache/phoenix/ddb/BatchWriteItem2IT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/BatchWriteItemIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/BinaryEndToEndIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/BinaryStreamsIT.java | 2 ++ .../java/org/apache/phoenix/ddb/ConditionalPutItem2IT.java | 2 ++ .../java/org/apache/phoenix/ddb/ConditionalPutItemIT.java | 2 ++ .../java/org/apache/phoenix/ddb/ConnectionConfigIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/CreateTableIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/DeleteItem2IT.java | 1 + .../src/test/java/org/apache/phoenix/ddb/DeleteItemIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/DeleteTableIT.java | 5 +++++ .../apache/phoenix/ddb/DescribeContinuousBackupsIT.java | 1 + .../test/java/org/apache/phoenix/ddb/DescribeStreamIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/DescribeTableIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/GetItemIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/GetRecordsIT.java | 1 + .../apache/phoenix/ddb/GetRecordsMultipleProducersIT.java | 3 +++ .../org/apache/phoenix/ddb/GetRecordsSequenceNumberIT.java | 2 ++ .../apache/phoenix/ddb/GetRecordsShardIteratorTypeIT.java | 1 + .../org/apache/phoenix/ddb/GetRecordsShardLineageIT.java | 1 + .../org/apache/phoenix/ddb/GetRecordsStreamTypeIT.java | 2 ++ .../java/org/apache/phoenix/ddb/GetRecordsTTLExpiryIT.java | 2 ++ .../java/org/apache/phoenix/ddb/GetShardIteratorIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/JMXMetricsIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/ListStreamsIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/ListTablesIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/MappedTableIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/MiscIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/PutItemIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/Query2IT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/QueryIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/QueryIndex1IT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/QueryIndex2IT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/QueryIndex3IT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/QueryIndex4IT.java | 2 ++ .../apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java | 5 +++++ .../java/org/apache/phoenix/ddb/QueryProjectionIT.java | 2 ++ .../org/apache/phoenix/ddb/RandomizedIndexParityIT.java | 3 +++ .../java/org/apache/phoenix/ddb/ReturnItemsLimitIT.java | 2 ++ .../org/apache/phoenix/ddb/ScanExclusiveStartKeyIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/ScanIndex2IT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java | 2 ++ .../apache/phoenix/ddb/ScanIndexExclusiveStartKeyIT.java | 1 + .../src/test/java/org/apache/phoenix/ddb/ScanIndexIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/ScanTable2IT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/ScanTableIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/TimeToLiveIT.java | 2 ++ .../org/apache/phoenix/ddb/UpdateContinuousBackupsIT.java | 2 ++ .../apache/phoenix/ddb/UpdateExpressionValidationIT.java | 5 +++++ .../java/org/apache/phoenix/ddb/UpdateItemBaseTests.java | 2 ++ .../phoenix/ddb/UpdateItemReturnValuesConcurrentIT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/UpdateTable2IT.java | 2 ++ .../test/java/org/apache/phoenix/ddb/UpdateTableIT.java | 2 ++ .../src/test/java/org/apache/phoenix/ddb/ValidationIT.java | 2 ++ 58 files changed, 125 insertions(+), 1 deletion(-) diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/AccessKeyAuthFilterIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/AccessKeyAuthFilterIT.java index 8088ed1..b95183d 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/AccessKeyAuthFilterIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/AccessKeyAuthFilterIT.java @@ -48,6 +48,7 @@ import org.apache.phoenix.ddb.rest.util.Constants; import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl; import org.apache.phoenix.jdbc.PhoenixDriver; +import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.ServerUtil; import static org.apache.phoenix.query.BaseTest.setUpConfigForMiniCluster; @@ -89,9 +90,13 @@ public static void setUpBeforeClass() throws Exception { utility = new HBaseTestingUtility(conf); setUpConfigForMiniCluster(conf); utility.startMiniCluster(); - + String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); + String url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + conf.set(Constants.AUTH_CREDENTIAL_STORE_CLASS, TestCredentialStore.class.getName()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(conf); restServer.run(); serverAddress = restServer.getServerAddress(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BaseSegmentScanIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BaseSegmentScanIT.java index 750fbb6..4d15b59 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BaseSegmentScanIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BaseSegmentScanIT.java @@ -92,6 +92,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItem2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItem2IT.java index ac300ea..b72fba6 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItem2IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItem2IT.java @@ -116,6 +116,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItemIT.java index f7a0257..a760b92 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItemIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchGetItemIT.java @@ -81,6 +81,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItem2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItem2IT.java index 75b6ea2..24c666c 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItem2IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItem2IT.java @@ -105,6 +105,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItemIT.java index 12e413b..195eebb 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItemIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BatchWriteItemIT.java @@ -83,6 +83,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryEndToEndIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryEndToEndIT.java index fa519b0..3e85e3d 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryEndToEndIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryEndToEndIT.java @@ -130,6 +130,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryStreamsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryStreamsIT.java index 7470e24..b831d79 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryStreamsIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/BinaryStreamsIT.java @@ -78,6 +78,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); phoenixDBClientV2 = LocalDynamoDB.createV2Client("http://" + restServer.getServerAddress()); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItem2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItem2IT.java index 4948577..19d3e5b 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItem2IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItem2IT.java @@ -80,6 +80,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItemIT.java index 6830f1e..f069925 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItemIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConditionalPutItemIT.java @@ -91,6 +91,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java index ebe96ea..9b52e22 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java @@ -62,6 +62,8 @@ public static void initialize() throws Exception { utility.startMiniCluster(); String zkQuorum = "127.0.0.1:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); LOGGER.info("started {} on port {}", restServer.getClass().getName(), restServer.getPort()); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/CreateTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/CreateTableIT.java index bd5ad34..98914cf 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/CreateTableIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/CreateTableIT.java @@ -113,6 +113,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItem2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItem2IT.java index 91c25dc..8a2a561 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItem2IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItem2IT.java @@ -94,6 +94,7 @@ public static void initialize() throws Exception { utility.startMiniCluster(); String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItemIT.java index 6265d34..259b899 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItemIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteItemIT.java @@ -92,6 +92,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteTableIT.java index b43d293..e2bd418 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteTableIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DeleteTableIT.java @@ -41,6 +41,7 @@ import org.apache.phoenix.ddb.rest.RESTServer; import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl; import org.apache.phoenix.jdbc.PhoenixDriver; +import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.ServerUtil; import org.junit.Assert; @@ -70,6 +71,10 @@ public static void initialize() throws Exception { setUpConfigForMiniCluster(conf); utility.startMiniCluster(); + String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); + String url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + + TestUtils.awaitPhoenixReady(url); restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeContinuousBackupsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeContinuousBackupsIT.java index 1bae2d6..090bd33 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeContinuousBackupsIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeContinuousBackupsIT.java @@ -86,6 +86,7 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeStreamIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeStreamIT.java index cce4974..44b6ea4 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeStreamIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeStreamIT.java @@ -106,6 +106,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeTableIT.java index f45db9e..d39ebf0 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeTableIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/DescribeTableIT.java @@ -85,6 +85,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetItemIT.java index 73fcc8f..531aada 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetItemIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetItemIT.java @@ -90,6 +90,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsIT.java index de49648..4e63322 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsIT.java @@ -121,6 +121,7 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java index 6f910fc..14ef724 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java @@ -134,6 +134,9 @@ public static void initialize() throws Exception { restServer = new RESTServer(utility.getConfiguration()); restServer.run(); + String url = "http://" + restServer.getServerAddress(); + TestUtils.awaitPhoenixReady(url); + LOGGER.info("started {} on port {}", restServer.getClass().getName(), restServer.getPort()); phoenixDBClientV2 = LocalDynamoDB.createV2Client("http://" + restServer.getServerAddress()); phoenixDBStreamsClientV2 = LocalDynamoDB.createV2StreamsClient("http://" + restServer.getServerAddress()); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsSequenceNumberIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsSequenceNumberIT.java index af63056..d45bd10 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsSequenceNumberIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsSequenceNumberIT.java @@ -104,6 +104,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardIteratorTypeIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardIteratorTypeIT.java index d8b9256..304d669 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardIteratorTypeIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardIteratorTypeIT.java @@ -103,6 +103,7 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardLineageIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardLineageIT.java index feb9220..c609679 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardLineageIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsShardLineageIT.java @@ -103,6 +103,7 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsStreamTypeIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsStreamTypeIT.java index 6856e4d..cbaa485 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsStreamTypeIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsStreamTypeIT.java @@ -124,6 +124,8 @@ public static void initialize() throws Exception { utility.startMiniCluster(); String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + DriverManager.registerDriver(new PhoenixTestDriver()); restServer = new RESTServer(utility.getConfiguration()); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsTTLExpiryIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsTTLExpiryIT.java index e0d9da2..10dd954 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsTTLExpiryIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsTTLExpiryIT.java @@ -112,6 +112,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetShardIteratorIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetShardIteratorIT.java index e861f5e..7949f3b 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetShardIteratorIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetShardIteratorIT.java @@ -103,6 +103,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/JMXMetricsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/JMXMetricsIT.java index e74e56f..0a813f7 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/JMXMetricsIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/JMXMetricsIT.java @@ -75,6 +75,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListStreamsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListStreamsIT.java index 847ce78..2dff001 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListStreamsIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListStreamsIT.java @@ -80,6 +80,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListTablesIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListTablesIT.java index ce10451..d40dd2e 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListTablesIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ListTablesIT.java @@ -71,6 +71,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MappedTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MappedTableIT.java index 5033dd4..8628cf2 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MappedTableIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MappedTableIT.java @@ -89,6 +89,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MiscIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MiscIT.java index 67d20f5..14dea13 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MiscIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/MiscIT.java @@ -87,6 +87,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/PutItemIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/PutItemIT.java index 61739a4..ded36ae 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/PutItemIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/PutItemIT.java @@ -87,6 +87,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Query2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Query2IT.java index 6c948bd..b5837f1 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Query2IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/Query2IT.java @@ -84,6 +84,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIT.java index aa7c804..a128fc3 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIT.java @@ -80,6 +80,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex1IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex1IT.java index e44f3a4..2de3257 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex1IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex1IT.java @@ -81,6 +81,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex2IT.java index e966128..ff5a95e 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex2IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex2IT.java @@ -85,6 +85,8 @@ public static void initialize() throws Exception { utility.startMiniCluster(); String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + DriverManager.registerDriver(new PhoenixTestDriver()); restServer = new RESTServer(utility.getConfiguration()); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex3IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex3IT.java index fefeb64..c96ff3d 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex3IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex3IT.java @@ -86,6 +86,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex4IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex4IT.java index 51660c8..ff5ac61 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex4IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndex4IT.java @@ -77,6 +77,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java index 8c60f1f..c8d9f5b 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java @@ -46,6 +46,7 @@ import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl; import org.apache.phoenix.jdbc.PhoenixDriver; import org.apache.phoenix.jdbc.PhoenixTestDriver; +import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.ServerUtil; import static org.apache.phoenix.ddb.TestUtils.verifyItemsEqual; @@ -99,7 +100,11 @@ public static void setup() throws Exception { utility = new HBaseTestingUtility(conf); setUpConfigForMiniCluster(conf); utility.startMiniCluster(); + String zkQuorum = "127.0.0.1:" + utility.getZkCluster().getClientPort(); + String url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); dynamoDbClient = LocalDynamoDbTestBase.localDynamoDb().createV2Client(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryProjectionIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryProjectionIT.java index 68b5743..baa9483 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryProjectionIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryProjectionIT.java @@ -77,6 +77,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/RandomizedIndexParityIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/RandomizedIndexParityIT.java index bbd71c7..f0fc46a 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/RandomizedIndexParityIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/RandomizedIndexParityIT.java @@ -107,6 +107,9 @@ public static void initialize() throws Exception { utility.startMiniCluster(); DriverManager.registerDriver(new PhoenixTestDriver()); + String url = "jdbc:phoenix:localhost:" + utility.getZkCluster().getClientPort(); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ReturnItemsLimitIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ReturnItemsLimitIT.java index 409acfc..c20bb44 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ReturnItemsLimitIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ReturnItemsLimitIT.java @@ -109,6 +109,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanExclusiveStartKeyIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanExclusiveStartKeyIT.java index 66fbf1c..ccda4b8 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanExclusiveStartKeyIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanExclusiveStartKeyIT.java @@ -150,6 +150,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex2IT.java index 23fc0ba..9a6c4e7 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex2IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex2IT.java @@ -86,6 +86,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java index fceca52..733c940 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndex3IT.java @@ -81,6 +81,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexExclusiveStartKeyIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexExclusiveStartKeyIT.java index 58b20c3..dd8d594 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexExclusiveStartKeyIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexExclusiveStartKeyIT.java @@ -156,6 +156,7 @@ public static void initialize() throws Exception { String url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexIT.java index 877ca71..d707947 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanIndexIT.java @@ -78,6 +78,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTable2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTable2IT.java index c3ce5ed..6bf9187 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTable2IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTable2IT.java @@ -82,6 +82,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTableIT.java index 2204710..a7b9b81 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTableIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ScanTableIT.java @@ -80,6 +80,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TimeToLiveIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TimeToLiveIT.java index df85747..7c4c1e7 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TimeToLiveIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/TimeToLiveIT.java @@ -88,6 +88,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateContinuousBackupsIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateContinuousBackupsIT.java index c1eda09..4a49335 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateContinuousBackupsIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateContinuousBackupsIT.java @@ -84,6 +84,8 @@ public static void initialize() throws Exception { utility.startMiniCluster(); String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + DriverManager.registerDriver(new PhoenixTestDriver()); restServer = new RESTServer(utility.getConfiguration()); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateExpressionValidationIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateExpressionValidationIT.java index d6f8b1c..22c44fe 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateExpressionValidationIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateExpressionValidationIT.java @@ -52,6 +52,7 @@ import org.apache.phoenix.ddb.rest.RESTServer; import org.apache.phoenix.end2end.ServerMetadataCacheTestImpl; import org.apache.phoenix.jdbc.PhoenixDriver; +import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.ServerUtil; import static org.apache.phoenix.query.BaseTest.setUpConfigForMiniCluster; @@ -83,6 +84,10 @@ public static void initialize() throws Exception { utility.startMiniCluster(); + String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); + String url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemBaseTests.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemBaseTests.java index aa085ed..b818311 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemBaseTests.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemBaseTests.java @@ -105,6 +105,8 @@ public static void initialize() throws Exception { url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemReturnValuesConcurrentIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemReturnValuesConcurrentIT.java index c6f2ec1..95b0e8a 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemReturnValuesConcurrentIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateItemReturnValuesConcurrentIT.java @@ -99,6 +99,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTable2IT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTable2IT.java index 4943d67..f53e492 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTable2IT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTable2IT.java @@ -91,6 +91,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTableIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTableIT.java index de8000b..67af22c 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTableIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/UpdateTableIT.java @@ -96,6 +96,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ValidationIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ValidationIT.java index 455b87e..cfb2db6 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ValidationIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ValidationIT.java @@ -72,6 +72,8 @@ public static void initialize() throws Exception { String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); From 52e2a93bb9a6547c371df94deb47ba5dab3fec60 Mon Sep 17 00:00:00 2001 From: Jing Yu Date: Thu, 23 Jul 2026 15:28:58 -0700 Subject: [PATCH 2/6] build JDBC URL from the ZK quorum --- .../apache/phoenix/ddb/GetRecordsMultipleProducersIT.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java index 14ef724..f5f303f 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/GetRecordsMultipleProducersIT.java @@ -27,6 +27,7 @@ import org.apache.phoenix.jdbc.PhoenixTestDriver; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.thirdparty.com.google.common.collect.Maps; +import org.apache.phoenix.util.PhoenixRuntime; import org.apache.phoenix.util.ReadOnlyProps; import org.apache.phoenix.util.ServerUtil; import org.junit.AfterClass; @@ -129,14 +130,15 @@ public static void initialize() throws Exception { setUpConfigForMiniCluster(conf, new ReadOnlyProps(props.entrySet().iterator())); utility.startMiniCluster(); + String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); + String url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); + TestUtils.awaitPhoenixReady(url); + restServer = new RESTServer(utility.getConfiguration()); restServer.run(); - String url = "http://" + restServer.getServerAddress(); - TestUtils.awaitPhoenixReady(url); - LOGGER.info("started {} on port {}", restServer.getClass().getName(), restServer.getPort()); phoenixDBClientV2 = LocalDynamoDB.createV2Client("http://" + restServer.getServerAddress()); phoenixDBStreamsClientV2 = LocalDynamoDB.createV2StreamsClient("http://" + restServer.getServerAddress()); From 9695249aa99976bdd7fded87e24ae527cf75cb68 Mon Sep 17 00:00:00 2001 From: Jing Yu Date: Mon, 27 Jul 2026 12:50:46 -0700 Subject: [PATCH 3/6] Remove awaitPhoenixReady() from ConnectionConfigIT only --- .../src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java | 1 - 1 file changed, 1 deletion(-) diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java index 9b52e22..70f975a 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java @@ -62,7 +62,6 @@ public static void initialize() throws Exception { utility.startMiniCluster(); String zkQuorum = "127.0.0.1:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; - TestUtils.awaitPhoenixReady(url); restServer = new RESTServer(utility.getConfiguration()); restServer.run(); From 37c55ef9f4f2f75aa0fe0b541e36952fd71203a0 Mon Sep 17 00:00:00 2001 From: Jing Yu Date: Mon, 27 Jul 2026 15:40:16 -0700 Subject: [PATCH 4/6] Move awaitPhoenixReady before REST server startup in KclTestBase --- .../java/org/apache/phoenix/ddb/kcl/KclTestBase.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/kcl/KclTestBase.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/kcl/KclTestBase.java index 468c4bd..47368e2 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/kcl/KclTestBase.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/kcl/KclTestBase.java @@ -116,13 +116,14 @@ public static void startCluster() throws Exception { jdbcUrl = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); - restServer = new RESTServer(utility.getConfiguration()); - restServer.run(); - - // Probe Phoenix is queryable now that the REST server has bootstrapped it; absorbs - // the SYSTEM.CATALOG initialization race the first REST request would otherwise hit + // Probe Phoenix is queryable before starting REST server; absorbs + // the SYSTEM.CATALOG initialization race that validateConnection() would otherwise hit // on a slow CI worker. TestUtils.awaitPhoenixReady(jdbcUrl); + + restServer = new RESTServer(utility.getConfiguration()); + restServer.run(); + restEndpoint = "http://" + restServer.getServerAddress(); LOGGER.info("KclTestBase: REST server up at {}, DDB at {}", restEndpoint, LocalDynamoDbTestBase.localDynamoDb().getEndpoint()); From ad87e43f686b7c74211d6e69f891bef451097b05 Mon Sep 17 00:00:00 2001 From: Jing Yu Date: Mon, 27 Jul 2026 21:35:44 -0700 Subject: [PATCH 5/6] change to localhost --- .../test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java | 2 +- .../org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java index 70f975a..10b0e84 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java @@ -60,7 +60,7 @@ public static void initialize() throws Exception { utility = new HBaseTestingUtility(conf); setUpConfigForMiniCluster(conf); utility.startMiniCluster(); - String zkQuorum = "127.0.0.1:" + utility.getZkCluster().getClientPort(); + String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; restServer = new RESTServer(utility.getConfiguration()); diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java index c8d9f5b..53b307a 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/QueryIndexExclusiveStartKeyIT.java @@ -100,7 +100,7 @@ public static void setup() throws Exception { utility = new HBaseTestingUtility(conf); setUpConfigForMiniCluster(conf); utility.startMiniCluster(); - String zkQuorum = "127.0.0.1:" + utility.getZkCluster().getClientPort(); + String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); String url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; DriverManager.registerDriver(new PhoenixTestDriver()); TestUtils.awaitPhoenixReady(url); From fb82cf55d68a86d60c39d6a3de765a822e0ed238 Mon Sep 17 00:00:00 2001 From: Jing Yu Date: Fri, 31 Jul 2026 14:19:48 -0700 Subject: [PATCH 6/6] revert change in ConnectionConfigIT --- .../test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java index 10b0e84..70f975a 100644 --- a/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java +++ b/phoenix-ddb-rest/src/test/java/org/apache/phoenix/ddb/ConnectionConfigIT.java @@ -60,7 +60,7 @@ public static void initialize() throws Exception { utility = new HBaseTestingUtility(conf); setUpConfigForMiniCluster(conf); utility.startMiniCluster(); - String zkQuorum = "localhost:" + utility.getZkCluster().getClientPort(); + String zkQuorum = "127.0.0.1:" + utility.getZkCluster().getClientPort(); url = PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + zkQuorum; restServer = new RESTServer(utility.getConfiguration());