Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Bug] PD task REST: balanceLeaders throws a bare HTTP 500 during the balance-shard window, and task responses cannot be told apart from a no-op or a follower answer

Abierto Apto para principiantes
#3,231 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
70/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java
Área
api, backend

Línea de trabajo

El error está en TaskAPI.java líneas 92-95, donde balanceLeaders lanza PDException sin un manejador. Compara con endpoints hermanos como patrolPartitions que capturan y devuelven toJSON(e). También examina TaskScheduleService.java:478 para el mensaje de error. Después de corregir, prueba los endpoints REST /v1/task/balanceLeaders y /v1/task/patrolPartitions para asegurar que devuelvan JSON adecuado en lugar de un 500 desnudo.

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

Descripción

Bug Type (问题类型)

rest-api (结果不合预期)

Before submit
  • I have confirmed and searched that there are no similar problems in the historical issue and documents
Environment (环境信息)
  • Server Version: master 83ef9f3 (pd image sha256:69dc1d4e8625)
  • Backend: HStore, 3 PD + 3 Store, 12 shard groups
  • OS: kind v0.33 (Kubernetes 1.37.0)
Expected & Actual behavior (期望与实际表现)

Measured 2026-09-22 while executing the documented recovery sequence (patrolPartitions, balanceLeaders, balancePartitions) on the PD leader with a follower as control:

  1. GET /v1/task/balanceLeaders within 180 s of a balancePartitions call (which sets the balance-shard key even when it moves nothing) answers {"timestamp":...,"status":500,"error":"Internal Server Error","path":"/v1/task/balanceLeaders"} with no reason. The reason (PDException: balance shard is processing, please try later!, TaskScheduleService.java:478) appears only in the PD log. Cause: TaskAPI.balanceLeaders (TaskAPI.java:92-95) declares throws PDException with no handler, while its siblings catch and return toJSON(e). One-line fix.
  2. GET /v1/task/patrolPartitions returns the byte-identical body {"status": 0,"partitions": [ ]} on the leader and on a follower, whether or not it repaired anything; a follower does no work and reports success. balancePartitions differs by two bytes ({} from the leader, empty body from a follower). Operators driving recovery over REST cannot tell "ran and repaired", "ran, nothing to do" and "hit a follower, did nothing" apart without reading PD logs.

Ask: catch the PDException in balanceLeaders like the sibling endpoints; and have the task endpoints either redirect to the leader (as the read APIs do via getMembers) or answer an explicit error naming the leader, plus include what was done (groups reallocated, leaders moved, partitions moved) in the body.

Lenguaje dominante
Java
Estrellas
3.2k
Forks
637
Merge medio
3 d 21 h
PR fusionados (30 d)
21

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/hugegraph

Todos los issues de apache/hugegraph

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.