feat: gh-ost 完整策略引擎 — 13项配置+环境差异+云数据库适配+DDL智能分析

配置项(13项):
- ghost_enabled: 全局开关(默认关闭)
- ghost_default_mode: 默认执行模式(dry_run/execute)
- ghost_osc_priority: OSC优先级(native_first/ghost_first/ghost_only)
- ghost_env_mode: 环境模式(development/production)
- ghost_cloud_type: 云数据库类型(self_hosted/aliyun_rds/polardb/aws_aurora)
- ghost_auto_trigger_rows: 自动触发行数阈值(万)
- ghost_auto_trigger_ddl: 自动触发DDL类型
- ghost_path/chunk_size/max_load/critical_load/max_lag_millis/allow_on_master

新增API:
- GET /ghost/config: 查看全部gh-ost配置
- POST /ghost/analyze: DDL智能分析(解析DDL类型+行数检查+策略推荐)
- 云数据库: --aliyun-rds / --aws 自动适配

策略逻辑:
- native_first + development → 推荐Native DDL
- native_first + production + DDL匹配 → 推荐gh-ost
- ghost_first/ghost_only → 强制gh-ost
- 行数超阈值 → 额外推荐gh-ost
This commit is contained in:
logan committed 2026-05-27 00:22:33 +08:00
1 parent 5d59ca427e
commit b2b13661fd
3 files changed
+253 -35

No files matched your search

+2
View File
@@ -141,6 +141,8 @@ func Setup(r *gin.Engine) {
ghostGroup := auth.Group("")
ghostGroup.Use(middleware.RequireRole("admin", "dba"))
{
ghostGroup.GET("/ghost/config", handler.GhOstGetConfig)
ghostGroup.POST("/ghost/analyze", handler.GhOstAnalyzeDDL)
ghostGroup.POST("/ghost/dry-run", handler.GhOstDryRun)
ghostGroup.POST("/ghost/execute", handler.GhOstExecute)
ghostGroup.GET("/ghost/status/:taskId", handler.GhOstStatus)