-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[ISSUE#5863]add nacos client batchRegitserInstance request #8675
[ISSUE#5863]add nacos client batchRegitserInstance request #8675
Conversation
received
|
Codecov Report
@@ Coverage Diff @@
## develop #8675 +/- ##
==========================================
Coverage 41.59% 41.59%
- Complexity 4480 4489 +9
==========================================
Files 884 885 +1
Lines 32245 32291 +46
Branches 3733 3738 +5
==========================================
+ Hits 13411 13433 +22
- Misses 17479 17503 +24
Partials 1355 1355
Continue to review full report at Codecov.
|
for (int i = 0; i < newInstanceList.size(); i++) { | ||
Instance instance = newInstanceList.get(i); | ||
checkInstanceIsLegal(instance); | ||
for (int j = i + 1; j < newInstanceList.size(); j++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use set?
get
CopyOnWriteArrayList<Instance> newInstanceList = new CopyOnWriteArrayList<>(instances); | ||
for (int i = 0; i < newInstanceList.size(); i++) { | ||
Instance instance = newInstanceList.get(i); | ||
checkInstanceIsLegal(instance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we check all instance is same ephemeral?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we check all instance is same ephemeral?
Yes, I adjusted it
NAMING_LOGGER.warn("batchRegisterInstance instances is Empty:{}", instances); | ||
grpcClientProxy.batchRegisterService(serviceName, groupName, instances); | ||
} | ||
getExecuteClientProxy(instances.get(0)).batchRegisterService(serviceName, groupName, instances); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArrayIndexOutOf if instances is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't get the logic for double call batchRegisterService for different proxy.
The batch feature only add for grpc I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't get the logic for double call batchRegisterService for different proxy. The batch feature only add for grpc I think.
In order to adapt to the Nacos call style, I have modified it to grpc call
@@ -75,6 +76,12 @@ private void redoForInstance(InstanceRedoData redoData) throws NacosException { | |||
if (isClientDisabled()) { | |||
return; | |||
} | |||
if (redoData instanceof BatchInstanceRedoData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abstract line from 79 to 85 into other method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abstract line from 79 to 85 into other method.
i abstract it
public static void checkInstanceIsEphemeral(Instance instance) throws NacosException { | ||
if (!instance.isEphemeral()) { | ||
throw new NacosException(NacosException.INVALID_PARAM, | ||
String.format("Batch registration does not allow non-temporary instance registration , Instance:%s", instance)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-temporary
-> non-ephemeral
or persistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
persistent
rigorous
@@ -487,7 +492,7 @@ public String callServer(String api, Map<String, String> params, Map<String, Str | |||
HttpRestResult<String> restResult = nacosRestTemplate | |||
.exchangeForm(url, header, Query.newInstance().initParams(params), body, method, String.class); | |||
end = System.currentTimeMillis(); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove indent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove indent?
I have revised it
Please do not create a Pull Request without creating an issue first.
What is the purpose of the change
for #5863 nacos client support batchRegister request
Brief changelog
XX
Verifying this change
XXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
[ISSUE #123] Fix UnknownException when host config not exist
. Each commit in the pull request should have a meaningful subject line and body.mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true
to make sure basic checks pass. Runmvn clean install -DskipITs
to make sure unit-test pass. Runmvn clean test-compile failsafe:integration-test
to make sure integration-test pass.