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

Add: new feature to support dynamic config center which compatible with dubbo 2.6.x & 2.7.x #194

Merged
merged 29 commits into from
Sep 17, 2019

Conversation

hxmhlt
Copy link
Contributor

@hxmhlt hxmhlt commented Sep 6, 2019

What this PR does:

1.New feature to support dynamic config center.

2.Service management support service level and application level which compatible with dubbo 2.6.x & 2.7.x, reference from config_center.

3.ZooKeeper as the first dynamic config center implement.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Yes, user can set 'config_center' config in client.yml & server.yml to enable the dynamic config center feature.


@codecov-io
Copy link

codecov-io commented Sep 6, 2019

Codecov Report

Merging #194 into develop will decrease coverage by 2.01%.
The diff coverage is 49.15%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #194      +/-   ##
===========================================
- Coverage    67.49%   65.47%   -2.02%     
===========================================
  Files           94       94              
  Lines         5864     6303     +439     
===========================================
+ Hits          3958     4127     +169     
- Misses        1496     1748     +252     
- Partials       410      428      +18
Impacted Files Coverage Δ
config/protocol_config.go 100% <ø> (ø) ⬆️
config/service_config.go 66.23% <ø> (+0.41%) ⬆️
config/consumer_config.go 61.7% <ø> (ø) ⬆️
config/config_utils.go 100% <ø> (ø) ⬆️
config_center/configurator/mock.go 0% <0%> (ø)
config_center/zookeeper/factory.go 9.09% <0%> (ø) ⬆️
cluster/directory/base_directory.go 60% <0%> (-9.24%) ⬇️
common/config/environment.go 72.5% <0%> (-8.06%) ⬇️
registry/zookeeper/listener.go 58.13% <100%> (ø) ⬆️
config/reference_config.go 82.75% <100%> (ø) ⬆️
... and 26 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 bb1216a...ddf2e27. Read the comment docs.

common/extension/configurator.go Outdated Show resolved Hide resolved
common/extension/configurator.go Outdated Show resolved Hide resolved
config_center/parser/configuration_parser.go Outdated Show resolved Hide resolved
//set configurators to empty
bcl.configurators = []config_center.Configurator{}
return
} else if len(rawConfig) > 0 {
Copy link
Contributor

@AlexStocks AlexStocks Sep 7, 2019

Choose a reason for hiding this comment

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

I think u can delete the else as follows,

    if rawConfig, err := bcl.dynamicConfiguration.GetConfig(key,       config_center.WithGroup(constant.DUBBO)); err != nil {
	//set configurators to empty
	bcl.configurators = []config_center.Configurator{}
	return
}

     if len(rawConfig) > 0 {
       ...
     }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If no else here, I can not access the variable rawConfig produced above.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pls see it carefully. What I mean is that just 'deleting the else word'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AlexStocks I means this if I delete else ,then I can not access the variable rawConfig.

registry/base_configuration_listener.go Show resolved Hide resolved
registry/consul/registry.go Show resolved Hide resolved
registry/consul/registry.go Show resolved Hide resolved
registry/consul/registry.go Show resolved Hide resolved
registry/zookeeper/registry.go Show resolved Hide resolved
registry/zookeeper/registry.go Show resolved Hide resolved
registry/zookeeper/registry.go Show resolved Hide resolved
registry/zookeeper/registry.go Show resolved Hide resolved
registry/protocol/protocol_test.go Outdated Show resolved Hide resolved
common/url_test.go Outdated Show resolved Hide resolved
common/url_test.go Outdated Show resolved Hide resolved
registry/consul/registry.go Outdated Show resolved Hide resolved
return
}
logger.Warnf("getListener() = err:%v", perrors.WithStack(err))
time.Sleep(time.Duration(RegistryConnDelay) * time.Second)
Copy link

Choose a reason for hiding this comment

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

Why we need sleep before continue? What we are waiting for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we need a sleep to resubscribe registry when registry subscribe return error instead of subscribing registry in for loop.

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 may reduce the CPU percent.

Copy link

Choose a reason for hiding this comment

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

@hxmhlt Ok.


listener, err := r.subscribe(url)
if err != nil {
if !r.IsAvailable() {
Copy link

Choose a reason for hiding this comment

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

Why we need to check registry alive here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If registry is not alive, we do not need to resubsribe but only return the for loop.

Copy link

Choose a reason for hiding this comment

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

@hxmhlt Ok.

@gaoxinge
Copy link

gaoxinge commented Sep 9, 2019

LGTM.

@fangyincheng
Copy link
Contributor

update readme for before_ut.sh

@AlexStocks
Copy link
Contributor

LGTM

@AlexStocks AlexStocks merged commit ef14088 into apache:develop Sep 17, 2019
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.

5 participants