Skip to content

Commit

Permalink
[redis proxy]: redis unsupported command message compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: duanhongyi <duanhongyi@doopai.com>
  • Loading branch information
duanhongyi committed Dec 19, 2024
1 parent ea751e2 commit d5bd91f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/root/intro/arch_overview/other_protocols/redis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ Envoy can also generate its own errors in response to the client.
the connection."
invalid request, "Command was rejected by the first stage of the command splitter due to
datatype or length."
unsupported command, "The command was not recognized by Envoy and therefore cannot be serviced
ERR unknown command, "The command was not recognized by Envoy and therefore cannot be serviced
because it cannot be hashed to a backend server."
finished with n errors, "Fragmented commands which sum the response (e.g. DEL) will return the
total number of errors received if any were received."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,8 @@ SplitRequestPtr InstanceImpl::makeRequest(Common::Redis::RespValuePtr&& request,
if (handler == nullptr) {
stats_.unsupported_command_.inc();
callbacks.onResponse(Common::Redis::Utility::makeError(
fmt::format("unsupported command '{}'", request->asArray()[0].asString())));
fmt::format("ERR unknown command '{}', with args beginning with: {}",
request->asArray()[0].asString(), request->asArray()[1].asString())));
return nullptr;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ TEST_F(RedisCommandSplitterImplTest, InvalidRequestArrayNotStrings) {
TEST_F(RedisCommandSplitterImplTest, UnsupportedCommand) {
Common::Redis::RespValue response;
response.type(Common::Redis::RespType::Error);
response.asString() = "unsupported command 'newcommand'";
response.asString() = "ERR unknown command 'newcommand', with args beginning with: hello";
EXPECT_CALL(callbacks_, connectionAllowed()).WillOnce(Return(true));
EXPECT_CALL(callbacks_, onResponse_(PointeesEq(&response)));
Common::Redis::RespValuePtr request{new Common::Redis::RespValue()};
Expand Down

0 comments on commit d5bd91f

Please sign in to comment.