From c58155558bdf7c1531f8a4f2d762db56cf0bc509 Mon Sep 17 00:00:00 2001 From: vinllen Date: Mon, 3 Jun 2019 14:39:40 +0800 Subject: [PATCH] bugfix: index panic --- src/redis-shake/common/configure.go | 4 ++-- src/redis-shake/rump.go | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/redis-shake/common/configure.go b/src/redis-shake/common/configure.go index ded51ea..8b38f27 100644 --- a/src/redis-shake/common/configure.go +++ b/src/redis-shake/common/configure.go @@ -141,8 +141,8 @@ func parseAddress(tp, address, redisType string, isSource bool) error { setAddressList(isSource, address) } case conf.RedisTypeProxy: - if addressLen != 1 { - return fmt.Errorf("address[%v] length[%v] must == 1 when type is 'proxy'", addressLen, addressLen) + if isSource && addressLen != 1 { + return fmt.Errorf("address[%v] length[%v] must == 1 when type is 'proxy'", address, addressLen) } if isSource && tp != conf.TypeRump { return fmt.Errorf("source.type == proxy should only happens when mode is 'rump'") diff --git a/src/redis-shake/rump.go b/src/redis-shake/rump.go index f7ace6b..cbc9e5f 100644 --- a/src/redis-shake/rump.go +++ b/src/redis-shake/rump.go @@ -83,6 +83,12 @@ func (cr *CmdRump) Main() { cr.receiver() } +/*------------------------------------------------------*/ +// one rump link corresponding to one dbRumper +type dbRumper struct { + +} + func (cr *CmdRump) fetcher(idx int) { length, err := cr.scanners[idx].NodeCount() if err != nil || length <= 0 { @@ -94,7 +100,7 @@ func (cr *CmdRump) fetcher(idx int) { // iterate all source nodes for i := 0; i < length; i++ { // fetch db number from 'info Keyspace' - dbNumber, err := cr.getSourceDbList(i) + dbNumber, err := cr.getSourceDbList(idx) if err != nil { log.Panic(err) }