Skip to content

Add working credentials configs for non cluster mode#27378

Draft
auden-woolfson wants to merge 1 commit intomasterfrom
hbo_credentials
Draft

Add working credentials configs for non cluster mode#27378
auden-woolfson wants to merge 1 commit intomasterfrom
hbo_credentials

Conversation

@auden-woolfson
Copy link
Contributor

@auden-woolfson auden-woolfson commented Mar 19, 2026

Description

Motivation and Context

Impact

Test Plan

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* ... 
* ... 

Hive Connector Changes
* ... 
* ... 

If release note is NOT required, use:

== NO RELEASE NOTE ==

Summary by Sourcery

Add configurable Redis username and password support for the Redis HBO provider and wire them into non-cluster Redis client creation.

New Features:

  • Introduce configuration properties for Redis username and password in the Redis HBO provider.
  • Support authenticated non-cluster Redis connections using optional username/password credentials.

@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Mar 19, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 19, 2026

Reviewer's Guide

Adds configurable Redis username/password credentials to RedisProviderConfig and updates non-cluster Redis client creation to build a RedisURI with optional authentication instead of using the raw server URI string.

Sequence diagram for non-cluster Redis client creation with optional credentials

sequenceDiagram
    participant Config as RedisProviderConfig
    participant Factory as RedisClusterAsyncCommandsFactory
    participant Builder as RedisURI_Builder
    participant Client as RedisClient

    Config-->>Factory: getRedisClient(redisProviderConfig)
    Factory->>Config: getServerUri()
    Config-->>Factory: serverUriString
    Factory->>Factory: parse serverUriString to serverUri
    Factory->>Builder: RedisURI.builder()
    Factory->>Builder: withHost(serverUri.host)
    Factory->>Builder: withPort(serverUri.port)

    Factory->>Config: getRedisUsername()
    Config-->>Factory: username or null
    Factory->>Config: getRedisPassword()
    Config-->>Factory: password or null

    alt password is present and username is present
        Factory->>Builder: withAuthentication(username, password)
    else password is present and username is null
        Factory->>Builder: withPassword(password)
    else password is null
        Factory->>Builder: no authentication
    end

    Factory->>Builder: build()
    Builder-->>Factory: redisUri
    Factory->>Client: create(redisUri)
    Client-->>Factory: redisClient
    Factory-->>Config: return redisClient
Loading

Class diagram for updated RedisProviderConfig and RedisClusterAsyncCommandsFactory

classDiagram
    class RedisProviderConfig {
        - long totalSetTimeoutMs
        - String credentialsPath
        - String redisPropertiesPath
        - String redisUsername
        - String redisPassword
        + boolean isClusterModeEnabled()
        + RedisProviderConfig setClusterModeEnabled(boolean value)
        + String getServerUri()
        + String getCredentialsPath()
        + RedisProviderConfig setRedisUsername(String value)
        + String getRedisUsername()
        + RedisProviderConfig setRedisPassword(String value)
        + String getRedisPassword()
    }

    class RedisClusterAsyncCommandsFactory {
        + RedisClusterClient getRedisClusterClient(RedisProviderConfig redisProviderConfig)
        + RedisClient getRedisClient(RedisProviderConfig redisProviderConfig)
        + RedisClusterAsyncCommands getRedisClusterAsyncCommands(RedisProviderConfig redisProviderConfig, RedisClusterClient redisClusterClient)
    }

    class RedisClient {
        + create(RedisURI redisUri)
    }

    class RedisURI {
        <<builder>>
        + builder() RedisURI_Builder
    }

    class RedisURI_Builder {
        + withHost(String host) RedisURI_Builder
        + withPort(int port) RedisURI_Builder
        + withAuthentication(String username, String password) RedisURI_Builder
        + withPassword(String password) RedisURI_Builder
        + build() RedisURI
    }

    RedisClusterAsyncCommandsFactory ..> RedisProviderConfig : uses
    RedisClusterAsyncCommandsFactory ..> RedisClient : creates
    RedisClusterAsyncCommandsFactory ..> RedisURI_Builder : builds
    RedisClient ..> RedisURI : depends on
    RedisURI_Builder ..> RedisURI : builds
Loading

File-Level Changes

Change Details Files
Add username/password configuration properties for the Redis HBO provider.
  • Introduce redisUsername and redisPassword fields in RedisProviderConfig.
  • Expose setters annotated with @config and @ConfigSecuritySensitive for hbo.redis-provider.redis-username and hbo.redis-provider.redis-password.
  • Expose corresponding getter methods for the new credential properties.
redis-hbo-provider/src/main/java/com/facebook/presto/statistic/RedisProviderConfig.java
Update non-cluster Redis client creation to support optional authentication from config.
  • Parse the configured server URI into host and port when building the Redis client.
  • Construct a RedisURI via RedisURI.Builder using host and port instead of passing the raw URI string.
  • If a password is provided, apply either username+password authentication or password-only authentication depending on whether username is configured.
  • Create the RedisClient from the built RedisURI, leaving cluster client creation unchanged.
redis-hbo-provider/src/main/java/com/facebook/presto/statistic/RedisClusterAsyncCommandsFactory.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions
Copy link

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

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

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants