Merge pull request #106 from alibaba/improve-1.6.9

Improve 1.6.9
v4
Vinllen Chen 6 years ago committed by GitHub
commit 1aede768f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      ChangeLog
  2. 2
      README.md
  3. 4
      conf/redis-shake.conf
  4. 16
      src/redis-shake/common/filter.go
  5. 2
      src/redis-shake/common/utils.go
  6. 1
      src/redis-shake/configure/configure.go
  7. 2
      src/redis-shake/sync.go
  8. 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. 2019-06-21 Alibaba Cloud.
* VERSION: 1.6.8 * VERSION: 1.6.8
* IMPROVE: add hypervisor. * IMPROVE: add hypervisor.

@ -67,7 +67,7 @@ User can use `-version` to print the version.
# Usage # Usage
--- ---
You can directly download the binary in the [release package](https://github.com/alibaba/RedisShake/releases).<br> You can directly download the binary in the [release package](https://github.com/alibaba/RedisShake/releases), and use `start.sh` script to start it directly: `./start.sh redis-shake.conf sync`.<br>
You can also build redis-shake yourself according to the following steps, the `go` and `govendor` must be installed before compile: You can also build redis-shake yourself according to the following steps, the `go` and `govendor` must be installed before compile:
* git clone https://github.com/alibaba/RedisShake.git * git clone https://github.com/alibaba/RedisShake.git
* cd RedisShake * cd RedisShake

@ -119,6 +119,10 @@ filter.key =
# used in `sync`. # used in `sync`.
# 指定过滤slot,只让指定的slot通过 # 指定过滤slot,只让指定的slot通过
filter.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 # 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. # 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,10 +733,12 @@ func RestoreRdbEntry(c redigo.Conn, e *rdb.BinEntry) {
// load lua script // load lua script
if e.Type == rdb.RdbFlagAUX && string(e.Key) == "lua" { if e.Type == rdb.RdbFlagAUX && string(e.Key) == "lua" {
if conf.Options.FilterLua == false {
_, err := c.Do("script", "load", e.Value) _, err := c.Do("script", "load", e.Value)
if err != nil { if err != nil {
log.Panicf(err.Error()) log.Panicf(err.Error())
} }
}
return return
} }

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

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

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

Loading…
Cancel
Save