From c2329a032590fd9f9c968d0fe581324de8718449 Mon Sep 17 00:00:00 2001 From: vinllen Date: Wed, 24 Jul 2019 10:54:11 +0800 Subject: [PATCH] add target db judge when target type is cluster --- src/redis-shake/main/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/redis-shake/main/main.go b/src/redis-shake/main/main.go index d899d5a..c20b314 100644 --- a/src/redis-shake/main/main.go +++ b/src/redis-shake/main/main.go @@ -353,6 +353,10 @@ func sanitizeOptions(tp string) error { conf.Options.TargetDB = v } + if conf.Options.TargetDB > 0 && conf.Options.TargetType == conf.RedisTypeCluster { + return fmt.Errorf("target.db[%v] should in {-1, 0} when target type is cluster", conf.Options.TargetDB) + } + if conf.Options.HttpProfile < 0 || conf.Options.HttpProfile > 65535 { return fmt.Errorf("HttpProfile[%v] should in [0, 65535]", conf.Options.HttpProfile) } else if conf.Options.HttpProfile == 0 {