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

v4
vinllen 5 years ago
parent ffde9f65b5
commit e2153a12a2
  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
* BUGFIX: transaction syncing panic when target redis is cluster. see
#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.
* VERSION: 1.6.16
* BUGFIX: big key in `rump` mode all expired.

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

@ -396,8 +396,9 @@ func sanitizeOptions(tp string) error {
// set to default when not set
conf.Options.SenderCount = defaultSenderCount
}
if conf.Options.TargetType == conf.RedisTypeCluster && conf.Options.SenderCount > utils.RecvChanSize {
conf.Options.SenderCount = utils.RecvChanSize
if conf.Options.TargetType == conf.RedisTypeCluster && int(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 {
@ -451,8 +452,9 @@ func sanitizeOptions(tp string) error {
conf.Options.ScanSpecialCloud, conf.Options.ScanKeyFile)
}
if 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)
if int(conf.Options.ScanKeyNumber) > utils.RecvChanSize && conf.Options.TargetType == conf.RedisTypeCluster {
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 {

Loading…
Cancel
Save