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

use the correct spi ZookeeperTransporter when initialize the default … #4513

Merged
merged 1 commit into from
Jul 15, 2019

Conversation

CodingSinger
Copy link
Member

…ConfigCenter's zkClient(#4511)

What is the purpose of the change

use the correct spi ZookeeperTransporter when initialize the default configcenter's zkClient
fix the issue #4511

@codecov-io
Copy link

codecov-io commented Jul 9, 2019

Codecov Report

Merging #4513 into master will increase coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #4513      +/-   ##
============================================
+ Coverage      62.9%   62.93%   +0.02%     
  Complexity      449      449              
============================================
  Files           770      770              
  Lines         33006    33008       +2     
  Branches       5216     5216              
============================================
+ Hits          20763    20774      +11     
+ Misses         9846     9840       -6     
+ Partials       2397     2394       -3
Impacted Files Coverage Δ Complexity Δ
...g/apache/dubbo/config/AbstractInterfaceConfig.java 71.59% <0%> (-0.41%) 0 <0> (ø)
...he/dubbo/remoting/transport/netty/NettyServer.java 69.64% <0%> (-3.58%) 8% <0%> (-1%)
...bo/rpc/cluster/support/FailbackClusterInvoker.java 70.49% <0%> (+3.27%) 0% <0%> (ø) ⬇️
.../apache/dubbo/remoting/transport/AbstractPeer.java 63.04% <0%> (+4.34%) 0% <0%> (ø) ⬇️
...e/dubbo/remoting/transport/netty/NettyChannel.java 62.35% <0%> (+4.7%) 21% <0%> (+1%) ⬆️
.../apache/dubbo/qos/protocol/QosProtocolWrapper.java 82.05% <0%> (+12.82%) 0% <0%> (ø) ⬇️

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 5eec017...cadc5ab. Read the comment docs.

Copy link
Contributor

@tswstarplanet tswstarplanet left a comment

Choose a reason for hiding this comment

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

If the client is just useful for ZookeeperDynamicConfiguration but useless for other DynamicConfiguration implementation, I think we should add a field "client" to ConfigCenterConfig, we can add the client to the map parameters. Look at the comments in ConfigCenterConfig class.

    /* If the Config Center product you use have some special parameters that is not covered by this class, you can add it to here.
    For example, with XML:
      <dubbo:config-center>
           <dubbo:parameter key="config.{your key}" value="{your value}" />
      </dubbo:config-center>
     */
    private Map<String, String> parameters;

Can you modify your implementation ?

@CodingSinger
Copy link
Member Author

@tswstarplanet yes, i know your purpose.

@lexburner
Copy link
Contributor

LGTM

@lexburner lexburner merged commit 668378f into apache:master Jul 15, 2019
Copy link
Contributor

@tswstarplanet tswstarplanet left a comment

Choose a reason for hiding this comment

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

LGTM

Excuse me, I think the pr have problems. If the ConfigCenterConfig cc object has its own parameters, the

cc.setParameters(new HashMap<>())

will cause the previous parameters in the map lost.
Do you think so ?

@@ -619,6 +619,8 @@ private void useRegistryForConfigIfNecessary() {
Environment.getInstance().getDynamicConfiguration().orElseGet(() -> {
ConfigManager configManager = ConfigManager.getInstance();
ConfigCenterConfig cc = configManager.getConfigCenter().orElse(new ConfigCenterConfig());
cc.setParameters(new HashMap<>());
cc.getParameters().put(org.apache.dubbo.remoting.Constants.CLIENT_KEY,rc.getClient());
Copy link
Contributor

Choose a reason for hiding this comment

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

1.check if there exists client in RegistryConfig
2.get the map first, then if it is null we create a new map; put the client into the map if it is absent
Would you please check and modify it again ?

Copy link
Member Author

@CodingSinger CodingSinger Jul 18, 2019

Choose a reason for hiding this comment

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

你好,首先为你们带来的麻烦带来抱歉。
但是我检查过,好像这个地方只有在未声明过config-center的时候才会进入这个代码块,那就意味着这里并不会存在覆盖已有的配置?

Environment.getInstance().getDynamicConfiguration().orElseGet()

不存在DynamicConfiguration才会调用orElseGet中的方法,此时应该也是不存在ConfigCenterConfig的。

不知道我的说法对不对?

Copy link
Contributor

@tswstarplanet tswstarplanet Jul 18, 2019

Choose a reason for hiding this comment

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

@CodingSinger
客气。确实是你说的这样。不过一般这种都是先获取已存在的,不存在才建一个新的。这样即使其他地方改了代码,也不会影响这里。这里就这样吧

Copy link
Member Author

Choose a reason for hiding this comment

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

是的... 同意你的建议 我重新改下

@lexburner
Copy link
Contributor

@CodingSinger My fault, pls check the above comment mentioned by @tswstarplanet

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