-
Notifications
You must be signed in to change notification settings - Fork 998
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: broken memcached error reporting (#1741)
* fix DispatchCommand error reporting when memcached protocol is used (one example is when we use SET command on the replica -- previously we crashed now we properly report an error) * SendError(ErrorReply) moved to SinkReplyBuilder from RedisReplyBuilder * SendError(OpStatus) moved to SinkReplyBuilder from RedisReplyBuilder * added tests for SendError(ErrorReply) in RedisReplyBuilder
- Loading branch information
Showing
9 changed files
with
137 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,37 @@ | ||
#include "facade/op_status.h" | ||
|
||
namespace facade {} // namespace facade | ||
#include "base/logging.h" | ||
#include "facade/error.h" | ||
#include "facade/resp_expr.h" | ||
|
||
namespace facade { | ||
|
||
std::string_view StatusToMsg(OpStatus status) { | ||
switch (status) { | ||
case OpStatus::OK: | ||
return "OK"; | ||
case OpStatus::KEY_NOTFOUND: | ||
return kKeyNotFoundErr; | ||
case OpStatus::WRONG_TYPE: | ||
return kWrongTypeErr; | ||
case OpStatus::OUT_OF_RANGE: | ||
return kIndexOutOfRange; | ||
case OpStatus::INVALID_FLOAT: | ||
return kInvalidFloatErr; | ||
case OpStatus::INVALID_INT: | ||
return kInvalidIntErr; | ||
case OpStatus::SYNTAX_ERR: | ||
return kSyntaxErr; | ||
case OpStatus::OUT_OF_MEMORY: | ||
return kOutOfMemory; | ||
case OpStatus::BUSY_GROUP: | ||
return "-BUSYGROUP Consumer Group name already exists"; | ||
case OpStatus::INVALID_NUMERIC_RESULT: | ||
return kInvalidNumericResult; | ||
default: | ||
LOG(ERROR) << "Unsupported status " << status; | ||
return "Internal error"; | ||
} | ||
} | ||
|
||
} // namespace facade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters