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

[SCB-662]Using cse/servicecomb duplicate key will get list of values #767

Merged
merged 1 commit into from Jun 19, 2018
Merged

[SCB-662]Using cse/servicecomb duplicate key will get list of values #767

merged 1 commit into from Jun 19, 2018

Conversation

liubao68
Copy link
Contributor

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SCB-XXX] Fixes bug in ApproximateQuantiles, where you replace SCB-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

source.addProperty(cseKey, source.getProperty(key));
} else {
LOGGER
.warn(
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if the warning message is enough for this time, if the configuration is wrong, java-chassis may need to stop working instead of sending out the warning message to let the admin know about it.
BTW, we may need a default override policy here.

Copy link
Contributor Author

@liubao68 liubao68 Jun 13, 2018

Choose a reason for hiding this comment

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

As shown in test case, this can work. Just when merge, it will not take the cse-config-order(which is implemented by file configuration source). We can not cover all orders for Configuration sources like enviroment, properties, dynamic config and so on, so give a warning message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"stop working" can not be applied because we may configure some default values using cse or servicecomb, if doing this users code have to change to work properly. We can't do this now.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 87.349% when pulling 37c4e37 on liubao68:config-dup into b81196f on apache:master.

@@ -171,7 +171,14 @@ private static void duplicateServiceCombConfigToCse(AbstractConfiguration source
}

String cseKey = CONFIG_CSE_PREFIX + key.substring(key.indexOf(".") + 1);
source.addProperty(cseKey, source.getProperty(key));
if (!source.containsKey(cseKey)) {
source.addProperty(cseKey, source.getProperty(key));
Copy link
Contributor

Choose a reason for hiding this comment

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

source.setProperty is better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

source.setProperty will clear and add. Here we checked existence and logged a warning message.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@liubao68 liubao68 merged commit ad2bb00 into apache:master Jun 19, 2018
@@ -36,6 +36,8 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

import com.netflix.config.DynamicPropertyFactory;
Copy link
Member

Choose a reason for hiding this comment

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

This import can be removed.

@liubao68 liubao68 deleted the config-dup branch March 9, 2021 10:54
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.

None yet

4 participants