[
https://issues.apache.org/jira/browse/PHOENIX-7537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17935588#comment-17935588
]
Istvan Toth commented on PHOENIX-7537:
--------------------------------------
Phoenix should accept all ZK URLs.
However, the Phoenix URL components are delimited with colons, which conflicts
with the colons used in new-stlye ZK quorums.
So if the normalized ZK quorum is
"host1:2181,host2:2181,host3:2182" and this is used without escaping in the
URL,
Phoenix will intepret 'host1' as the quorum host list, the first '2181' as the
quorum port, 'host2' as the ZK root node, etc.
> Well formed URLs created by ZKConnectionInfo.create() throw Malformed
> connection url exception.
> -----------------------------------------------------------------------------------------------
>
> Key: PHOENIX-7537
> URL: https://issues.apache.org/jira/browse/PHOENIX-7537
> Project: Phoenix
> Issue Type: Bug
> Reporter: Jacob Isaac
> Priority: Major
>
> @Test
> public void testMalformedZKConnection() throws SQLException {
> Configuration config =
> HBaseFactoryProvider.getConfigurationFactory().getConfiguration();
> String defaultQuorum = config.get(HConstants.ZOOKEEPER_QUORUM);
> for (String protocol : new String[] \{ "phoenix", "phoenix+zk" }) {
> String[] urls = new String[] {
> "v1,v2,v3:2181:/hbase",
> "jdbc:" + protocol + ":localhost",
> "jdbc:" + protocol + ":localhost:2181,localhost:12181:/hbase",
> "jdbc:" + protocol + ":v1,v2,v3:2181:/hbase",
> };
> for (String url : urls) {
> try {
> ZKConnectionInfo
> info =
> (ZKConnectionInfo) ConnectionInfo.create(url, null, null);
> System.out.println("1.Successfully connected to " + url + " , " +
> info.getZkHosts());
> {color:#FF0000}*// Passing the normalized url (info.getZkHosts()) from above
> again into Connection.create fails*{color}
> {color:#FF0000}*// for some formats.*{color}
> ZKConnectionInfo
> info2 =
> (ZKConnectionInfo) ConnectionInfo.create(info.getZkHosts(), null, null);
> System.out.println("2.Successfully connected to " + url + " , " +
> info.getZkHosts());
> } catch (SQLException sqle) {
> System.out.println(sqle.getMessage());
> }
> }
> }
> }
--
This message was sent by Atlassian Jira
(v8.20.10#820010)