From a25bca06927a171ba1d8d459e573bc083ca8c1a8 Mon Sep 17 00:00:00 2001 From: Aaron Gipson Date: Mon, 12 Jun 2023 15:30:03 -0500 Subject: [PATCH] Initial patch for redis version 7 support (#4572) --- weed/filer/redis/redis_cluster_store.go | 2 +- weed/filer/redis/redis_store.go | 2 +- weed/filer/redis/universal_redis_store.go | 5 +++-- weed/filer/redis/universal_redis_store_kv.go | 2 +- weed/filer/redis2/redis_cluster_store.go | 2 +- weed/filer/redis2/redis_sentinel_store.go | 5 +++-- weed/filer/redis2/redis_store.go | 2 +- weed/filer/redis2/universal_redis_store.go | 4 ++-- weed/filer/redis2/universal_redis_store_kv.go | 2 +- weed/filer/redis3/ItemList.go | 7 ++++--- weed/filer/redis3/item_list_serde.go | 2 +- weed/filer/redis3/kv_directory_children.go | 3 ++- weed/filer/redis3/kv_directory_children_test.go | 5 +++-- weed/filer/redis3/redis_cluster_store.go | 4 ++-- weed/filer/redis3/redis_sentinel_store.go | 4 ++-- weed/filer/redis3/redis_store.go | 4 ++-- weed/filer/redis3/skiplist_element_store.go | 3 ++- weed/filer/redis3/universal_redis_store.go | 2 +- weed/filer/redis3/universal_redis_store_kv.go | 2 +- weed/filer/redis_lua/redis_cluster_store.go | 2 +- weed/filer/redis_lua/redis_sentinel_store.go | 5 +++-- weed/filer/redis_lua/redis_store.go | 2 +- weed/filer/redis_lua/stored_procedure/init.go | 3 ++- weed/filer/redis_lua/universal_redis_store.go | 2 +- weed/filer/redis_lua/universal_redis_store_kv.go | 2 +- 25 files changed, 43 insertions(+), 35 deletions(-) diff --git a/weed/filer/redis/redis_cluster_store.go b/weed/filer/redis/redis_cluster_store.go index b24a9f5d3..be2710948 100644 --- a/weed/filer/redis/redis_cluster_store.go +++ b/weed/filer/redis/redis_cluster_store.go @@ -1,7 +1,7 @@ package redis import ( - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis/redis_store.go b/weed/filer/redis/redis_store.go index c3f7194e6..823bbf610 100644 --- a/weed/filer/redis/redis_store.go +++ b/weed/filer/redis/redis_store.go @@ -1,7 +1,7 @@ package redis import ( - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis/universal_redis_store.go b/weed/filer/redis/universal_redis_store.go index e56a6bf3c..ca32c2d3e 100644 --- a/weed/filer/redis/universal_redis_store.go +++ b/weed/filer/redis/universal_redis_store.go @@ -3,11 +3,12 @@ package redis import ( "context" "fmt" - "golang.org/x/exp/slices" "strings" "time" - "github.com/go-redis/redis/v8" + "golang.org/x/exp/slices" + + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/glog" diff --git a/weed/filer/redis/universal_redis_store_kv.go b/weed/filer/redis/universal_redis_store_kv.go index 12ab70cec..230cda759 100644 --- a/weed/filer/redis/universal_redis_store_kv.go +++ b/weed/filer/redis/universal_redis_store_kv.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" ) diff --git a/weed/filer/redis2/redis_cluster_store.go b/weed/filer/redis2/redis_cluster_store.go index 835bb5154..6e4f11d22 100644 --- a/weed/filer/redis2/redis_cluster_store.go +++ b/weed/filer/redis2/redis_cluster_store.go @@ -1,7 +1,7 @@ package redis2 import ( - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis2/redis_sentinel_store.go b/weed/filer/redis2/redis_sentinel_store.go index 313977dc7..a120c8985 100644 --- a/weed/filer/redis2/redis_sentinel_store.go +++ b/weed/filer/redis2/redis_sentinel_store.go @@ -1,10 +1,11 @@ package redis2 import ( - "github.com/go-redis/redis/v8" + "time" + + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" - "time" ) func init() { diff --git a/weed/filer/redis2/redis_store.go b/weed/filer/redis2/redis_store.go index 52b29121d..a271dbcd1 100644 --- a/weed/filer/redis2/redis_store.go +++ b/weed/filer/redis2/redis_store.go @@ -1,7 +1,7 @@ package redis2 import ( - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis2/universal_redis_store.go b/weed/filer/redis2/universal_redis_store.go index 6b0e65c3d..d3f01f88a 100644 --- a/weed/filer/redis2/universal_redis_store.go +++ b/weed/filer/redis2/universal_redis_store.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/glog" @@ -57,7 +57,7 @@ func (store *UniversalRedis2Store) InsertEntry(ctx context.Context, entry *filer } if name != "" { - if err = store.Client.ZAddNX(ctx, genDirectoryListKey(dir), &redis.Z{Score: 0, Member: name}).Err(); err != nil { + if err = store.Client.ZAddNX(ctx, genDirectoryListKey(dir), redis.Z{Score: 0, Member: name}).Err(); err != nil { return fmt.Errorf("persisting %s in parent dir: %v", entry.FullPath, err) } } diff --git a/weed/filer/redis2/universal_redis_store_kv.go b/weed/filer/redis2/universal_redis_store_kv.go index a68a3449c..5b515f605 100644 --- a/weed/filer/redis2/universal_redis_store_kv.go +++ b/weed/filer/redis2/universal_redis_store_kv.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" ) diff --git a/weed/filer/redis3/ItemList.go b/weed/filer/redis3/ItemList.go index c576cbeb4..cb6043a78 100644 --- a/weed/filer/redis3/ItemList.go +++ b/weed/filer/redis3/ItemList.go @@ -4,7 +4,8 @@ import ( "bytes" "context" "fmt" - "github.com/go-redis/redis/v8" + + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/util/skiplist" ) @@ -399,9 +400,9 @@ func (nl *ItemList) NodeSize(node *skiplist.SkipListElementReference) int { func (nl *ItemList) NodeAddMember(node *skiplist.SkipListElementReference, names ...string) error { key := fmt.Sprintf("%s%dm", nl.prefix, node.ElementPointer) - var members []*redis.Z + var members []redis.Z for _, name := range names { - members = append(members, &redis.Z{ + members = append(members, redis.Z{ Score: 0, Member: name, }) diff --git a/weed/filer/redis3/item_list_serde.go b/weed/filer/redis3/item_list_serde.go index e71243838..f4410b61b 100644 --- a/weed/filer/redis3/item_list_serde.go +++ b/weed/filer/redis3/item_list_serde.go @@ -1,7 +1,7 @@ package redis3 import ( - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/util/skiplist" "google.golang.org/protobuf/proto" diff --git a/weed/filer/redis3/kv_directory_children.go b/weed/filer/redis3/kv_directory_children.go index 422500ed7..d496eae01 100644 --- a/weed/filer/redis3/kv_directory_children.go +++ b/weed/filer/redis3/kv_directory_children.go @@ -3,7 +3,8 @@ package redis3 import ( "context" "fmt" - "github.com/go-redis/redis/v8" + + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/glog" ) diff --git a/weed/filer/redis3/kv_directory_children_test.go b/weed/filer/redis3/kv_directory_children_test.go index 9d7acacf1..600195e31 100644 --- a/weed/filer/redis3/kv_directory_children_test.go +++ b/weed/filer/redis3/kv_directory_children_test.go @@ -3,11 +3,12 @@ package redis3 import ( "context" "fmt" - "github.com/go-redis/redis/v8" - "github.com/stvp/tempredis" "strconv" "testing" "time" + + "github.com/redis/go-redis/v9" + "github.com/stvp/tempredis" ) var names = []string{ diff --git a/weed/filer/redis3/redis_cluster_store.go b/weed/filer/redis3/redis_cluster_store.go index 1efa8e9b0..cb8c1896d 100644 --- a/weed/filer/redis3/redis_cluster_store.go +++ b/weed/filer/redis3/redis_cluster_store.go @@ -1,9 +1,9 @@ package redis3 import ( - "github.com/go-redis/redis/v8" "github.com/go-redsync/redsync/v4" - "github.com/go-redsync/redsync/v4/redis/goredis/v8" + "github.com/go-redsync/redsync/v4/redis/goredis/v9" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis3/redis_sentinel_store.go b/weed/filer/redis3/redis_sentinel_store.go index 4135d9956..b9b0354e0 100644 --- a/weed/filer/redis3/redis_sentinel_store.go +++ b/weed/filer/redis3/redis_sentinel_store.go @@ -3,9 +3,9 @@ package redis3 import ( "time" - "github.com/go-redis/redis/v8" "github.com/go-redsync/redsync/v4" - "github.com/go-redsync/redsync/v4/redis/goredis/v8" + "github.com/go-redsync/redsync/v4/redis/goredis/v9" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis3/redis_store.go b/weed/filer/redis3/redis_store.go index 9b98459e6..fbcb6d10d 100644 --- a/weed/filer/redis3/redis_store.go +++ b/weed/filer/redis3/redis_store.go @@ -1,9 +1,9 @@ package redis3 import ( - "github.com/go-redis/redis/v8" "github.com/go-redsync/redsync/v4" - "github.com/go-redsync/redsync/v4/redis/goredis/v8" + "github.com/go-redsync/redsync/v4/redis/goredis/v9" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis3/skiplist_element_store.go b/weed/filer/redis3/skiplist_element_store.go index b589e3e77..834e18718 100644 --- a/weed/filer/redis3/skiplist_element_store.go +++ b/weed/filer/redis3/skiplist_element_store.go @@ -3,7 +3,8 @@ package redis3 import ( "context" "fmt" - "github.com/go-redis/redis/v8" + + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/util/skiplist" "google.golang.org/protobuf/proto" diff --git a/weed/filer/redis3/universal_redis_store.go b/weed/filer/redis3/universal_redis_store.go index 2fb9a5b3f..51675d971 100644 --- a/weed/filer/redis3/universal_redis_store.go +++ b/weed/filer/redis3/universal_redis_store.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" redsync "github.com/go-redsync/redsync/v4" "github.com/seaweedfs/seaweedfs/weed/filer" diff --git a/weed/filer/redis3/universal_redis_store_kv.go b/weed/filer/redis3/universal_redis_store_kv.go index 280eb4a96..fd665d5d4 100644 --- a/weed/filer/redis3/universal_redis_store_kv.go +++ b/weed/filer/redis3/universal_redis_store_kv.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" ) diff --git a/weed/filer/redis_lua/redis_cluster_store.go b/weed/filer/redis_lua/redis_cluster_store.go index ae274bb09..251aadbcd 100644 --- a/weed/filer/redis_lua/redis_cluster_store.go +++ b/weed/filer/redis_lua/redis_cluster_store.go @@ -1,7 +1,7 @@ package redis_lua import ( - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis_lua/redis_sentinel_store.go b/weed/filer/redis_lua/redis_sentinel_store.go index ac8ae75d7..23d7b67b4 100644 --- a/weed/filer/redis_lua/redis_sentinel_store.go +++ b/weed/filer/redis_lua/redis_sentinel_store.go @@ -1,10 +1,11 @@ package redis_lua import ( - "github.com/go-redis/redis/v8" + "time" + + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" - "time" ) func init() { diff --git a/weed/filer/redis_lua/redis_store.go b/weed/filer/redis_lua/redis_store.go index e88f3a3dc..8574baa09 100644 --- a/weed/filer/redis_lua/redis_store.go +++ b/weed/filer/redis_lua/redis_store.go @@ -1,7 +1,7 @@ package redis_lua import ( - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/util" ) diff --git a/weed/filer/redis_lua/stored_procedure/init.go b/weed/filer/redis_lua/stored_procedure/init.go index 1412ceba2..685ea364d 100644 --- a/weed/filer/redis_lua/stored_procedure/init.go +++ b/weed/filer/redis_lua/stored_procedure/init.go @@ -2,7 +2,8 @@ package stored_procedure import ( _ "embed" - "github.com/go-redis/redis/v8" + + "github.com/redis/go-redis/v9" ) func init() { diff --git a/weed/filer/redis_lua/universal_redis_store.go b/weed/filer/redis_lua/universal_redis_store.go index 59c128030..9e8dbcda7 100644 --- a/weed/filer/redis_lua/universal_redis_store.go +++ b/weed/filer/redis_lua/universal_redis_store.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/filer/redis_lua/stored_procedure" diff --git a/weed/filer/redis_lua/universal_redis_store_kv.go b/weed/filer/redis_lua/universal_redis_store_kv.go index a03ae6573..01a7ba560 100644 --- a/weed/filer/redis_lua/universal_redis_store_kv.go +++ b/weed/filer/redis_lua/universal_redis_store_kv.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" "github.com/seaweedfs/seaweedfs/weed/filer" )