Skip to content

HIVE-29636: Add SSL keystore auto-reloading for HiveServer2 WebUI#6514

Open
magnuma3 wants to merge 2 commits into
apache:masterfrom
magnuma3:ssl-auto-reload
Open

HIVE-29636: Add SSL keystore auto-reloading for HiveServer2 WebUI#6514
magnuma3 wants to merge 2 commits into
apache:masterfrom
magnuma3:ssl-auto-reload

Conversation

@magnuma3
Copy link
Copy Markdown

HIVE-29636

What changes were proposed in this pull request?

HiveServer2 WebUI's SslContextFactory is built once at startup, so renewing the SSL keystore requires restarting HS2

Watch the keystore file with Hadoop's FileMonitoringTimerTask and call SslContextFactory#reload(...) on mtime change. The daemon Timer is installed when SSL is on and is cancelled in HttpServer#stop(). Reload failures are logged and swallowed

Same pattern as HADOOP-16524, reusing its FileMonitoringTimerTask

Why are the changes needed?

Rotating WebUI SSL certificates currently requires an HS2 restart, which is increasingly painful as certificate lifetimes shorten. Hadoop's HttpServer2 already solved this via HADOOP-16524.

Does this PR introduce any user-facing change?

Yes — new opt-in ConfVar hive.server2.webui.keystore.reload.interval (default 60s, 0 disables). When the keystore file changes, the running HS2 picks up the new certificate within the interval; no restart needed. No API or schema changes.

How was this patch tested?

Added TestHttpServer

@sonarqubecloud
Copy link
Copy Markdown

private Server webServer;
private QueuedThreadPool threadPool;
private PortHandlerWrapper portHandlerWrapper;
private Optional<Timer> configurationChangeMonitor = Optional.empty();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i think name is very generic

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@deniskuzZ thank you for review. I changed it.

@magnuma3
Copy link
Copy Markdown
Author

magnuma3 commented Jun 1, 2026

test failure is not related to this patch.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants