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 #3179. Make registry, configcenter, matadata-report share a zooke… #3182

Merged
merged 13 commits into from
Jan 14, 2019

Conversation

cvictory
Copy link
Contributor

@cvictory cvictory commented Jan 10, 2019

fix #3179 , #3205, #3218

In dubbo 2.7, we introduce config-center, metadata-report and we define SPI for them. There are zookeeper extension for config-center and medata-report.
So far, there are 3 connections that are used for registry, config-center, metadata-report .
We should use one connection that can be shared with registry, config-center, metadata-report .

Add group field into MetadataReportConfig.

When get ZookeeperClient, must make it is connected.

@codecov-io
Copy link

codecov-io commented Jan 10, 2019

Codecov Report

Merging #3182 into 2.7.0-release will increase coverage by 0.1%.
The diff coverage is 81.13%.

Impacted file tree graph

@@                Coverage Diff                @@
##             2.7.0-release   #3182     +/-   ##
=================================================
+ Coverage            63.79%   63.9%   +0.1%     
  Complexity              75      75             
=================================================
  Files                  651     652      +1     
  Lines                28311   28355     +44     
  Branches              4792    4800      +8     
=================================================
+ Hits                 18061   18120     +59     
+ Misses                7980    7964     -16     
- Partials              2270    2271      +1
Impacted Files Coverage Δ Complexity Δ
...ng/zookeeper/zkclient/ZkclientZookeeperClient.java 55% <ø> (ø) 0 <0> (ø) ⬇️
...c/main/java/org/apache/dubbo/common/Constants.java 92.85% <ø> (ø) 0 <0> (ø) ⬇️
...etadata/support/AbstractMetadataReportFactory.java 87.5% <ø> (-0.74%) 0 <0> (ø)
...o/remoting/zookeeper/zkclient/ZkClientWrapper.java 83.63% <ø> (ø) 0 <0> (ø) ⬇️
...g/apache/dubbo/config/AbstractInterfaceConfig.java 72.18% <ø> (+0.21%) 0 <0> (ø) ⬇️
...ting/zookeeper/curator/CuratorZookeeperClient.java 67.7% <0%> (+1.04%) 0 <0> (ø) ⬇️
...dubbo/metadata/support/AbstractMetadataReport.java 69.51% <100%> (+0.16%) 0 <0> (ø) ⬇️
...zookeeper/curator/CuratorZookeeperTransporter.java 100% <100%> (ø) 0 <0> (ø) ⬇️
...okeeper/zkclient/ZkclientZookeeperTransporter.java 100% <100%> (ø) 0 <0> (ø) ⬇️
.../org/apache/dubbo/config/MetadataReportConfig.java 41.02% <33.33%> (-0.65%) 0 <0> (ø)
... and 18 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 347f154...4a10a81. Read the comment docs.

@@ -16,18 +16,17 @@
*/
package org.apache.dubbo.remoting.zookeeper.zkclient;

import org.I0Itec.zkclient.IZkChildListener;
Copy link
Member

Choose a reason for hiding this comment

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

double check all import sequence. I believe this will break CI. We have import rule configured, 'org.apache.dubbo' should go first.

… sharing zookeeper connection, it should judge zookeeperClient.isConnected()
// avoid creating too many connections, so add lock
synchronized (zookeeperClientMap) {
if ((zookeeperClient = fetchAndUpdateZookeeperClientCache(addressList)) != null && zookeeperClient.isConnected()) {
logger.info("Get result from map for the second time when invoking zookeeperTransporter.connnect .");
Copy link
Member

Choose a reason for hiding this comment

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

"find valid zookeeper client from the cache for address: " + addressList.toString()

}

zookeeperClient = createZookeeperClient(createServerURL(url));
logger.info("Get result by creating new connection when invoking zookeeperTransporter.connnect .");
Copy link
Member

Choose a reason for hiding this comment

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

"no valid zookeeper client found from cache, therefore create a new client for url " + url.

* @param url
* @return
*/
URL createServerURL(URL url) {
Copy link
Member

@beiwei30 beiwei30 Jan 14, 2019

Choose a reason for hiding this comment

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

need a better method name, say: toClientUrl()

import org.I0Itec.zkclient.IZkChildListener;
import org.I0Itec.zkclient.IZkStateListener;
import org.I0Itec.zkclient.ZkClient;
import org.apache.dubbo.common.logger.Logger;
Copy link
Member

Choose a reason for hiding this comment

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

import order, check style.

@beiwei30
Copy link
Member

this pull request has too many comments already. Pls. submit a separated pull request for the pending comments.

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