Skip to content

PHOENIX-7848. Use ZK TLS properties from HBase config if present#2467

Open
anmolnar wants to merge 2 commits into
apache:masterfrom
anmolnar:PHOENIX-7848
Open

PHOENIX-7848. Use ZK TLS properties from HBase config if present#2467
anmolnar wants to merge 2 commits into
apache:masterfrom
anmolnar:PHOENIX-7848

Conversation

@anmolnar
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Parse ZooKeeper TLS properties from hbase-site.xml and add them to sqlline command line args.

Why are the changes needed?

Phoenix sqlline thick client is unable to connect to TLS-only ZooKeeper ensemble.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Locally.

Was this patch authored or co-authored using generative AI tooling?

No.

Comment thread bin/phoenix_utils.py
'-Dzookeeper.ssl.trustStore.location=' + zkcfg['ssl.trustStore.location'] + ' ' + \
'-Dzookeeper.ssl.trustStore.type=' + zkcfg['ssl.trustStore.type'] + ' ' + \
'-Dzookeeper.ssl.trustStore.password=' + zkcfg['ssl.trustStore.password'] + ' '

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add Exception handling to this?
We want to continue if there is some problem with parsing the zookeeper parameters.

Please add a default "" value to zk_tls_args in case we don't have hbase.zookeeper.property.client.secure property.

Copy link
Copy Markdown
Contributor Author

@anmolnar anmolnar May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default "" doesn't make any difference for this field. The field will be undefined. We have two options: use the getattr call as below, or define zk_tls_args at top level of this file.

Certainly I can add exception handler, but there's no exception handling anywhere else in this file. Does it make sense?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, yes
There are much more thinks that could go wrong here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the later option, but I other variables are not defined at top level of the file, just with global

Copy link
Copy Markdown
Contributor

@richardantal richardantal May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There could be better error when some of the keys are missing

Comment thread bin/sqlline.py Outdated

java_cmd = phoenix_utils.java + ' ' + phoenix_utils.jvm_module_flags + \
' ' + opts + \
' ' + getattr(phoenix_utils, "zk_tls_args", "") + \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we make sure zk_tls_args has some value, we could have phoenix_utils.zk_tls_args here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we cannot. If it doesn't get any value in the utils, it will be undefined and this code would throw an exception (tested).

@anmolnar
Copy link
Copy Markdown
Contributor Author

@richardantal I moved zk_tls_args to module level in order to be defined at all times.

I'm not sure about the exception handler. What should be the logic inside the exception handler? I don't want the error to be swallowed and ignored, because if there's anything wrong with the configuration, the tool should refuse to work.

Comment thread bin/phoenix_utils.py
for prop in root.findall("property")
if prop.find("name").text.startswith(zk_hbase_prefix)
}
if zkcfg.get('client.secure').lower() == 'true':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check if 'client.secure' in zkcfg too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants