apache / apache/servicecomb-java-chassis
SDK支持契约每次启动覆盖(和environment无关),但是注册中心不支持非开发环境覆盖
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 814
- Avg merge
- 8d 23h
- Merged PRs (30d)
- 1
Description
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的问题 ?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing onlineSchemaIsModifiable() and ServiceRegistryConfig.INSTANCE.isAlwaysOverrideSchema() in the SDK, then compare that behavior with the production-mode rejection shown from service/schema.go. Determine how the SDK setting and registry policy should interact so test deployments can overwrite an existing schema without incrementing its version, and verify the resulting registration behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100