[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
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
错误位于 TaskAPI.java 第 92-95 行,其中 balanceLeaders 抛出 PDException 时没有处理器。请与同级端点(如 patrolPartitions)进行比较,后者会捕获异常并返回 toJSON(e)。同时检查 TaskScheduleService.java:478 以获取错误信息。修复后,请测试 REST 端点 /v1/task/balanceLeaders 和 /v1/task/patrolPartitions,确保它们返回正确的 JSON 而不是裸的 500 错误。
由索引模型根据 Issue 内容生成。
描述
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 imagesha256: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:
GET /v1/task/balanceLeaderswithin 180 s of abalancePartitionscall (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) declaresthrows PDExceptionwith no handler, while its siblings catch and returntoJSON(e). One-line fix.GET /v1/task/patrolPartitionsreturns 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.balancePartitionsdiffers 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.
- 主要语言
- Java
- 星标
- 3.2k
- 派生
- 637
- 平均合并
- 3 天 21 小时
- 30 天内合并 PR
- 21
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/hugegraph 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 64/100
apache/hugegraph#3142 · 7 条评论 ·
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 2 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 2 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
apache/hugegraph#3238 · 2 条评论 ·
维护者通常 2 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Content
难度 2/5 1-3 小时 新手友好度 68/100
RunestoneInteractive/rs#1559 · 1 条评论 ·
维护者通常 2 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 86/100
inu-appcenter/memorIN-backend#298 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
opendataloader-project/opendataloader-pdf#757 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
redhat-developer/intellij-quarkus#1626 ·