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

refactor(clustering/rpc): support rpc batching on dp side #14040

Open
wants to merge 47 commits into
base: master
Choose a base branch
from

Conversation

chronolaw
Copy link
Contributor

@chronolaw chronolaw commented Dec 20, 2024

Summary

KAG-5934

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix #[issue number]

@github-actions github-actions bot added core/clustering cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Dec 20, 2024
@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 21, 2024
@chronolaw chronolaw changed the title refactor(clustering/rpc): rpc under working refactor(clustering/rpc): support rpc batching Dec 22, 2024
@chronolaw chronolaw force-pushed the refactor/add_rpc_batching branch from 92b6976 to e47aa67 Compare December 23, 2024 07:17
@chronolaw chronolaw changed the title refactor(clustering/rpc): support rpc batching refactor(clustering/rpc): support rpc batching on dp side Dec 24, 2024
@chronolaw chronolaw marked this pull request as ready for review December 24, 2024 05:08
@chronolaw
Copy link
Contributor Author

chronolaw commented Dec 24, 2024

Since this feature is hard to test, I will add it to concentrator in another PR.

@ADD-SP ADD-SP requested a review from Copilot January 3, 2025 03:28

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Files not reviewed (1)
  • kong/clustering/rpc/socket.lua: Language not supported
@chronolaw chronolaw force-pushed the refactor/add_rpc_batching branch 2 times, most recently from fd48976 to 4a3d7fd Compare January 8, 2025 06:45
Copy link
Contributor

@StarlightIbuki StarlightIbuki left a comment

Choose a reason for hiding this comment

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

Not blockers

Comment on lines +134 to +141
local res, err = self:push_response(
new_error(nil, jsonrpc.INVALID_REQUEST, "not a valid object"),
collection)
if not res then
return nil, err
end

return true
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
local res, err = self:push_response(
new_error(nil, jsonrpc.INVALID_REQUEST, "not a valid object"),
collection)
if not res then
return nil, err
end
return true
return self:push_response(
new_error(nil, jsonrpc.INVALID_REQUEST, "not a valid object"),
collection)

Copy link
Contributor Author

@chronolaw chronolaw Jan 10, 2025

Choose a reason for hiding this comment

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

We could do it, but this style should be consistent with line 186:

186         local reso, erro = self:push_response(new_error(payload_id, jsonrpc.INTERNAL_ERROR),
187                                               "unable to send \"INTERNAL_ERROR\" error back to client: ",
188                                               collection)
189         if not reso then
190           return nil, erro
191         end
193         return nil, "unable to dispatch JSON-RPC callback: " .. err

Copy link
Contributor

@chobits chobits Jan 13, 2025

Choose a reason for hiding this comment

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

I think we need to accept xuming's advice.

We should not block this improvement to try to align with L186. Because L186's error has a prefix error"unable to dispatch JSON-RPC callback: "

WIthout xuming's fix, otherwise, this logic always let reviewers feel odd.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I think we could return errno. without a prefix error. This is simpler

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will do it in another refactor PR.

Comment on lines +156 to +163
local res, err = self:push_response(new_error(payload_id, jsonrpc.METHOD_NOT_FOUND),
"unable to send \"METHOD_NOT_FOUND\" error back to client: ",
collection)
if not res then
return nil, err
end

return true
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. By simplifying the code we reduce the noise and improve readability

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We keep the same call style of self:push_response in the code, as my opinion it may not be changed in this PR.

@chronolaw chronolaw force-pushed the refactor/add_rpc_batching branch from edb1185 to 596ecba Compare January 12, 2025 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee core/clustering size/L skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants