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

Add result code to response messages #515

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

amichon-kalray
Copy link
Contributor

In some cases, the response is marked as accepted even if there was an error. Therefore, including the accepted tag in the response message is not enough: a follower may believe that an auto forwarded request was successful when it wasn't.

Resolves #513

Copy link
Contributor

@greensky00 greensky00 left a comment

Choose a reason for hiding this comment

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

Thanks for submitting PR, I put a few comments.

src/asio_service.cxx Outdated Show resolved Hide resolved
src/asio_service.cxx Outdated Show resolved Hide resolved
src/asio_service.cxx Outdated Show resolved Hide resolved
src/asio_service.cxx Outdated Show resolved Hide resolved
@@ -735,8 +738,9 @@ class rpc_session
try {
ptr<buffer> resp_ctx = resp->get_ctx();
int32 resp_ctx_size = (resp_ctx) ? resp_ctx->size() : 0;
int32 result_code_size = sizeof(int32_t);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of this, can you please use

int32 result_code_size = sizeof(cmd_result_code);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok
my concern was that we will use the put_i32 and get_i32 functions, so it result_code_size is not sizeof(int32_t), weird things may happen

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, good point, that makes more sense. Let me make a change to use sizeof(int32_t) and instead put int32_t to cmd_result_code definition.

@amichon-kalray amichon-kalray force-pushed the dev/amichon/master branch 2 times, most recently from 18e0dc3 to e49c962 Compare June 19, 2024 07:01
In some cases, the response is marked as accepted even if there was an
error. Therefore, including the accepted tag in the response message is
not enough: a follower may believe that an auto forwarded request was
successful when it wasn't.

Signed-off-by: Alex Michon <[email protected]>
Copy link
Contributor

@greensky00 greensky00 left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks.

@greensky00 greensky00 merged commit 52d9236 into eBay:master Jun 21, 2024
1 check passed
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.

Misleading append_entries result code
2 participants