Skip to content
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

Merged
merged 4 commits into from
Feb 20, 2024

Conversation

kostasrim
Copy link
Contributor

addresses #2617

  • add -LOADING prefix for loading errors
  • replace -ERR with -LOADING for loading errors

Comment on lines 311 to 319

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));
Copy link
Contributor

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 🙂

Copy link
Contributor Author

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

@@ -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();
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done :)

@kostasrim kostasrim enabled auto-merge (squash) February 20, 2024 12:29
@kostasrim kostasrim merged commit a195003 into main Feb 20, 2024
10 checks passed
@kostasrim kostasrim deleted the fix_reply_types branch February 20, 2024 12:45
adiholden pushed a commit that referenced this pull request Feb 20, 2024
* add -LOADING prefix for loading errors
* replace -ERR with -LOADING for loading errors
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.

None yet

3 participants