Merge pull request #107 from alibaba/feature-1.6

Feature 1.6
v4
Vinllen Chen 5 years ago committed by GitHub
commit 82c2156d94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      ChangeLog
  2. 4
      conf/redis-shake.conf
  3. 16
      src/redis-shake/common/filter.go
  4. 8
      src/redis-shake/common/utils.go
  5. 1
      src/redis-shake/configure/configure.go
  6. 2
      src/redis-shake/sync.go
  7. 9
      src/vendor/vendor.json

@ -1,3 +1,8 @@
2019-06-21 Alibaba Cloud.
* VERSION: 1.6.9
* IMPROVE: support Lua and transaction when target is open source cluster
version.
* IMPROVE: support filter Lua: `filter.lua`
2019-06-21 Alibaba Cloud.
* VERSION: 1.6.8
* IMPROVE: add hypervisor.

@ -119,6 +119,10 @@ filter.key =
# used in `sync`.
# 指定过滤slot,只让指定的slot通过
filter.slot =
# filter lua script. true means not pass. However, in redis 5.0, the lua
# converts to transaction(multi+{commands}+exec) which will be passed.
# 控制不让lua脚本通过,true表示不通过
filter.lua = false
# big key threshold, the default is 500 * 1024 * 1024 bytes. If the value is bigger than
# this given value, all the field will be spilt and write into the target in order.

@ -0,0 +1,16 @@
package utils
import "strings"
// return true means not pass
func FilterCommands(cmd string, luaFilter bool) bool {
if strings.EqualFold(cmd, "opinfo") {
return true
}
if luaFilter && (strings.EqualFold(cmd, "eval") || strings.EqualFold(cmd, "script")) {
return true
}
return false
}

@ -733,9 +733,11 @@ func RestoreRdbEntry(c redigo.Conn, e *rdb.BinEntry) {
// load lua script
if e.Type == rdb.RdbFlagAUX && string(e.Key) == "lua" {
_, err := c.Do("script", "load", e.Value)
if err != nil {
log.Panicf(err.Error())
if conf.Options.FilterLua == false {
_, err := c.Do("script", "load", e.Value)
if err != nil {
log.Panicf(err.Error())
}
}
return
}

@ -36,6 +36,7 @@ type Configuration struct {
FilterDB string `config:"filter.db"`
FilterKey []string `config:"filter.key"`
FilterSlot []string `config:"filter.slot"`
FilterLua bool `config:"filter.lua"`
BigKeyThreshold uint64 `config:"big_key_threshold"`
Psync bool `config:"psync"`
Metric bool `config:"metric"`

@ -613,7 +613,7 @@ func (ds *dbSyncer) syncCommand(reader *bufio.Reader, target []string, auth_type
}
bypass = !base.AcceptDB(uint32(n))
isselect = true
} else if strings.EqualFold(scmd, "opinfo") {
} else if utils.FilterCommands(scmd, conf.Options.FilterLua) {
ignorecmd = true
}
if bypass || ignorecmd {

@ -159,10 +159,10 @@
"revisionTime": "2019-03-04T09:57:49Z"
},
{
"checksumSHA1": "uma2AeftGc7LC/UB0QY2JSnxl3w=",
"checksumSHA1": "ZT2d9cNq14zxFxnzA2kaqj8tfJY=",
"path": "github.com/vinllen/redis-go-cluster",
"revision": "b6031aad42dc289f4696f835b2fe6dc0da49c8ee",
"revisionTime": "2019-05-25T06:57:32Z"
"revision": "bdcf6ff491eca6a29ba905300253a65d88eb1ad6",
"revisionTime": "2019-06-24T08:07:27Z"
},
{
"checksumSHA1": "TM3Neoy1xRAKyZYMGzKc41sDFW4=",
@ -170,5 +170,6 @@
"revision": "a96e63847dc3c67d17befa69c303767e2f84e54f",
"revisionTime": "2017-05-31T16:03:50Z"
}
]
],
"rootPath": "/Users/vinllen-ali/code/redis-shake-inner/redis-shake/src"
}

Loading…
Cancel
Save