Repository navigation
fix(pl): schedule system package installation immediately on startup - #2717
Merged
Merged
Conversation
footka
marked this pull request as ready for review
November 20, 2026 02:55
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
任务描述
SEEK-1414,与 #2635 处理同一个冷启动问题。全新数据目录首次连上主库后立即执行下面的 SQL,原版可能在执行阶段返回 5935。
根因
原版每 3 秒运行一次建包任务。首次回调创建管理任务,后续回调才执行建包。直接 CALL 的解析器会等待全局内存标记,等到包就绪后返回 OB_SCHEMA_EAGAIN。SQL 重试将请求标为 IN_RETRY,导致 DBMS_STATS 在第一次实际进入统计过程时就拒绝执行。
解决方案
主库首次部署和已有目录重启走同一个元数据就绪入口。schema 和时区检查成功后,只提交异步任务,建包与 SQL 服务启动可以并行。只读备库靠日志回放获得包。在线备升主沿用本地日志服务的激活回调。
删除配置项
_enable_async_load_sys_package和同步等待接口。普通系统包统一异步安装;bootstrap 原有的特殊系统包加载顺序保持不变。建包 timer 首次立即执行,在同一回调创建并执行管理任务,安装失败时按 3 秒间隔重试,成功后取消。重启复用已有管理任务记录。删除 SQL 解析器的全局就绪等待。包不存在或只有声明时,CALL 和包函数返回原有解析错误,稍后可以重新发起请求。
验证
Linux,2 CPU、4 GiB。使用本机依赖缓存,以 Bazel
-j32构建完整 seekdb,启动日志版本为本 PR head 3798ce9。git diff --check 通过。本轮使用两个独立实例实际执行 SQL,未运行整套 mysqltest。同一用例在原版和候选上均观察到新主库本地 LOAD_MYSQL_SYS_PACKAGE 任务计数为 0,即使包目录已回放完整,后台也会再执行一次安装。候选另行核对了已删除配置在参数虚表中的行数为 0。表内启动耗时为单轮观测。
此前以 1e45cf4 为原版基线,Linux 2 CPU、4 GiB、新数据目录,SELECT 1 首次成功后执行上述 CALL,5 轮均在 4.37–4.57 秒后报 5935。此前在沿用相同 SQL 解析路径的草稿 6a52bba 上,注入一次中断并确认目录中只有 DBMS_STATS 声明。CALL 和包函数均报 5559;补齐包体后 CALL 成功,函数返回 31。
影响范围
首次部署、重启和角色切换时普通系统包的安装,以及包相关 SQL 的名称解析。删除隐藏参数后,相应更新参数目录的 mysqltest 期望列表。Windows 和升主中断后的恢复未实测。
合入理由
普通包的安装离开对外服务的关键路径。已可见的包依照 schema 直接解析,提前到达的请求沿用已有错误码,避免原有等待制造的 5935。