Skip to content

Commit

Permalink
Use CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY instead of manual config
Browse files Browse the repository at this point in the history
  • Loading branch information
szucsvillo committed Feb 21, 2025
1 parent efa8679 commit e4bb6b3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static synchronized void setUp() throws Exception {
conf = hbaseTestUtil.getConfiguration();
setUpConfigForMiniCluster(conf);
conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/hbase-test");
conf.set("hbase.client.registry.impl", ZKConnectionInfo.ZK_REGISTRY_NAME);
conf.set(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionInfo.ZK_REGISTRY_NAME);
hbaseTestUtil.startMiniCluster();
Class.forName(PhoenixDriver.class.getName());
DriverManager.registerDriver(new PhoenixTestDriver());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
package org.apache.phoenix.end2end;

import org.apache.hadoop.hbase.HConstants;
import org.apache.phoenix.thirdparty.com.google.common.base.Throwables;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
Expand Down Expand Up @@ -72,7 +73,7 @@ public void testUpdateCacheFrequencyWithAddAndDropTable() throws Exception {
longRunningProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
longRunningProps.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.TRUE.toString());
longRunningProps.put("hbase.client.registry.impl", ZKConnectionInfo.ZK_REGISTRY_NAME);
longRunningProps.put(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionInfo.ZK_REGISTRY_NAME);

Connection conn1 = DriverManager.getConnection(url, longRunningProps);
String url2 = url + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + "LongRunningQueries";
Expand Down Expand Up @@ -139,7 +140,7 @@ public void testTableSentWhenIndexStateChanges() throws Throwable {
longRunningProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
longRunningProps.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.TRUE.toString());
longRunningProps.put("hbase.client.registry.impl", ZKConnectionInfo.ZK_REGISTRY_NAME);
longRunningProps.put(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionInfo.ZK_REGISTRY_NAME);
Connection conn1 = DriverManager.getConnection(url, longRunningProps);
String url2 = url + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + "LongRunningQueries";
Connection conn2 = DriverManager.getConnection(url2, longRunningProps);
Expand Down Expand Up @@ -175,7 +176,7 @@ public void testTableSentWhenIndexStateChanges() throws Throwable {
public void testUpdateCacheFrequencyWithAddColumn() throws Exception {
// Create connections 1 and 2
Properties longRunningProps = new Properties(); // Must update config before starting server
longRunningProps.put("hbase.client.registry.impl", ZKConnectionInfo.ZK_REGISTRY_NAME);
longRunningProps.put(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionInfo.ZK_REGISTRY_NAME);
Connection conn1 = DriverManager.getConnection(url, longRunningProps);
Connection conn2 = DriverManager.getConnection(url, longRunningProps);
conn1.setAutoCommit(true);
Expand Down Expand Up @@ -223,7 +224,7 @@ public void testUpdateCacheFrequencyWithAddAndDropIndex() throws Exception {
Properties longRunningProps = new Properties();
longRunningProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
longRunningProps.put("hbase.client.registry.impl", ZKConnectionInfo.ZK_REGISTRY_NAME);
longRunningProps.put(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionInfo.ZK_REGISTRY_NAME);
Connection conn1 = DriverManager.getConnection(url, longRunningProps);
String url2 = url + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + "LongRunningQueries";
Connection conn2 = DriverManager.getConnection(url2, longRunningProps);
Expand Down Expand Up @@ -275,7 +276,7 @@ public void testUpdateCacheFrequencyWithAddAndDropView() throws Exception {
Properties longRunningProps = new Properties();
longRunningProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
longRunningProps.put("hbase.client.registry.impl", ZKConnectionInfo.ZK_REGISTRY_NAME);
longRunningProps.put(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionInfo.ZK_REGISTRY_NAME);
Connection conn1 = DriverManager.getConnection(url, longRunningProps);
String url2 = url + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + "LongRunningQueries";
Connection conn2 = DriverManager.getConnection(url2, longRunningProps);
Expand Down Expand Up @@ -323,7 +324,7 @@ public void testUpdateCacheFrequencyWithCreateTableAndViewOnDiffConns() throws E
Properties longRunningProps = new Properties();
longRunningProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
longRunningProps.put("hbase.client.registry.impl", ZKConnectionInfo.ZK_REGISTRY_NAME);
longRunningProps.put(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionInfo.ZK_REGISTRY_NAME);
Connection conn1 = DriverManager.getConnection(url, longRunningProps);
String url2 = url + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR + "LongRunningQueries";
Connection conn2 = DriverManager.getConnection(url2, longRunningProps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.phoenix.end2end.NeedsOwnMiniClusterTest;
import org.apache.phoenix.log.ConnectionLimiter;
import org.apache.phoenix.query.ConfigurationFactory;
Expand Down Expand Up @@ -64,7 +65,7 @@ public static void doSetup() throws Exception {
conf.set(QueryServices.INTERNAL_CONNECTION_MAX_ALLOWED_CONNECTIONS, String.valueOf(20));
conf.set(PhoenixHAExecutorServiceProvider.HA_MAX_POOL_SIZE, String.valueOf(5));
conf.set(PhoenixHAExecutorServiceProvider.HA_MAX_QUEUE_SIZE, String.valueOf(30));
conf.set("hbase.client.registry.impl", ZKConnectionInfo.ZK_REGISTRY_NAME);
conf.set(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionInfo.ZK_REGISTRY_NAME);
return conf;
}

Expand All @@ -75,7 +76,7 @@ public static void doSetup() throws Exception {
conf.set(QueryServices.INTERNAL_CONNECTION_MAX_ALLOWED_CONNECTIONS, String.valueOf(20));
conf.set(PhoenixHAExecutorServiceProvider.HA_MAX_POOL_SIZE, String.valueOf(5));
conf.set(PhoenixHAExecutorServiceProvider.HA_MAX_QUEUE_SIZE, String.valueOf(30));
conf.set("hbase.client.registry.impl", ZKConnectionInfo.ZK_REGISTRY_NAME);
conf.set(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionInfo.ZK_REGISTRY_NAME);
Configuration copy = new Configuration(conf);
copy.addResource(confToClone);
return copy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.security.User;
import org.apache.hadoop.minikdc.MiniKdc;
import org.apache.hadoop.security.UserGroupInformation;
Expand Down Expand Up @@ -99,7 +100,7 @@ public static synchronized void setupKdc() throws Exception {
conf.set(CommonConfigurationKeys.HADOOP_SECURITY_AUTHENTICATION, "kerberos");
conf.set(User.HBASE_SECURITY_CONF_KEY, "kerberos");
conf.setBoolean(User.HBASE_SECURITY_AUTHORIZATION_CONF_KEY, true);
conf.set("hbase.client.registry.impl", ZKConnectionInfo.ZK_REGISTRY_NAME);
conf.set(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY, ZKConnectionInfo.ZK_REGISTRY_NAME);
UserGroupInformation.setConfiguration(conf);

// Clear the cached singletons so we can inject our own.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class PhoenixEmbeddedDriverTest {
public void testGetZKConnectionInfo() throws SQLException {
Configuration config = HBaseFactoryProvider.getConfigurationFactory().getConfiguration();
// Need to set explicitly for HBase 3.x
config.set("hbase.client.registry.impl",
config.set(HConstants.CLIENT_CONNECTION_REGISTRY_IMPL_CONF_KEY,
"org.apache.hadoop.hbase.client.ZKConnectionRegistry");
String defaultQuorum = config.get(HConstants.ZOOKEEPER_QUORUM);

Expand Down

0 comments on commit e4bb6b3

Please sign in to comment.