rocketmq_proxy: implement rocketmq proxy#9503
Conversation
f55ff0f to
e7b43b6
Compare
|
@aaron-ai thanks for your interest in contributing this awesome feature! I'm going to be honest in saying that we cannot accept an 8K line PR with no prior notice and no plan for reviewing. Do you have any maintainers in mind who would be willing to sponsor reviewing this PR and seeing that it get merged? Thank you. |
|
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
|
@mattklein123 Thanks for your feedback first! This pull request does look too big at first sight, but more than half code of lines are test cases to meet 100% test coverages goal required here. The main source parts are self-contained and generally feature-implement-purpose. Once understanding core concepts of Apache RocketMQ, reviewing this PR will not be as challenging as initial thought. |
CODEOWNERS
Outdated
There was a problem hiding this comment.
@aaron-ai There must be a maintainer in code owner https://github.com/envoyproxy/envoy/blob/master/EXTENSION_POLICY.md
There was a problem hiding this comment.
Thanks @zyfjeff, we are still looking for a maintainer who has the convenience of sponsoring.
There was a problem hiding this comment.
@aaron-ai @lizhanhui I don't have the bandwidth right now to do a full review for this and I doubt any of the @envoyproxy/maintainers do either, but they can speak for themselves. However, if @zyfjeff is willing to take point and do a thorough review I'm happy to do a skim afterwords and sponsor. @zyfjeff does that sound OK to you?
There was a problem hiding this comment.
@mattklein123
I would be happy to review this, I used to write rocketmq c++ sdk, so I think I can do it
There was a problem hiding this comment.
I would be happy to review this, I used to write rocketmq c++ sdk, so I think I can do it
Awesome. Thank you so much! :)
zyfjeff
left a comment
There was a problem hiding this comment.
I can help review, but unfortunately I am not a maintainer
There was a problem hiding this comment.
Please add some comments to explain this field
include/envoy/config/grpc_mux.h
Outdated
There was a problem hiding this comment.
Is it possible to split a separate PR for review?
I do not believe that this code is part of the rocketmq_proxy filter, and this part of the code does not pass review in #8984 .
There was a problem hiding this comment.
Is it possible to split a separate PR for review?
I do not believe that this code is part of the rocketmq_proxy filter, and this part of the code does not pass review in #8984 .
I would start a new PR about this part. Thank you.
There was a problem hiding this comment.
Envoy is now actively trying to get rid of its depends on rapidjson #4705 we should convert to JSON using protobuf
There was a problem hiding this comment.
Redundant code that can be put into a common function for stats statistics.
b9ed6ae to
d719945
Compare
There was a problem hiding this comment.
Please replace it with the idiom used by the Envoy,
struct RocketmqValues {
const std::string CLUSTER_TYPE{xxxx};
};
using RocketmqConstants = ConstSingleton<RocketmqValues>;
There was a problem hiding this comment.
please replace std::vector<QueueData>& queueData to std::vector<QueueData>&& queueData
It is not easy to read
std::vector<QueueData> test
TopicRouteData tt(test);
// The following code is not aware that test has been moved and will continue to use test
But it's much easier to read if you go like this
std::vector<QueueData> test
TopicRouteData tt(std::move(test));
// I knew from looking at the code that test had been moved.
There was a problem hiding this comment.
broker_addrs_(brokerAddrs) Do we need a copy here?
There was a problem hiding this comment.
All right. Will use move to avoid copy
There was a problem hiding this comment.
How do you ensure that the string referenced by target_host_ is always valid?
There was a problem hiding this comment.
target_host_ referenced can only be either empty or a valid target host. In case it is empty, host selection is completely subject to the LB. If it is a valid target host address, the request will be routed to it.
There was a problem hiding this comment.
I mean whether the memory referenced by target_host_ is valid, not the content.
There was a problem hiding this comment.
sendRequestToUpstream(target_host) -> createFilterChain(target_host); -> connection_manager_.config().createRouter(target_host);
RouterPtr createRouter(absl::string_view target_host) override {
return std::make_unique<RouterImpl>(context_.clusterManager(), target_host);
}
class RouterImpl {
private:
absl::string_view target_host_;
}
Finally, target_host_ in RouterImpl refers to the target_host here, but the target_host here is released when it leaves the scope, resulting an undefined behavior in routerimpl.target_host_ refers to invalid memory.
There was a problem hiding this comment.
Ah, I get your point. This is a bug. target_host_ should be of std::string, not string_view.
There was a problem hiding this comment.
string_view has been fixed already.
|
@zyfjeff All issues above have been fixed. |
There was a problem hiding this comment.
remove, Didn't see this variable used
There was a problem hiding this comment.
Well, I think you should implement shouldSelectAnotherHost, not hostSelectionRetryCount.
There was a problem hiding this comment.
I think that subset should be used to select the endpoint
There was a problem hiding this comment.
OK, I will use subset instead.
|
@zyfjeff All issues above have been fixed. |
|
Can you merge master once? I can sponsor meanwhile until someone from Alibaba becomes maintainer, but I don't have enough bandwidth to review this week. |
OK |
|
Please merge master to pick up #10672. We no longer accept changes to v2 (without explicit exception), so any API modifications should happen in v3. If this PR is adding a new proto, please follow the updated instructions in https://github.com/envoyproxy/envoy/blob/master/api/STYLE.md#adding-an-extension-configuration-to-the-api. |
lizan
left a comment
There was a problem hiding this comment.
Can you merge master again to pick 1.14.0 release and then add a release note for 1.15.0?
generated_api_shadow/BUILD
Outdated
There was a problem hiding this comment.
pop_message_request_header, please fix all local variable cases in this PR
|
Hi, @lizan, Release note is added to current.rst and constexpr-issues are fixed. One more TODO is also inserted, indicating future work that is planned. |
|
More docs have been added. A small part of code are not covered by UT, and I will implement them tomorrow. |
65de232 to
0408438
Compare
|
@lizan Unit tests have been supplemented and all issues raised are properly resolved. |
Signed-off-by: aaron-ai <yangkun.ayk@alibaba-inc.com>
|
All tests in CI are OK. |
Implement rocketmq proxy
Description: implement rocketmq proxy
Risk Level: Low
Testing: Unit Tests
Docs Changes: N/A
Release Notes: N/A
[Optional Fixes #Issue] #9431