apache / apache/servicecomb-java-chassis
SDK支持契约每次启动覆盖(和environment无关),但是注册中心不支持非开发环境覆盖
- Lingua principale
- Java
- Stelle
- 1.9k
- Fork
- 814
- Merge medio
- 8g 23h
- PR unite (30g)
- 1
Descrizione
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的问题 ?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia tracciando onlineSchemaIsModifiable() e ServiceRegistryConfig.INSTANCE.isAlwaysOverrideSchema() nell'SDK, quindi confronta tale comportamento con il rifiuto in modalità produzione mostrato in service/schema.go. Determina come dovrebbero interagire l'impostazione dell'SDK e la policy del registry affinché i deployment di test possano sovrascrivere uno schema esistente senza incrementarne la versione, quindi verifica il comportamento di registrazione risultante.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100