Skip to content

feat(locale/audit_plan): add Hive slow log i18n keys and nil guard fix#3325

Merged
Seechi-Yolo merged 5 commits into
mainfrom
feat-2865
May 28, 2026
Merged

feat(locale/audit_plan): add Hive slow log i18n keys and nil guard fix#3325
Seechi-Yolo merged 5 commits into
mainfrom
feat-2865

Conversation

@actiontech-bot

Copy link
Copy Markdown
Member

Fixes actiontech/sqle-ee#2865

Summary

  • Add i18n locale keys for Hive slow log error messages (7 new keys in zh/en/message_zh)
  • Fix nil AuditPlanTaskInfo guard in instance_audit_plan HTTP handlers (prevents panic on legacy data)
  • Regenerate swagger docs after rebase

Test plan

  • go vet passes on CE branch
  • No EE files included in this PR
  • CI build verification

Add 8 new i18n keys shared by CE and EE for the upcoming Hive slow log
audit plan task type:

  - ApMetaHiveSlowLog          (task type display name)
  - ApMetricHiveSlowLogDbUser  (metric column header)
  - HiveSlowLogErrSysDbNotFound
  - HiveSlowLogErrTableNotFound
  - HiveSlowLogErrColumnMismatch
  - HiveSlowLogErrConnectFailed
  - HiveSlowLogErrAuthInvalid
  - HiveSlowLogErrUnknown

The five HiveSlowLogErr* keys carry the operator-facing guidance described
in design §3.5 (Hive HS2 query_history prerequisites and auth misconfig
remediation). Both active.zh.toml / active.en.toml are kept aligned with
the Go variable declarations in message_zh.go.

These files are shared by CE (actiontech/sqle) and EE (actiontech/sqle-ee);
the EE-side files are committed here so that EE feat-2865 can build before
the CE-side counterpart is cherry-picked in code_review.

Refs: actiontech/sqle-ee#2865
main-ee swagger.json already contained the `default_port` field on
DBService-related schemas, but feat-2865 had not been regenerated after
the rebase. Re-run `swag init` (driven by `make install`) to bring the
swagger.json / swagger.yaml / docs.go on this branch back in sync with
main-ee. No source code or behavior changes.
…ill missing task info on save (#2865)

GetInstanceAuditPlans / ConvertAuditPlanTypeToResByID / GetInstanceAuditPlanOverview /
UpdateAuditPlanStatus 直接读 auditPlan.AuditPlanTaskInfo.LastCollectionStatus 而无 nil
守护。当 audit_plans_v2 有行而对应 audit_plan_task_infos 行缺失(或被软删除,GORM 软删
除会让 Preload 返回 nil)时,进程级 panic:

  panic: runtime error: invalid memory address or nil pointer dereference
  at sqle/api/controller/v2/instance_audit_plan.go:339 ConvertAuditPlanTypeToResByID

HTTP handler 在写响应前 panic,连接被关闭,DMS 反向代理把 EOF 包装成 `400 remote
sqle unreachable, could not forward: EOF` 抛给前端,影响「SQL 管控配置」列表 + 详情页。

三处补 nil 守护:
- v2/instance_audit_plan.go ConvertAuditPlanTypeToResByID
- v1/instance_audit_plan.go GetInstanceAuditPlanOverview
- v1/instance_audit_plan.go UpdateAuditPlanStatus(写路径,缺失时按 audit_plan_id 现场建一行)

另在 model/instance_audit_plan.go BatchSaveAuditPlans 的 else 分支(更新已有计划)
补「task_info 不存在则建一行」逻辑,根上避免历史数据/手工改库后再次出现孤行 →
panic 链路彻底闭合。

验证:
- sqled.out 空,sqled.log 自重启后 0 行 Go runtime panic
- 直连 + DMS 代理 6 条 HTTP 全部 200(含 v1 overview / v2 list / v2 detail)
- UI /sqle/project/700300/sql-management-conf 列表 + 单实例详情正常加载
- 单测 TestHiveSlowLog_* / TestHiveTopSQLTaskV2_* / model + controller v1 全部 PASS

Fixes actiontech/sqle-ee#2865
@Seechi-Yolo Seechi-Yolo merged commit 31a7350 into main May 28, 2026
4 checks passed
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.

3 participants