apache / apache/servicecomb-java-chassis

[BUG] - 契约加载问题

Abierto
#4,995 0 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Java
Estrellas
1.9k
Forks
814
Merge medio
8 d 23 h
PR fusionados (30 d)
1

Descripción

### 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_

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
backend-api-design, distributed-systems
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.