bugfix: index panic

v4
vinllen 6 years ago
parent 2aafbe7e34
commit c58155558b
  1. 4
      src/redis-shake/common/configure.go
  2. 8
      src/redis-shake/rump.go

@ -141,8 +141,8 @@ func parseAddress(tp, address, redisType string, isSource bool) error {
setAddressList(isSource, address) setAddressList(isSource, address)
} }
case conf.RedisTypeProxy: case conf.RedisTypeProxy:
if addressLen != 1 { if isSource && addressLen != 1 {
return fmt.Errorf("address[%v] length[%v] must == 1 when type is 'proxy'", addressLen, addressLen) return fmt.Errorf("address[%v] length[%v] must == 1 when type is 'proxy'", address, addressLen)
} }
if isSource && tp != conf.TypeRump { if isSource && tp != conf.TypeRump {
return fmt.Errorf("source.type == proxy should only happens when mode is 'rump'") return fmt.Errorf("source.type == proxy should only happens when mode is 'rump'")

@ -83,6 +83,12 @@ func (cr *CmdRump) Main() {
cr.receiver() cr.receiver()
} }
/*------------------------------------------------------*/
// one rump link corresponding to one dbRumper
type dbRumper struct {
}
func (cr *CmdRump) fetcher(idx int) { func (cr *CmdRump) fetcher(idx int) {
length, err := cr.scanners[idx].NodeCount() length, err := cr.scanners[idx].NodeCount()
if err != nil || length <= 0 { if err != nil || length <= 0 {
@ -94,7 +100,7 @@ func (cr *CmdRump) fetcher(idx int) {
// iterate all source nodes // iterate all source nodes
for i := 0; i < length; i++ { for i := 0; i < length; i++ {
// fetch db number from 'info Keyspace' // fetch db number from 'info Keyspace'
dbNumber, err := cr.getSourceDbList(i) dbNumber, err := cr.getSourceDbList(idx)
if err != nil { if err != nil {
log.Panic(err) log.Panic(err)
} }

Loading…
Cancel
Save