-
Notifications
You must be signed in to change notification settings - Fork 899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: loading state error type to be compatible with redis #2629
Conversation
src/facade/reply_builder.cc
Outdated
|
||
if (err_type == kLoadingErrType) { | ||
iovec v[] = {IoVec(kLoadingPrefix), IoVec(str), IoVec(kCRLF)}; | ||
Send(v, ABSL_ARRAYSIZE(v)); | ||
return; | ||
} | ||
|
||
iovec v[] = {IoVec(kErrPref), IoVec(str), IoVec(kCRLF)}; | ||
Send(v, ABSL_ARRAYSIZE(v)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inconsistency is that we don't use error types for prefixes for other cases (I don't even remember why we have them) and use the prefix directly, see kAuthRejected
or kScriptNotFound
... so what would be the preferred way now 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I see. error types are used for stats, you might want to send a different error message but register it under the same stat name
src/server/main_service.cc
Outdated
@@ -988,7 +988,8 @@ std::optional<ErrorReply> Service::VerifyCommandState(const CommandId* cid, CmdA | |||
|
|||
// Check if the command is allowed to execute under this global state | |||
bool allowed_by_state = true; | |||
switch (etl.gstate()) { | |||
const auto gstate = etl.gstate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can you please replace auto with GlobalState?
auto is great for generic code, avoid 120 char type names etc. But lets not use it at least for POD types - it's much harder to review the code when you do not know what type the variable is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done :)
* add -LOADING prefix for loading errors * replace -ERR with -LOADING for loading errors
addresses #2617