diff --git a/src/redis-shake/common/command.go b/src/redis-shake/common/command.go index 97ef810..678e95d 100644 --- a/src/redis-shake/common/command.go +++ b/src/redis-shake/common/command.go @@ -177,18 +177,4 @@ func GetAllClusterNode(client redigo.Conn, role string, choose string) ([]string } return result, nil -} - -func WrapCommand(tp string, reply interface{}, err error) (interface{}, error) { - if err != nil { - return nil, fmt.Errorf("inner error: %v", err) - } - switch tp { - case ReplayString: - return redigo.Strings(reply, err) - case ReplayInt64s: - return redigo.Int64s(reply, err) - default: - return nil, fmt.Errorf("command type[%v] not support", tp) - } } \ No newline at end of file diff --git a/src/redis-shake/rump.go b/src/redis-shake/rump.go index ce28efb..a921fcb 100644 --- a/src/redis-shake/rump.go +++ b/src/redis-shake/rump.go @@ -485,22 +485,20 @@ func (dre *dbRumperExecutor) doFetch(db int) error { } reply, err := dre.sourceClient.Do("") - dumpsRet, err := utils.WrapCommand(utils.ReplayString, reply, err) + dumps, err := redis.Strings(reply, err) if err != nil && err != redis.ErrNil { - return fmt.Errorf("do dump with failed[%v]", err) + return fmt.Errorf("do dump with failed[%v], reply[%v]", err, reply) } - dumps := dumpsRet.([]string) // pipeline ttl for _, key := range keys { dre.sourceClient.Send("PTTL", key) } reply, err = dre.sourceClient.Do("") - pttlsRet, err := utils.WrapCommand(utils.ReplayInt64s, reply, err) + pttls, err := redis.Int64s(reply, err) if err != nil && err != redis.ErrNil { - return fmt.Errorf("do ttl with failed[%v]", err) + return fmt.Errorf("do ttl with failed[%v], reply[%v]", err, reply) } - pttls := pttlsRet.([]int64) dre.stat.rCommands.Add(int64(len(keys))) for i, k := range keys {