Skip to content

Implement Support for Hello command - #42744

Merged
nezdolik merged 10 commits into
envoyproxy:mainfrom
dinesh-murugiah:hello_cmd
Jan 3, 2026
Merged

nezdolik merged 10 commits into
envoyproxy:mainfrom
dinesh-murugiah:hello_cmd

Conversation

@dinesh-murugiah

Copy link
Copy Markdown
Contributor

Commit Message:

redis: implement HELLO command support for cluster-scope routing

Additional Description:

This PR implements support for the Redis HELLO command using the ClusterScopeCmdRequest framework. The HELLO command is essential for modern Redis clients like Lettuce, which require a HELLO response to establish connections and negotiate protocol versions. Without this support, such clients cannot communicate through the proxy.

The implementation:

  • Routes HELLO to all shards in the cluster
  • Aggregates responses from multiple shards with protocol version validation
  • Sanitizes connection-specific fields (e.g., "id") across shards
  • Validates protocol version consistency and rejects unsupported features (AUTH/SETNAME options)
  • Currently only supports RESP2 (protocol version 2), explicitly rejecting RESP3
  • Provides visibility to clients that the proxy does not support RESP3 yet

This enables compatibility with clients that mandate HELLO handshake while maintaining the proxy's RESP2-only behavior.

Risk Level:

Medium

The change modifies command routing logic and adds a new cluster-scope command handler. While thoroughly tested, it affects the command processing path which is critical for all Redis operations.

Testing:

  • Added 17 unit tests covering validation and aggregation logic:
    • 4 pre-routing validation tests (argument validation, protocol version checks)
    • 13 post-routing handler tests (response aggregation, field sanitization, error handling)
  • Updated 2 integration tests to reflect HELLO as a supported command
  • All tests passing with 100% code coverage for HELLO command paths

Docs Changes:

N/A

Release Notes:

redis: Added support for HELLO command to enable compatibility with modern Redis clients like Lettuce that require HELLO handshake. The proxy responds with RESP2 protocol information and rejects RESP3 protocol requests.

Platform Specific Features:

N/A

Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
Signed-off-by: dinesh-murugiah <[email protected]>
}

// If no array response found, forward first valid response
if (!found_first) {

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.

can we instead check if (first_response_map.size() > 0) and get rid of found_first variable?

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.

sure will check

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.

fixed

sendSuccessResponse(request, std::move(response));
}

void HelloResponseHandler::processAggregatedResponses(ClusterScopeCmdRequest& request) {

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.

would be helpful to add explanatory comment to this method on how algorithm works. For now is not clear why do we need 2 passes across all responses, also there is some duplicated code.

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.

fixed
made it to ine pass to both feth the first reposnse and compare it with other responses

// Additional options like AUTH, SETNAME are not supported yet
if (command_name == Common::Redis::SupportedCommands::hello()) {

if (request->asArray().size() > 2) {

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.

and what if request->asArray().size() < 2 ? there is no handling for this case

@dinesh-murugiah dinesh-murugiah Dec 29, 2025 •

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.

if its less than 2 , then its only hello command , which will be processed by the cluster scope handler, so not special handling requied

@nezdolik nezdolik self-assigned this Dec 23, 2025
Signed-off-by: dinesh-murugiah <[email protected]>
@dinesh-murugiah

dinesh-murugiah commented Dec 29, 2025 •

Copy link
Copy Markdown
Contributor Author

/rerun

@nezdolik
nezdolik merged commit c354add into envoyproxy:main Jan 3, 2026
@lyh802

lyh802 commented Mar 11, 2026

Copy link
Copy Markdown

i found an incompatibility. when lettuce client send "HELLO 3 AUTH user pass" . the return should be "ERR unknown command".

but when hello is supported. the upper case is ignored, thus return "AuthRequired"
if (!callbacks.connectionAllowed()) {
callbacks.onResponse(Common::Redis::Utility::makeError(Response::get().AuthRequiredError));
return nullptr;
}

#37706
4384d04
For unsupport commands, the return value is the same as Redis, because some clients judge this return value, for example, Java lettuce client

@dinesh-murugiah

Copy link
Copy Markdown
Contributor Author

@lyh802 thanks for pointing it out
Will submit a fix, such that we handle hello command much before auth is processed

grnmeira pushed a commit to grnmeira/envoy that referenced this pull request Mar 20, 2026
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.

4 participants