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

Fix ZkNoNodeException when zookeeper server is empty. #901

Merged
merged 5 commits into from
Apr 25, 2019

Conversation

ujjboy
Copy link
Contributor

@ujjboy ujjboy commented Apr 25, 2019

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Fixes #900

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Apr 25, 2019

Codecov Report

Merging #901 into develop will decrease coverage by 0.37%.
The diff coverage is 0%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #901      +/-   ##
=============================================
- Coverage       38.7%   38.33%   -0.38%     
- Complexity      1026     1028       +2     
=============================================
  Files            220      222       +2     
  Lines           8492     8621     +129     
  Branches        1023     1044      +21     
=============================================
+ Hits            3287     3305      +18     
- Misses          4814     4926     +112     
+ Partials         391      390       -1
Impacted Files Coverage Δ Complexity Δ
...very/registry/zk/ZookeeperRegisterServiceImpl.java 0% <0%> (ø) 0 <0> (?)
...scovery/registry/zk/ZookeeperRegistryProvider.java 0% <0%> (ø) 0% <0%> (?)
...eata/server/store/FileTransactionStoreManager.java 53.5% <0%> (+0.5%) 15% <0%> (ø) ⬇️
...o/seata/server/coordinator/DefaultCoordinator.java 53.57% <0%> (+1.42%) 16% <0%> (ø) ⬇️
...eata/core/rpc/netty/AbstractRpcRemotingClient.java 20.57% <0%> (+3.34%) 7% <0%> (ø) ⬇️
...ain/java/io/seata/core/rpc/netty/ShutdownHook.java 81.25% <0%> (+25%) 8% <0%> (+2%) ⬆️

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 b108de5...021e0a8. Read the comment docs.

Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

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

thanks.i left some comments.

@ujjboy
Copy link
Contributor Author

ujjboy commented Apr 25, 2019

@xingfudeshi done~

@ujjboy ujjboy requested a review from zhangthen April 25, 2019 05:30
ZookeeperRegistryProvider provider = new ZookeeperRegistryProvider();
RegistryService registryService = provider.provide();
Assert.assertTrue(registryService instanceof ZookeeperRegisterServiceImpl);
Assert.assertEquals(registryService, provider.provide());
Copy link
Member

Choose a reason for hiding this comment

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

this line can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line is for testing the return singleton ZookeeperRegisterServiceImpl .

Copy link
Member

Choose a reason for hiding this comment

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

it's not necessary.the code
Assert.assertEquals(registryService, provider.provide()); will always pass even the registryService is null,because the registryService was returned by calling provider.provide()
RegistryService registryService = provider.provide();

@Test
public void provide() {
ZookeeperRegistryProvider provider = new ZookeeperRegistryProvider();
RegistryService registryService = provider.provide();
Copy link
Member

Choose a reason for hiding this comment

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

and this line can be removed too.
the Assert.assertTrue(registryService instanceof ZookeeperRegisterServiceImpl);
can be replaced with the following code:
Assert.assertTrue(provider.provide() instanceof ZookeeperRegisterServiceImpl);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line is for testing the return singleton ZookeeperRegisterServiceImpl .

@ujjboy ujjboy requested a review from xingfudeshi April 25, 2019 06:39
Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Contributor

@zhangthen zhangthen left a comment

Choose a reason for hiding this comment

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

+1

@zhangthen zhangthen merged commit 104a168 into apache:develop Apr 25, 2019
@ujjboy ujjboy added the bug label Apr 25, 2019
@ujjboy ujjboy deleted the fix_zk_no_node branch April 25, 2019 07:35
philoli11 pushed a commit to philoli11/seata that referenced this pull request Apr 26, 2019
nick-tan pushed a commit to nick-tan/seata that referenced this pull request Jul 12, 2019
@wangliang181230 wangliang181230 added type: bug Category issues or prs related to bug. and removed bug labels Oct 16, 2020
@wangliang181230 wangliang181230 added this to the 0.5.* milestone Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parent node is not automatically created in the Zookeeper discovery.
5 participants