-
Notifications
You must be signed in to change notification settings - Fork 13.1k
fix: Remove beta table & migrate to gray #13603
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
base: develop
Are you sure you want to change the base?
Conversation
修复config_info_beta表缺失导致的错误日志问题变更概述问题修复
变更文件
时序图sequenceDiagram
participant NacosServer
participant MySQL
NacosServer->>MySQL: 执行健康检查查询
MySQL-->>NacosServer: 返回config_info_beta表存在响应
NacosServer->>NacosServer: 停止生成数据库连接错误日志
💡 小贴士与 lingma-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.
🔎 代码评审报告
🎯 评审意见概览
严重度 | 数量 | 说明 |
---|---|---|
🔴 Blocker | 0 | 阻断性问题,需立即修复。例如:系统崩溃、关键功能不可用或严重安全漏洞。 |
🟠 Critical | 2 | 严重问题,高优先级修复。例如:核心功能异常或性能瓶颈影响用户体验。 |
🟡 Major | 1 | 主要问题,建议修复。例如:非核心功能缺陷或代码维护性较差。 |
🟢 Minor | 0 | 次要问题,酬情优化。例如:代码格式不规范或注释缺失。 |
总计: 3 个问题
📋 评审意见详情
💡 代码实现建议
以下是文件级别的代码建议,聚焦于代码的可读性、可维护性和潜在问题。
🛢️ distribution/conf/mysql-schema.sql (3 💬)
- config_info_gray表的id字段数据类型变更可能导致兼容性问题 (L46)
- datetime字段精度丢失可能导致时间记录不准确 (L53-L54)
- 唯一键约束变更可能破坏数据完整性 (L61)
🚀 架构设计建议
以下是对代码架构和设计的综合分析,聚焦于跨文件交互、系统一致性和潜在优化空间。
🔍1. 数据库架构不一致性:主键数据类型变更可能引发兼容性问题
在config_info_gray表中,id
字段的数据类型从bigint unsigned
变更为bigint(20)
,而其他表(如config_info_beta)仍使用类似定义。这种数据类型变更可能导致跨表数据操作时出现兼容性问题,例如与使用unsigned类型的历史数据交互时可能出现溢出或类型转换错误。建议统一所有自增主键字段的数据类型定义。
📌 关键代码
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
与历史数据或关联表操作时可能引发类型不匹配错误,导致查询或写入失败
🔍2. 唯一键约束变更破坏数据完整性
config_info_gray表的唯一键从uk_configinfogray_datagrouptenantgray
(包含gray_name
字段)变更为uk_configinfogray_datagrouptenant
(移除了gray_name
)。若业务逻辑依赖原唯一键的约束条件,则可能导致重复数据插入。需确认上游业务代码是否适配了该约束变更。
📌 关键代码
UNIQUE KEY `uk_configinfogray_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
可能产生不符合业务预期的重复数据,导致功能异常
🔍3. 字符集与校对规则不一致
新增的config_info_beta表使用utf8_bin
校对规则,而其他表(如config_info_gray)使用默认的utf8
校对规则。这种不一致可能导致跨表查询时出现字符比较不一致问题,特别是在多语言环境下可能引发数据检索错误。
📌 关键代码
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';
跨表查询时可能出现数据匹配错误,影响业务逻辑准确性
🔍4. 时间精度丢失风险未全局评估
config_info_gray表的gmt_create
/gmt_modified
字段移除了微秒精度(从datetime(3)
改为datetime
),但未确认其他依赖时间精度的表是否也同步调整。若系统存在依赖毫秒级时间戳的业务场景(如审计日志),可能导致时间记录精度丢失。
📌 关键代码
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间'
关键业务操作的时间记录精度下降,影响故障排查与合规审计
🔍5. 新增字段缺乏统一加密策略
config_info_beta表新增的encrypted_data_key
字段默认值设为空字符串,但未与现有加密字段(如config_info表的encrypted_data_key
)保持策略一致。若加密逻辑分散在多个表中,可能增加密钥管理复杂度和安全风险。
📌 关键代码
`encrypted_data_key` varchar(1024) NOT NULL DEFAULT '' COMMENT '密钥',
密钥管理策略不统一可能导致安全漏洞或维护成本增加
审查详情
📒 文件清单 (1 个文件)
📝 变更: 1 个文件
📝 变更文件:
distribution/conf/mysql-schema.sql
💡 小贴士
与 lingma-agents 交流的方式
📜 直接回复评论
直接回复本条评论,lingma-agents 将自动处理您的请求。例如:
-
在当前代码中添加详细的注释说明。
-
请详细介绍一下你说的 LRU 改造方案,并使用伪代码加以说明。
📜 在代码行处标记
在文件的特定位置创建评论并 @lingma-agents。例如:
-
@lingma-agents 分析这个方法的性能瓶颈并提供优化建议。
-
@lingma-agents 对这个方法生成优化代码。
📜 在讨论中提问
在任何讨论中 @lingma-agents 来获取帮助。例如:
-
@lingma-agents 请总结上述讨论并提出解决方案。
-
@lingma-agents 请根据讨论内容生成优化代码。
Thanks for your this PR. 🙏 感谢您提交的PR。 🙏 |
5b1d4ac
to
e3976fd
Compare
This PR seems contain john's commit so that CLA check can't pass. I suggest you close this PR and resubmit a new one without john's commit . |
ok,i will try it again |
42660db
to
ad64abc
Compare
fianlly,get it done. |
finally,remove the onfig_info_beta table,and change the health check sql,and add some test case. |
The Indent problem still not fix |
…ve SQL formatting
ad64abc
to
56cc1cd
Compare
finally,pass ,result @KomachiSion 检查完成。 |
OK, I will rerun the CI. |
@wqyenjoy It seems some problem in compile |
i will solve this problem
…---Original---
From: "杨翊 ***@***.***>
Date: Mon, Jul 21, 2025 10:19 AM
To: ***@***.***>;
Cc: ***@***.******@***.***>;
Subject: Re: [alibaba/nacos] fix: Remove beta table & migrate to gray (PR#13603)
KomachiSion left a comment (alibaba/nacos#13603)
@wqyenjoy It seems some problem in compile
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
What does this PR do?
This PR fixes issue #13538 by restoring the
config_info_beta
table definition inmysql-schema.sql
. This prevents false error logs reporting "master db xxx.xxx.xxx.xxx down" when the table is queried but doesn't exist.Why are we doing this?
In Nacos 2.5.1, the
config_info_beta
table was removed from the MySQL schema, but some service implementations likeExternalConfigInfoBetaPersistServiceImpl
still attempt to access it. This causes error logs innacos-persistence.log
even though the database is actually working fine.How to test this PR?
Special notes for reviewer
This is a temporary solution. A more thorough fix would be to update all database health checks to consistently use
config_info_gray
instead ofconfig_info_beta
. I plan to address this in a follow-up PR.