print inner error message from redigo driver return message2

v4
vinllen 5 years ago
parent 40426643ae
commit fadbdba6bd
  1. 14
      src/redis-shake/common/command.go
  2. 10
      src/redis-shake/rump.go

@ -178,17 +178,3 @@ func GetAllClusterNode(client redigo.Conn, role string, choose string) ([]string
return result, nil 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)
}
}

@ -485,22 +485,20 @@ func (dre *dbRumperExecutor) doFetch(db int) error {
} }
reply, err := dre.sourceClient.Do("") 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 { 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 // pipeline ttl
for _, key := range keys { for _, key := range keys {
dre.sourceClient.Send("PTTL", key) dre.sourceClient.Send("PTTL", key)
} }
reply, err = dre.sourceClient.Do("") 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 { 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))) dre.stat.rCommands.Add(int64(len(keys)))
for i, k := range keys { for i, k := range keys {

Loading…
Cancel
Save