apache / apache/servicecomb-java-chassis
SDK支持契约每次启动覆盖(和environment无关),但是注册中心不支持非开发环境覆盖
- 主要语言
- Java
- 星标
- 1.9k
- 派生
- 814
- 平均合并
- 8 天 23 小时
- 30 天内合并 PR
- 1
描述
SDK在检测到契约不一致时,判断是否可以注册契约是或的关系,从代码看可以理解为环境为开发环境或者配置servicecomb.service.registry.instance.alwaysOverrideSchema为true就可以覆盖契约。
```
if (onlineSchemaIsModifiable()) {
LOGGER.warn(
"schema[{}]'s content is changed and the current environment is [{}], so re-register it. It's recommended "
+ " to change servicecomb_description.version after schema change, or restart consumer to"
+ " make changes get notified.",
localSchemaEntry.getKey(),
microservice.getEnvironment());
return registerSingleSchema(localSchemaEntry.getKey(), localSchemaEntry.getValue());
}
```
```
private boolean onlineSchemaIsModifiable() {
return ServiceCombConstants.DEVELOPMENT_SERVICECOMB_ENV.equalsIgnoreCase(microservice.getEnvironment())
|| ServiceRegistryConfig.INSTANCE.isAlwaysOverrideSchema();
}
```
但是注册中心会给出报错:
2022-11-09T10:19:21.431+0800 ERROR service/schema.go:638 production mode, schema[47c80fa9eb5be73c2a7a7f6a1fa5e8bb70c2e9de/*_mgr] already exist, can not be changed, operator: 10.30.116.57
2022-11-09T10:19:21.431+0800 ERROR service/schema.go:547 modify schema[47c80fa9eb5be73c2a7a7f6a1fa5e8bb70c2e9de/*_mgr] failed, operator: 10.30.116.57 {"error": "Not allowed to modify schema(schema already exist, can not be changed in production)"}
这个问题应该如何解决或者规避 ?避免测试环境每次部署环境需要版本号+1的问题 ?
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先跟踪 SDK 中的 onlineSchemaIsModifiable() 和 ServiceRegistryConfig.INSTANCE.isAlwaysOverrideSchema(),然后将该行为与 service/schema.go 中所示的生产模式拒绝进行比较。确定 SDK 设置与注册表策略应如何交互,使测试部署能够覆盖现有 schema 而不递增其版本,并验证最终的注册行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100