[5.4.10] cherry-pick ZSTAC vhost and query fixes#4383
Conversation
|
Warning
|
| Layer / File(s) | Summary |
|---|---|
查询核心逻辑提取 search/src/main/java/org/zstack/query/QueryFacadeImpl.java |
新增 doQuery(APIQueryMessage msg),负责 @AutoQuery 反射解析、创建 APIQueryReply、调用 queryUseZQL 并写回 total/inventories;OperationFailureException 继续抛出,其它异常包装为 CloudRuntimeException。 |
同步执行与错误回复重写 search/src/main/java/org/zstack/query/QueryFacadeImpl.java |
handle(APIQueryMessage msg) 改为使用 thdf.syncSubmit 在同步任务中调用 doQuery,捕获 OperationFailureException 时构造带错误码的空 APIQueryReply,最终统一通过 bus.reply 返回。 |
Estimated code review effort: 2 (Simple) | ~10 minutes
Sequence Diagram(s)
sequenceDiagram
participant Caller
participant handle
participant syncSubmit
participant doQuery
Caller->>handle: APIQueryMessage
handle->>syncSubmit: 提交同步任务
syncSubmit->>doQuery: 调用 doQuery(msg)
doQuery-->>syncSubmit: 返回 reply 或抛出 OperationFailureException
syncSubmit-->>handle: 结果/异常
handle->>Caller: bus.reply(msg, reply)
Poem
小兔跳进代码林,
拆开查询两段行,
同步任务稳稳跑,
异常也能好好回,
耳朵一动查询成~ 🐰✨
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | 标题与该补丁的回溯修复和查询相关修改一致,但表述略偏宽泛。 |
| Description check | ✅ Passed | 描述明确说明了这是为 5.4.10 批次回溯 5.x 修复,和变更内容一致。 |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| 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. |
✨ 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/shan.wu/backport/5.4.10/ZSTAC-86486-batch@@3
Comment @coderabbitai help to get the list of available commands.
Route AutoQuery handling through the query sync queue so bursty GraphQL refreshes cannot run unlimited APIQueryMessage requests concurrently. Resolves: ZSTAC-80742 Change-Id: If2c052e539526cd0511e037d1718838bdb65a7a3
8c63d20 to
ada4787
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
search/src/main/java/org/zstack/query/QueryFacadeImpl.java (1)
350-381: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win补上
APIQueryMessage的通用异常回复search/src/main/java/org/zstack/query/QueryFacadeImpl.java:384-396
doQuery()仍会把反射/ZQL 异常抛成CloudRuntimeException,而这里的call()只处理OperationFailureException。DispatchQueueImpl.SyncTaskFuture.run()只会记录异常,不会自动生成bus.reply,所以这条路径还是会丢回复并让调用方超时。建议补一个通用catch,或在doQuery()内统一转成可回包的失败结果。🤖 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 `@search/src/main/java/org/zstack/query/QueryFacadeImpl.java` around lines 350 - 381, QueryFacadeImpl.doQuery currently turns reflection/ZQL failures into CloudRuntimeException, but APIQueryMessage.call only handles OperationFailureException, so the request can fail without a reply. Update doQuery and/or call to catch all unexpected exceptions from replyClass instantiation, replySetter invocation, or queryUseZQL, and convert them into a proper APIQueryReply failure path that can be sent back via bus.reply instead of leaking as an unhandled runtime exception.
🤖 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.
Outside diff comments:
In `@search/src/main/java/org/zstack/query/QueryFacadeImpl.java`:
- Around line 350-381: QueryFacadeImpl.doQuery currently turns reflection/ZQL
failures into CloudRuntimeException, but APIQueryMessage.call only handles
OperationFailureException, so the request can fail without a reply. Update
doQuery and/or call to catch all unexpected exceptions from replyClass
instantiation, replySetter invocation, or queryUseZQL, and convert them into a
proper APIQueryReply failure path that can be sent back via bus.reply instead of
leaking as an unhandled runtime exception.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a4b9cbe2-8259-49d7-b890-6257dc1a6edf
📒 Files selected for processing (1)
search/src/main/java/org/zstack/query/QueryFacadeImpl.java
Summary
Cherry-pick 5.x fixes for the new 5.4.10 ZSTAC batch.
Included Jira
Source MR
Testing
Related: ZSTAC-86468 ZSTAC-86449
sync from gitlab !10343