adjust RecvChanSize based on 'sender.count' or 'scan.key_number' if target redis type is cluster

v4
vinllen 5 years ago
parent e040724afa
commit bece38f2ca
  1. 3
      ChangeLog
  2. 2
      src/redis-shake/common/cluster.go
  3. 10
      src/redis-shake/main/main.go

@ -2,7 +2,8 @@
* VERSION: 1.6.17 * VERSION: 1.6.17
* BUGFIX: transaction syncing panic when target redis is cluster. see * BUGFIX: transaction syncing panic when target redis is cluster. see
#145. #145.
* IMPROVE: set max `sender.count` to 4096 if target redis type is cluster. * IMPROVE: adjust RecvChanSize based on `sender.count` or `scan.key_number`
if target redis type is cluster.
2019-08-09 Alibaba Cloud. 2019-08-09 Alibaba Cloud.
* VERSION: 1.6.16 * VERSION: 1.6.16
* BUGFIX: big key in `rump` mode all expired. * BUGFIX: big key in `rump` mode all expired.

@ -7,7 +7,7 @@ import (
"pkg/libs/log" "pkg/libs/log"
) )
const( var (
RecvChanSize = 4096 RecvChanSize = 4096
) )

@ -396,8 +396,9 @@ func sanitizeOptions(tp string) error {
// set to default when not set // set to default when not set
conf.Options.SenderCount = defaultSenderCount conf.Options.SenderCount = defaultSenderCount
} }
if conf.Options.TargetType == conf.RedisTypeCluster && conf.Options.SenderCount > utils.RecvChanSize { if conf.Options.TargetType == conf.RedisTypeCluster && int(conf.Options.SenderCount) > utils.RecvChanSize {
conf.Options.SenderCount = utils.RecvChanSize log.Infof("RecvChanSize is modified from [%v] to [%v]", utils.RecvChanSize, int(conf.Options.SenderCount))
utils.RecvChanSize = int(conf.Options.SenderCount)
} }
if conf.Options.SenderDelayChannelSize == 0 { if conf.Options.SenderDelayChannelSize == 0 {
@ -451,8 +452,9 @@ func sanitizeOptions(tp string) error {
conf.Options.ScanSpecialCloud, conf.Options.ScanKeyFile) conf.Options.ScanSpecialCloud, conf.Options.ScanKeyFile)
} }
if conf.Options.ScanKeyNumber > utils.RecvChanSize && conf.Options.TargetType == conf.RedisTypeCluster { if int(conf.Options.ScanKeyNumber) > utils.RecvChanSize && conf.Options.TargetType == conf.RedisTypeCluster {
return fmt.Errorf("scan.key_number should less than [%v] when target type is cluster", utils.RecvChanSize) log.Infof("RecvChanSize is modified from [%v] to [%v]", utils.RecvChanSize, int(conf.Options.ScanKeyNumber))
utils.RecvChanSize = int(conf.Options.ScanKeyNumber)
} }
//if len(conf.Options.SourceAddressList) == 1 { //if len(conf.Options.SourceAddressList) == 1 {

Loading…
Cancel
Save