Skip to content

[host]: ping syncSignature per-host to prevent queue serialization#3948

Open
ZStack-Robot wants to merge 2 commits into
5.5.22from
sync/songtao.liu/fix/ZSTAC-80543-v2
Open

[host]: ping syncSignature per-host to prevent queue serialization#3948
ZStack-Robot wants to merge 2 commits into
5.5.22from
sync/songtao.liu/fix/ZSTAC-80543-v2

Conversation

@ZStack-Robot
Copy link
Copy Markdown
Collaborator

Resolves: ZSTAC-80543

sync from gitlab !9839

zstack and others added 2 commits May 12, 2026 23:57
getSyncSignature() 从固定 "do-ping-host" 改为 "do-ping-host-<hostUuid>",
避免所有物理机 ping 排队在同一个 SyncTaskChain 上互相阻塞。

Resolves: ZSTAC-83192, ZSTAC-79389

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
验证 getSyncSignature() 返回 per-host key 后:
- 同一签名串行执行(same signature = same queue)
- 不同签名并行执行(different host = different queue)

Related: ZSTAC-83192

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

概述

Ping任务的同步签名从全局常量改为包含目标主机UUID的动态值,使不同主机的Ping任务可独立并发调度。新增测试类验证同签名任务序列执行和异签名任务并发执行的行为。

变更

每主机Ping任务同步

层级 / 文件 摘要
Ping任务每主机同步签名
compute/src/main/java/org/zstack/compute/host/HostBase.java
ChainTask同步签名从常量"do-ping-host"改为动态值String.format("do-ping-host-%s", msg.getHostUuid()),使Ping任务的调度键包含目标主机UUID。
同步签名行为测试
test/src/test/java/org/zstack/test/core/thread/TestDispatchQueuePerHostSignature.java
新增测试类包含OrderedTask实现SyncTask接口的助手类,setUp方法初始化ThreadFacade,sameSignatureSerializes验证同签名任务序列执行,differentSignatureConcurrent验证异签名任务并发执行。

代码审查工作量估计

🎯 2 (简单) | ⏱️ ~10 分钟

🐰 一个主机一个键,
Ping任务各自安,
序列并发分得清,
测试验证逻辑坚,
调度繁忙不混乱。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题遵循了要求的格式 '[scope]: ',且长度为66个字符,不超过72个字符的限制。标题清晰地描述了主要变更内容:将ping操作的同步签名改为按主机级别,以防止队列序列化。
Description check ✅ Passed 拉取请求描述与变更集相关,提供了JIRA issue编号(ZSTAC-80543)和GitLab同步信息,这些都与代码变更相关联。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/songtao.liu/fix/ZSTAC-80543-v2

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/src/test/java/org/zstack/test/core/thread/TestDispatchQueuePerHostSignature.java (1)

20-20: ⚡ Quick win

测试类命名不符合仓库规范。

Line 20 的类名 TestDispatchQueuePerHostSignature 未以 TestCase 结尾,建议改为 DispatchQueuePerHostSignatureTest,并同步文件名。
As per coding guidelines “测试类需要以 Test 或 Case 结尾。”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@test/src/test/java/org/zstack/test/core/thread/TestDispatchQueuePerHostSignature.java`
at line 20, Rename the test class TestDispatchQueuePerHostSignature to follow
the repository convention by changing the class name to
DispatchQueuePerHostSignatureTest and update the containing Java file name
accordingly; ensure all references to TestDispatchQueuePerHostSignature in
imports, test suites, or build configs are updated to the new class name to
avoid compilation failures.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@test/src/test/java/org/zstack/test/core/thread/TestDispatchQueuePerHostSignature.java`:
- Line 20: Rename the test class TestDispatchQueuePerHostSignature to follow the
repository convention by changing the class name to
DispatchQueuePerHostSignatureTest and update the containing Java file name
accordingly; ensure all references to TestDispatchQueuePerHostSignature in
imports, test suites, or build configs are updated to the new class name to
avoid compilation failures.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml)

Review profile: CHILL

Plan: Pro

Run ID: 0aab5719-69dc-41f5-992e-122f5f52f1dc

📥 Commits

Reviewing files that changed from the base of the PR and between 57a496a and ad52e6f.

📒 Files selected for processing (2)
  • compute/src/main/java/org/zstack/compute/host/HostBase.java
  • test/src/test/java/org/zstack/test/core/thread/TestDispatchQueuePerHostSignature.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant