Skip to content

<fix>[db]: allow null hostUuid on shared model cache policy - #4692

Open
ZStack-Robot wants to merge 1 commit into
feature-5.5.32-aiosfrom
sync/ye.zou/fix/ZSTAC-87753
Open

<fix>[db]: allow null hostUuid on shared model cache policy#4692
ZStack-Robot wants to merge 1 commit into
feature-5.5.32-aiosfrom
sync/ye.zou/fix/ZSTAC-87753

Conversation

@ZStack-Robot

Copy link
Copy Markdown
Collaborator

Resolves: ZSTAC-87753

主存储缓存策略改为资源级共享后(hostUuid 置空),AiHostModelCachePolicyVO.hostUuid 需要允许 NULL。

  • V5.5.32__schema.sql 追加幂等 ALTER TABLE ... MODIFY COLUMN hostUuid VARCHAR(32) NULL
  • (hostUuid, sourceRootIdentity) 复合唯一键保留:MySQL 对 NULL 不去重,共享行的重复由 premium 侧写入时收敛(见 premium 同名分支 MR)

配套:premium fix/ZSTAC-87753 → feature-5.5.32-aios

验证:容器 pr-build-bin:2.41test-4 双仓挂载,deploydb 后 AiHostModelCacheControlPlaneCase / AiHostModelCacheStorageAccountingCase / ModelServiceCase 全 PASS。

sync from gitlab !10745

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your current included review allowance is based on your included PR review attempts over the past 7 days.

Next review available in: 3 minutes

Limit details: You’ve used the included review currently available. Your 96 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 64893aca-d16d-4526-ae63-20098c6fb57b

📥 Commits

Reviewing files that changed from the base of the PR and between 9731abd and 4959474.

📒 Files selected for processing (1)
  • conf/db/upgrade/V5.5.32__schema.sql

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Could not fetch remote config from http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml: TimeoutError: The operation was aborted due to timeout
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9acb264a-608a-47c3-b18a-55d2197561fc

📥 Commits

Reviewing files that changed from the base of the PR and between 69cac2d and 9731abd.

📒 Files selected for processing (1)
  • conf/db/upgrade/V5.5.32__schema.sql

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


Walkthrough

本次变更新增数据库迁移,将 AiHostModelCachePolicyVO.hostUuid 修改为可空,以支持不绑定具体主机的资源级缓存策略记录。

Changes

缓存策略模式变更

Layer / File(s) Summary
允许缓存策略共享
conf/db/upgrade/V5.5.32__schema.sql
数据库迁移将 AiHostModelCachePolicyVO.hostUuidVARCHAR(32) 非空字段修改为可空字段。

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: 🔵 Low · up to 9731a

Allowing shared policies with a null hostUuid removes database-level uniqueness for identical shared entries, so concurrent writes or retries could create duplicates unless the write path safely coalesces them. The change is otherwise localized and mergeable with explicit owner follow-up on concurrency-safe deduplication.

Suggested reviewers: alanjager

Poem

兔子敲下迁移键,
主机绑定变轻盈。
缓存策略可共享,
空值也能稳稳行。
耳朵一竖,发布成。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了核心变更:允许共享模型缓存策略的 hostUuid 为空。
Description check ✅ Passed 描述与变更直接相关,并说明了数据库修改、唯一键保留、问题编号和验证结果。
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/ye.zou/fix/ZSTAC-87753

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

Resolves: ZSTAC-87753

Primary-storage model cache policies become resource-level rows shared
by all hosts; shared rows carry hostUuid NULL, so the column must be
nullable. The (hostUuid, sourceRootIdentity) unique key is kept: MySQL
treats NULLs as distinct, and duplicate shared rows are collapsed in
code on write.

Change-Id: I56dbaf8b881619479b192bca710d8d8b86e96f19
@MatheMatrix
MatheMatrix force-pushed the sync/ye.zou/fix/ZSTAC-87753 branch from 9731abd to 4959474 Compare August 20, 2026 02:54
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.

2 participants