88 "time"
99
1010 "github.com/go-logr/logr"
11+
12+ "github.com/ucloud/redis-cluster-operator/pkg/utils"
1113)
1214
1315const (
@@ -333,6 +335,24 @@ func (a *Admin) GetAllConfig(c IClient, addr string) (map[string]string, error)
333335 return raw , nil
334336}
335337
338+ var parseConfigMap = map [string ]int8 {
339+ "maxmemory" : 0 ,
340+ "proto-max-bulk-len" : 0 ,
341+ "client-query-buffer-limit" : 0 ,
342+ "repl-backlog-size" : 0 ,
343+ "auto-aof-rewrite-min-size" : 0 ,
344+ "active-defrag-ignore-bytes" : 0 ,
345+ "hash-max-ziplist-entries" : 0 ,
346+ "hash-max-ziplist-value" : 0 ,
347+ "stream-node-max-bytes" : 0 ,
348+ "set-max-intset-entries" : 0 ,
349+ "zset-max-ziplist-entries" : 0 ,
350+ "zset-max-ziplist-value" : 0 ,
351+ "hll-sparse-max-bytes" : 0 ,
352+ // TODO parse client-output-buffer-limit
353+ //"client-output-buffer-limit": 0,
354+ }
355+
336356// SetConfigIfNeed set redis config
337357func (a * Admin ) SetConfigIfNeed (newConfig map [string ]string ) error {
338358 for addr , c := range a .Connections ().GetAll () {
@@ -342,6 +362,14 @@ func (a *Admin) SetConfigIfNeed(newConfig map[string]string) error {
342362 }
343363
344364 for key , value := range newConfig {
365+ var err error
366+ if _ , ok := parseConfigMap [key ]; ok {
367+ value , err = utils .ParseRedisMemConf (value )
368+ if err != nil {
369+ a .log .Error (err , "redis config format err" , "key" , key , "value" , value )
370+ continue
371+ }
372+ }
345373 if value != oldConfig [key ] {
346374 a .log .V (3 ).Info ("CONFIG SET" , key , value )
347375 resp := c .Cmd ("CONFIG" , "SET" , key , value )
0 commit comments