polish code and cond

v4
vinllen 5 years ago
parent 0493252ec8
commit 560a0943a6
  1. 2
      conf/redis-shake.conf
  2. 7
      src/redis-shake/main/main.go
  3. 2
      src/redis-shake/sync.go

@ -112,7 +112,7 @@ filter.db =
# e.g., a;b;c # e.g., a;b;c
# default is all. # default is all.
# used in `restore`, `sync` and `rump`. # used in `restore`, `sync` and `rump`.
# 支持按前缀过滤key,只让指定前缀的key通过,分号分隔 # 支持按前缀过滤key,只让指定前缀的key通过,分号分隔。比如指定abc,将会过滤abc, abc1, abcxxx
filter.key = filter.key =
# filter given slot, multiple slots are separated by ';'. # filter given slot, multiple slots are separated by ';'.
# e.g., 1;2;3 # e.g., 1;2;3

@ -51,7 +51,12 @@ func main() {
version := flag.Bool("version", false, "show version") version := flag.Bool("version", false, "show version")
flag.Parse() flag.Parse()
if *configuration == "" || *tp == "" || *version { if *version {
fmt.Println(utils.Version)
return
}
if *configuration == "" || *tp == "" {
if !*version { if !*version {
fmt.Println("Please show me the '-conf' and '-type'") fmt.Println("Please show me the '-conf' and '-type'")
} }

@ -629,7 +629,7 @@ func (ds *dbSyncer) syncCommand(reader *bufio.Reader, target []string, auth_type
if len(conf.Options.FilterKey) != 0 { if len(conf.Options.FilterKey) != 0 {
cmdNode, ok := command.RedisCommands[scmd] cmdNode, ok := command.RedisCommands[scmd]
if ok && len(argv) > 0 { if ok && len(argv) > 0 {
log.Debugf("dbSyncer[%v] filter command[%v]", ds.id, scmd) // log.Debugf("dbSyncer[%v] filter command[%v]", ds.id, scmd)
new_argv, pass = command.GetMatchKeys(cmdNode, argv, conf.Options.FilterKey) new_argv, pass = command.GetMatchKeys(cmdNode, argv, conf.Options.FilterKey)
} else { } else {
pass = true pass = true

Loading…
Cancel
Save