Skip to content

feat: support Redis cluster connection mode - #3347

Merged
Seechi-Yolo merged 1 commit into
mainfrom
dev-decathlon-redis-cluster-conn-937
Jul 23, 2026
Merged

feat: support Redis cluster connection mode#3347
Seechi-Yolo merged 1 commit into
mainfrom
dev-decathlon-redis-cluster-conn-937

Conversation

@LordofAvernus

@LordofAvernus LordofAvernus commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

User description

Related issue

https://github.com/actiontech/dms-ee/issues/937

Changes

  • Support Redis standalone and Cluster connection mode submission scope for sqle.
  • Preserve standalone compatibility while enabling explicit Cluster mode.

Description

  • 新增 Redis Cluster 连接模式判定逻辑

  • 新增 checkDbConnectableReq 结构用于请求校验

  • 添加 isRedisClusterConnectReq 函数检测连接模式

  • 改进用户为空时的错误处理逻辑


Diagram Walkthrough

flowchart LR
  A["新增 checkDbConnectableReq 结构"] -- "用于请求校验" --> B["修改 CheckInstanceIsConnectable 函数"]
  B -- "调用校验逻辑" --> C["调用 isRedisClusterConnectReq 函数"]
  C -- "返回判断结果" --> D["执行错误处理"]
Loading

File Walkthrough

Relevant files
Enhancement
instance.go
新增 Redis Cluster 连接模式检测及错误处理                                                         

sqle/api/controller/v1/instance.go

  • 引入 strings 包支持忽略大小写比较
  • 新增 checkDbConnectableReq 请求结构
  • 添加 isRedisClusterConnectReq 函数检测 Redis Cluster 模式
  • 修改 CheckInstanceIsConnectable 中的用户为空校验逻辑
+26/-1   

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

🎫 Ticket compliance analysis 🔶

937 - Partially compliant

Compliant requirements:

  • 实现了 Redis Cluster 连接模式判定逻辑(isRedisClusterConnectReq)
  • 新增了 checkDbConnectableReq 结构及相应错误处理逻辑

Non-compliant requirements:

[]

Requires further human verification:

[]

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
改进大小写比较

建议对字符串 "cluster" 进行不区分大小写的比较,防止由于大小写不一致导致判断错误。使用 strings.EqualFold 可以提高代码的健壮性。

sqle/api/controller/v1/instance.go [248-250]

 if item != nil && item.Name == "connection_mode" {
-        return item.Value == "cluster"
+        return strings.EqualFold(item.Value, "cluster")
     }
Suggestion importance[1-10]: 8

__

Why: The suggestion improves robustness by using strings.EqualFold for a case-insensitive comparison of the value "cluster", which directly enhances the behavior of the isRedisClusterConnectReq function.

Medium

@Seechi-Yolo
Seechi-Yolo merged commit a80305d into main Jul 23, 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.

2 participants