Repository: OpenAtomFoundation/pikiwidb (language: cpp)

Issue:
add a command which is similar to "info" command of pika to fetch basic statics data from codis 
### Is this a regression?

Yes

### Description

给codis-proxy添加info信息 可以获取到版本，运行状态等
比如：
codis的版本号、编译时间、运行状态等

### Please provide a link to a minimal reproduction of the bug

_No response_

### Screenshots or videos

_No response_

### Please provide the version you discovered this bug in (check about page for version information)

_No response_

### Anything else?

_No response_


Discussion / hints:
 
> Bot detected the issue body's language is not English, translate it automatically.      
----  
**Title:** Add info information to codis-proxy to get the version, running status, etc.    
      
@guoweijian
 
> Bot detected the issue body's language is not English, translate it automatically.         
----    
@ Fruit is not seen  
      
@AlexStocks, the info command that we want may conflict with the already existing codis INFO command. So we name it another one.

Fix patch:
diff --git a/codis/pkg/proxy/session.go b/codis/pkg/proxy/session.go
index 26137d2182..0cd2ac868c 100644
--- a/codis/pkg/proxy/session.go
+++ b/codis/pkg/proxy/session.go
@@ -14,6 +14,7 @@ import (
 
 	"pika/codis/v2/pkg/models"
 	"pika/codis/v2/pkg/proxy/redis"
+	"pika/codis/v2/pkg/utils"
 	"pika/codis/v2/pkg/utils/errors"
 	"pika/codis/v2/pkg/utils/log"
 	"pika/codis/v2/pkg/utils/sync2/atomic2"
@@ -299,6 +300,8 @@ func (s *Session) handleRequest(r *Request, d *Router) error {
 		return s.handleQuit(r)
 	case "AUTH":
 		return s.handleAuth(r)
+	case "CODIS.INFO":
+		return s.handleCodisInfo(r)
 	}
 
 	if !s.authorized {
@@ -361,6 +364,22 @@ func (s *Session) handleAuth(r *Request) error {
 	return nil
 }
 
+func (s *Session) handleCodisInfo(r *Request) error {
+	if len(r.Multi) != 0 {
+		r.Resp = redis.NewErrorf("ERR wrong number of arguments for 'CODIS.INFO' command")
+		return nil
+	}
+
+	r.Resp = redis.NewArray([]*redis.Resp{
+		redis.NewString([]byte(utils.Version)),
+		redis.NewString([]byte(utils.Compile)),
+		redis.NewString([]byte(fmt.Sprintf("admin addr: %s", s.proxy.model.AdminAddr))),
+		redis.NewString([]byte(fmt.Sprintf("start time: %s", s.proxy.model.StartTime))),
+	})
+
+	return nil
+}
+
 func (s *Session) handleSelect(r *Request) error {
 	if len(r.Multi) != 2 {
 		r.Resp = redis.NewErrorf("ERR wrong number of arguments for 'SELECT' command")


Test patch: