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

Broadcast mode supports the collection of service response sent by ev… #7645

Merged
merged 1 commit into from
May 13, 2021

Conversation

goodjava
Copy link
Contributor

@goodjava goodjava commented Apr 27, 2021

For instance, a dubbo consumer broadcasts a call to every dubbo provider's health check api. The BroadcastClusterInvoker will collect the response of every one of these providers.
ffff
1

@goodjava goodjava force-pushed the feat_27 branch 2 times, most recently from 915d08f to 64cda74 Compare April 28, 2021 02:21
for (Invoker<T> invoker : invokers) {
BroadcastResult br = new BroadcastResult();
Copy link
Member

Choose a reason for hiding this comment

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

How about only build such result when enable aggerate result?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get

@@ -100,7 +134,7 @@ public Result doInvoke(final Invocation invocation, List<Invoker<T>> invokers, L
}
throw exception;
}

result.setAttachment(BROADCAST_RESULTS_KEY, new Gson().toJson(resultList));
Copy link
Member

Choose a reason for hiding this comment

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

was this necessary?

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

package org.apache.dubbo.rpc.cluster.support;

/**
* @Author [email protected]
Copy link
Member

Choose a reason for hiding this comment

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

pls remove author tag, thx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get

@AlbumenJ
Copy link
Member

also, pls add some ut for this pr

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2021

Codecov Report

Merging #7645 (1fac10f) into master (936c662) will decrease coverage by 0.06%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #7645      +/-   ##
============================================
- Coverage     59.13%   59.06%   -0.07%     
+ Complexity      530      529       -1     
============================================
  Files          1076     1079       +3     
  Lines         43439    43627     +188     
  Branches       6351     6369      +18     
============================================
+ Hits          25689    25770      +81     
- Misses        14913    14996      +83     
- Partials       2837     2861      +24     
Impacted Files Coverage Δ Complexity Δ
...e/dubbo/rpc/cluster/support/BroadcastCluster2.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
.../rpc/cluster/support/BroadcastCluster2Invoker.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...che/dubbo/rpc/cluster/support/BroadcastResult.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...tadata/DynamicConfigurationServiceNameMapping.java 47.36% <0.00%> (-36.85%) 0.00% <0.00%> (ø%)
...ache/dubbo/cache/support/AbstractCacheFactory.java 87.50% <0.00%> (-12.50%) 0.00% <0.00%> (ø%)
...nfig/configcenter/nop/NopDynamicConfiguration.java 75.00% <0.00%> (-12.50%) 0.00% <0.00%> (ø%)
...in/java/org/apache/dubbo/common/utils/JVMUtil.java 81.13% <0.00%> (-11.33%) 0.00% <0.00%> (ø%)
...che/dubbo/remoting/transport/mina/MinaChannel.java 35.52% <0.00%> (-10.53%) 14.00% <0.00%> (-1.00%)
...dubbo/remoting/exchange/support/DefaultFuture.java 80.34% <0.00%> (-6.84%) 0.00% <0.00%> (ø%)
...apache/dubbo/registry/retry/AbstractRetryTask.java 47.22% <0.00%> (-5.56%) 0.00% <0.00%> (ø%)
... and 53 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 936c662...1fac10f. Read the comment docs.

Copy link
Member

@AlbumenJ AlbumenJ left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -55,6 +62,7 @@ public Result doInvoke(final Invocation invocation, List<Invoker<T>> invokers, L
// 100 means that an exception will be thrown last, and 0 means that as long as an exception occurs, it will be thrown.
// see https://github.com/apache/dubbo/pull/7174
int broadcastFailPercent = url.getParameter(BROADCAST_FAIL_PERCENT_KEY, MAX_BROADCAST_FAIL_PERCENT);
boolean collectAllResults = url.getParameter(BROADCAST_COLLECT_ALL_RESULT_KEY, false);
Copy link
Member

Choose a reason for hiding this comment

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

Please add some comment about this parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get

@AlbumenJ
Copy link
Member

AlbumenJ commented May 1, 2021

Please improve the related document ( about usage and scenes to be used ) in dubbo-website after this PR merged.

Copy link
Contributor

@xiaoheng1 xiaoheng1 left a comment

Choose a reason for hiding this comment

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

LGTM

@goodjava
Copy link
Contributor Author

goodjava commented May 6, 2021

Please improve the related document ( about usage and scenes to be used ) in dubbo-website after this PR merged.

get

@goodjava goodjava force-pushed the feat_27 branch 2 times, most recently from baba5f3 to 1fac10f Compare May 11, 2021 02:01
if (hasException(res.exception)) {
return createResult(invocation, res.exception, res.resultList);
}
Result result = res.resultList.get(0).getResult();
Copy link
Member

Choose a reason for hiding this comment

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

why not use getter
also will this produce npe?

@AlbumenJ AlbumenJ merged commit b7419d4 into apache:master May 13, 2021
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.

4 participants