apache / apache/servicecomb-java-chassis
[BUG] - 契约加载问题
- Langage dominant
- Java
- Étoiles
- 1.9k
- Forks
- 814
- Merge moyen
- 8 j 23 h
- PR mergées (30 j)
- 1
Description
### Steps to Reproduce
一、问题
1. 设置versionRule=0.0.0.0+,而非latest
2. B作为服务端,高版本离线,低版本在线,且低版本存在新接口,
A作为消费端,测试调用新接口的情况,报契约问题;
将B的低版本号改为更高版本号,测试通过。
二、怀疑原因
在findLatest函数中只加载了最大版本的契约,不符合文档描述
findLatest:170, MicroserviceVersionRule (org.apache.servicecomb.registry.consumer)
initData:150, MicroserviceVersionRule (org.apache.servicecomb.registry.consumer)
createDataByOtherRule:229, MicroserviceVersionRule (org.apache.servicecomb.registry.consumer)
日志打印:
[oup0-1-thread-1] [ MicroserviceVersions] --- create MicroserviceVersionRule, appId=XXX, microserviceName=XXX, versionRule=0.0.0.0+.
三、文档描述
https://servicecomb.incubator.apache.org/references/java-chassis/2.x/zh_CN/build-consumer/with-contract.html
version-rule是版本匹配规则,有四种格式:
精确版本匹配:例如version-rule: 0.0.1,表示只匹配版本号为0.0.1的服务提供者
后续版本匹配:例如version-rule: 1.0.0+,表示匹配版本号大于或等于1.0.0的服务提供者
最新版本:version-rule: latest,表示匹配最新版本的服务提供者
版本范围:例如1.0.0-2.0.2,表示匹配版本号在1.0.0至2.0.2之间的服务提供者,包含1.0.0和2.0.2
此配置项默认为latest
### Expected Behavior
期望在配置0+的versionRule时,能加载所有契约或加载在线实例的契约
### Servicecomb Version
2.8.24
### Additional Context
业务有诉求,不能保证单个微服务每次升级的版本号是递增的
_No response_
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Start by reading findLatest, initData, and createDataByOtherRule in MicroserviceVersionRule, then compare their behavior with the linked version-rule documentation. Reproduce the 0.0.0.0+ case using the stated online and offline service versions. Done means the configured rule loads the contracts needed for the new interface and the consumer call succeeds.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- backend-api-design, distributed-systems
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 48/100