apolloconfig / apollo

Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
https://www.apolloconfig.com
Apache License 2.0
29.19k stars 10.21k forks source link

创建多个不同的AppId的Config有多个bug #5159

Closed qq31715879 closed 3 months ago

qq31715879 commented 5 months ago

描述bug 创建多个不同的AppId的Config有多个bug 1.com.ctrip.framework.apollo.ConfigService#getConfig image 通过DefaultConfigManager创建getConfig, 内置 private Map<String, Config> m_configs = Maps.newConcurrentMap(); key是namespace, 但是不同的appid下的namespace可以相同, 然而apollo中还有集群这个维度, 所以这里简单的用namespace不合理

2.手动避开namespace重复问题, 虽然能get不同的config, 但是第二个config无法获取配置

这是配置1 可以正常获取 image 这是配置2, 无法获取配置 image

这是证明只创建一个配置2, 可以正常获取配置的截图 image

简洁明了地描述一下bug

复现

通过如下步骤可以复现:

期望

简介明了地描述你希望正常情况下应该发生什么

截图

如果可以,附上截图来描述你的问题

额外的细节和日志

qq31715879 commented 5 months ago

com.ctrip.framework.apollo.util.ConfigUtil#getAppId 这里获取appid没有获取最新的

qq31715879 commented 5 months ago

com.ctrip.framework.apollo.internals.RemoteConfigRepository#loadApolloConfig image 修改了这里能获取到第二个appid所属配置, 但是观测整体架构是应对获取单个appid而写的client jar

qq31715879 commented 5 months ago

总结一下有两处bug 1.namespace有缓存; 不同app.id需要设置不同的namespace可以跳过

2.app.id有缓存; 创建第二个config的时候, 无法指定新的app.id; app.id是全局的, 就算能修改, 也会影响其他config com.ctrip.framework.apollo.internals.AbstractConfigRepository#trySync com.ctrip.framework.apollo.internals.RemoteConfigRepository#loadApolloConfig

nobodyiam commented 5 months ago

apollo-client 还没有支持多 app.id,你这个是自己实现的吗?

see https://github.com/apolloconfig/apollo-java/discussions/65

qq31715879 commented 5 months ago

是的, 简易修改的代码; 阅读apollo-client代码之后, 感觉apollo-client更像是一个简单的实例, 如果能支持多实例就好了

stale[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

stale[bot] commented 3 months ago

This issue has been automatically closed because it has not had activity in the last 7 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.