forked from zstackio/zstack
-
Notifications
You must be signed in to change notification settings - Fork 0
[ZSTAC-85134] Carry cache pool capacity in KVM responses #3958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zstack-robot-2
wants to merge
1
commit into
feature-5.5.6-local-cache
Choose a base branch
from
sync/haidong.pang/codex/ZSTAC-85134-refresh-cache-pool-capacity@@3
base: feature-5.5.6-local-cache
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5272,19 +5272,21 @@ public static class DetachVolumeCacheCmd extends AgentCommand implements HasThre | |
| public static class PoolRsp extends AgentResponse { | ||
| public String poolUuid; | ||
| public String mountPoint; | ||
| public Long totalCapacity; | ||
| public Long availableCapacity; | ||
| public Long totalPhysicalCapacity; | ||
| public Long availablePhysicalCapacity; | ||
| public Long systemUsedCapacity; | ||
| } | ||
|
|
||
| public static class PoolHealthRsp extends AgentResponse { | ||
| public String poolUuid; | ||
| public String mountPoint; | ||
| public Boolean healthy; | ||
| public String reason; | ||
| } | ||
|
Comment on lines
5272
to
5287
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 缓存池响应模型未完整对齐容量协议(缺 当前实现会导致容量字段集合不完整,并且健康响应无法复用同一容量载体;这与本次“统一从响应刷新容量”的目标不一致。 建议修改 public static class PoolRsp extends AgentResponse {
public String poolUuid;
public String mountPoint;
public Long total;
+ public Long used;
public Long available;
public Long allocated;
public Long dirty;
}
-public static class PoolHealthRsp extends AgentResponse {
+public static class PoolHealthRsp extends PoolRsp {
public Boolean healthy;
public String reason;
}Also applies to: 5286-5287, 5295-5298 🤖 Prompt for AI Agents |
||
|
|
||
| public static class PoolCapacityRsp extends AgentResponse { | ||
| public Long total; | ||
| public Long used; | ||
| public Long available; | ||
| public Long allocated; | ||
| public Long dirty; | ||
| public static class PoolCapacityRsp extends PoolRsp { | ||
| } | ||
|
|
||
| public static class CacheRsp extends AgentResponse { | ||
|
|
@@ -5293,7 +5295,7 @@ public static class CacheRsp extends AgentResponse { | |
| public Long actualSize; | ||
| } | ||
|
|
||
| public static class GCPoolRsp extends AgentResponse { | ||
| public static class GCPoolRsp extends PoolRsp { | ||
| public List<String> gcFiles; | ||
| public Integer gcCount; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新增列名需使用反引号包裹,且升级场景未正确处理。
根据编码规范,所有列名必须使用反引号包裹以避免 MySQL 8.0 / GreatSQL 保留关键字冲突。此外,
CREATE TABLE IF NOT EXISTS语句在表已存在时不会添加新列,升级场景需要使用ALTER TABLE或存储过程来处理。建议修改:添加 ALTER TABLE 语句处理升级场景
CREATE TABLE IF NOT EXISTS `HostCacheStoreCapacityVO` ( `uuid` VARCHAR(32) NOT NULL, `totalCapacity` BIGINT NOT NULL DEFAULT 0, `availableCapacity` BIGINT NOT NULL DEFAULT 0, - `totalPhysicalCapacity` BIGINT NOT NULL DEFAULT 0, - `availablePhysicalCapacity` BIGINT NOT NULL DEFAULT 0, - `systemUsedCapacity` BIGINT NOT NULL DEFAULT 0, + `totalPhysicalCapacity` BIGINT NOT NULL DEFAULT 0, + `availablePhysicalCapacity` BIGINT NOT NULL DEFAULT 0, + `systemUsedCapacity` BIGINT NOT NULL DEFAULT 0, PRIMARY KEY (`uuid`), ... ) ENGINE = InnoDB DEFAULT CHARSET = utf8; +-- Handle upgrade scenario: add new columns if table already exists +CALL AddColumnIfNotExists('zstack', 'HostCacheStoreCapacityVO', 'totalPhysicalCapacity', 'BIGINT NOT NULL DEFAULT 0'); +CALL AddColumnIfNotExists('zstack', 'HostCacheStoreCapacityVO', 'availablePhysicalCapacity', 'BIGINT NOT NULL DEFAULT 0'); +CALL AddColumnIfNotExists('zstack', 'HostCacheStoreCapacityVO', 'systemUsedCapacity', 'BIGINT NOT NULL DEFAULT 0');As per coding guidelines: "所有表名和列名必须使用反引号包裹" 以及 "When
NOT NULLexists, must usestored procedureor other functions to process historical data"。🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment from haidong.pang:
未发布功能,不考虑该场景
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zstack-robot-2,明白了,既然HostCacheStoreCapacityVO是尚未发布的新表,不存在需要升级的历史数据,CREATE TABLE IF NOT EXISTS方式完全可行,无需额外的ALTER TABLE升级路径。感谢说明!(^・ω・^ )
🧠 Learnings used