diff --git a/.travis.yml b/.travis.yml index 1d042e4c..2e8f8133 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,5 @@ install: - go get gopkg.in/bsm/ratelimit.v1 - go get github.com/onsi/ginkgo - go get github.com/onsi/gomega - - go get github.com/garyburd/redigo/redis - mkdir -p $HOME/gopath/src/gopkg.in - - mv $HOME/gopath/src/github.com/go-redis/redis $HOME/gopath/src/gopkg.in/redis.v4 - - cd $HOME/gopath/src/gopkg.in/redis.v4 + - mv `pwd` $HOME/gopath/src/gopkg.in/redis.v5 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..d3f85449 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# v5 + + - *Important*. ClusterClient and Ring now chose random node/shard when command does not have any keys or command info is not fully available. Also clients use EVAL and EVALSHA keys to pick the right node. diff --git a/bench_test.go b/bench_test.go index 0c40cf3a..0b576997 100644 --- a/bench_test.go +++ b/bench_test.go @@ -5,9 +5,7 @@ import ( "testing" "time" - redigo "github.com/garyburd/redigo/redis" - - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) func benchmarkRedisClient(poolSize int) *redis.Client { @@ -71,7 +69,7 @@ func BenchmarkRedisGetNil(b *testing.B) { }) } -func benchmarkSetGoRedis(b *testing.B, poolSize, payloadSize int) { +func benchmarkSetRedis(b *testing.B, poolSize, payloadSize int) { client := benchmarkRedisClient(poolSize) defer client.Close() @@ -88,93 +86,36 @@ func benchmarkSetGoRedis(b *testing.B, poolSize, payloadSize int) { }) } -func BenchmarkSetGoRedis10Conns64Bytes(b *testing.B) { - benchmarkSetGoRedis(b, 10, 64) +func BenchmarkSetRedis10Conns64Bytes(b *testing.B) { + benchmarkSetRedis(b, 10, 64) } -func BenchmarkSetGoRedis100Conns64Bytes(b *testing.B) { - benchmarkSetGoRedis(b, 100, 64) +func BenchmarkSetRedis100Conns64Bytes(b *testing.B) { + benchmarkSetRedis(b, 100, 64) } -func BenchmarkSetGoRedis10Conns1KB(b *testing.B) { - benchmarkSetGoRedis(b, 10, 1024) +func BenchmarkSetRedis10Conns1KB(b *testing.B) { + benchmarkSetRedis(b, 10, 1024) } -func BenchmarkSetGoRedis100Conns1KB(b *testing.B) { - benchmarkSetGoRedis(b, 100, 1024) +func BenchmarkSetRedis100Conns1KB(b *testing.B) { + benchmarkSetRedis(b, 100, 1024) } -func BenchmarkSetGoRedis10Conns10KB(b *testing.B) { - benchmarkSetGoRedis(b, 10, 10*1024) +func BenchmarkSetRedis10Conns10KB(b *testing.B) { + benchmarkSetRedis(b, 10, 10*1024) } -func BenchmarkSetGoRedis100Conns10KB(b *testing.B) { - benchmarkSetGoRedis(b, 100, 10*1024) +func BenchmarkSetRedis100Conns10KB(b *testing.B) { + benchmarkSetRedis(b, 100, 10*1024) } -func BenchmarkSetGoRedis10Conns1MB(b *testing.B) { - benchmarkSetGoRedis(b, 10, 1024*1024) +func BenchmarkSetRedis10Conns1MB(b *testing.B) { + benchmarkSetRedis(b, 10, 1024*1024) } -func BenchmarkSetGoRedis100Conns1MB(b *testing.B) { - benchmarkSetGoRedis(b, 100, 1024*1024) -} - -func benchmarkSetRedigo(b *testing.B, poolSize, payloadSize int) { - pool := &redigo.Pool{ - Dial: func() (redigo.Conn, error) { - return redigo.DialTimeout("tcp", ":6379", time.Second, time.Second, time.Second) - }, - MaxActive: poolSize, - MaxIdle: poolSize, - } - defer pool.Close() - - value := string(bytes.Repeat([]byte{'1'}, payloadSize)) - - b.ResetTimer() - - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - conn := pool.Get() - if _, err := conn.Do("SET", "key", value); err != nil { - b.Fatal(err) - } - conn.Close() - } - }) -} - -func BenchmarkSetRedigo10Conns64Bytes(b *testing.B) { - benchmarkSetRedigo(b, 10, 64) -} - -func BenchmarkSetRedigo100Conns64Bytes(b *testing.B) { - benchmarkSetRedigo(b, 100, 64) -} - -func BenchmarkSetRedigo10Conns1KB(b *testing.B) { - benchmarkSetRedigo(b, 10, 1024) -} - -func BenchmarkSetRedigo100Conns1KB(b *testing.B) { - benchmarkSetRedigo(b, 100, 1024) -} - -func BenchmarkSetRedigo10Conns10KB(b *testing.B) { - benchmarkSetRedigo(b, 10, 10*1024) -} - -func BenchmarkSetRedigo100Conns10KB(b *testing.B) { - benchmarkSetRedigo(b, 100, 10*1024) -} - -func BenchmarkSetRedigo10Conns1MB(b *testing.B) { - benchmarkSetRedigo(b, 10, 1024*1024) -} - -func BenchmarkSetRedigo100Conns1MB(b *testing.B) { - benchmarkSetRedigo(b, 100, 1024*1024) +func BenchmarkSetRedis100Conns1MB(b *testing.B) { + benchmarkSetRedis(b, 100, 1024*1024) } func BenchmarkRedisSetGetBytes(b *testing.B) { diff --git a/cluster.go b/cluster.go index 6aea41b6..cc8b3007 100644 --- a/cluster.go +++ b/cluster.go @@ -6,10 +6,10 @@ import ( "sync/atomic" "time" - "gopkg.in/redis.v4/internal" - "gopkg.in/redis.v4/internal/errors" - "gopkg.in/redis.v4/internal/hashtag" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5/internal" + "gopkg.in/redis.v5/internal/errors" + "gopkg.in/redis.v5/internal/hashtag" + "gopkg.in/redis.v5/internal/pool" ) // ClusterOptions are used to configure a cluster client and should be diff --git a/cluster_test.go b/cluster_test.go index 74b260f8..367a6e34 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -13,8 +13,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" - "gopkg.in/redis.v4/internal/hashtag" + "gopkg.in/redis.v5" + "gopkg.in/redis.v5/internal/hashtag" ) type clusterScenario struct { diff --git a/command.go b/command.go index 76132038..41fde304 100644 --- a/command.go +++ b/command.go @@ -7,10 +7,9 @@ import ( "strings" "time" - "github.com/go-redis/redis/internal" - - "gopkg.in/redis.v4/internal/pool" - "gopkg.in/redis.v4/internal/proto" + "gopkg.in/redis.v5/internal" + "gopkg.in/redis.v5/internal/pool" + "gopkg.in/redis.v5/internal/proto" ) var ( diff --git a/command_test.go b/command_test.go index ab31f3f1..216a7b0c 100644 --- a/command_test.go +++ b/command_test.go @@ -4,7 +4,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) var _ = Describe("Cmd", func() { diff --git a/commands.go b/commands.go index f1173296..078242f7 100644 --- a/commands.go +++ b/commands.go @@ -5,8 +5,8 @@ import ( "strconv" "time" - "gopkg.in/redis.v4/internal" - "gopkg.in/redis.v4/internal/errors" + "gopkg.in/redis.v5/internal" + "gopkg.in/redis.v5/internal/errors" ) func readTimeout(timeout time.Duration) time.Duration { diff --git a/commands_test.go b/commands_test.go index c89c3331..e613d4ab 100644 --- a/commands_test.go +++ b/commands_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) var _ = Describe("Commands", func() { diff --git a/example_test.go b/example_test.go index 71d06c4c..1aef66fc 100644 --- a/example_test.go +++ b/example_test.go @@ -6,7 +6,7 @@ import ( "sync" "time" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) var client *redis.Client diff --git a/export_test.go b/export_test.go index ff37e817..d36f8671 100644 --- a/export_test.go +++ b/export_test.go @@ -3,7 +3,7 @@ package redis import ( "time" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5/internal/pool" ) func (c *baseClient) Pool() pool.Pooler { diff --git a/internal/pool/bench_test.go b/internal/pool/bench_test.go index 663abc0b..be2c3053 100644 --- a/internal/pool/bench_test.go +++ b/internal/pool/bench_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5/internal/pool" ) func benchmarkPoolGetPut(b *testing.B, poolSize int) { diff --git a/internal/pool/conn.go b/internal/pool/conn.go index bb0922f3..785fc214 100644 --- a/internal/pool/conn.go +++ b/internal/pool/conn.go @@ -4,7 +4,7 @@ import ( "net" "time" - "gopkg.in/redis.v4/internal/proto" + "gopkg.in/redis.v5/internal/proto" ) const defaultBufSize = 4096 diff --git a/internal/pool/pool.go b/internal/pool/pool.go index bd1c4130..389a3d22 100644 --- a/internal/pool/pool.go +++ b/internal/pool/pool.go @@ -10,7 +10,7 @@ import ( "gopkg.in/bsm/ratelimit.v1" - "gopkg.in/redis.v4/internal" + "gopkg.in/redis.v5/internal" ) var ( diff --git a/internal/pool/pool_test.go b/internal/pool/pool_test.go index 425ce928..7ba35fd4 100644 --- a/internal/pool/pool_test.go +++ b/internal/pool/pool_test.go @@ -8,7 +8,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5/internal/pool" ) var _ = Describe("ConnPool", func() { diff --git a/internal/proto/proto.go b/internal/proto/proto.go index c63caaac..00d5f6ba 100644 --- a/internal/proto/proto.go +++ b/internal/proto/proto.go @@ -5,7 +5,7 @@ import ( "fmt" "strconv" - "gopkg.in/redis.v4/internal/errors" + "gopkg.in/redis.v5/internal/errors" ) const ( diff --git a/internal/proto/reader.go b/internal/proto/reader.go index 9d2f51ae..412eec6d 100644 --- a/internal/proto/reader.go +++ b/internal/proto/reader.go @@ -7,7 +7,7 @@ import ( "io" "strconv" - ierrors "gopkg.in/redis.v4/internal/errors" + ierrors "gopkg.in/redis.v5/internal/errors" ) type MultiBulkParse func(*Reader, int64) (interface{}, error) diff --git a/internal/proto/reader_test.go b/internal/proto/reader_test.go index 51692626..421344be 100644 --- a/internal/proto/reader_test.go +++ b/internal/proto/reader_test.go @@ -7,7 +7,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4/internal/proto" + + "gopkg.in/redis.v5/internal/proto" ) var _ = Describe("Reader", func() { diff --git a/internal/proto/writebuffer_test.go b/internal/proto/writebuffer_test.go index 6316ded7..36593af5 100644 --- a/internal/proto/writebuffer_test.go +++ b/internal/proto/writebuffer_test.go @@ -6,7 +6,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4/internal/proto" + + "gopkg.in/redis.v5/internal/proto" ) var _ = Describe("WriteBuffer", func() { diff --git a/iterator_test.go b/iterator_test.go index 7b301768..7200c14b 100644 --- a/iterator_test.go +++ b/iterator_test.go @@ -6,7 +6,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) var _ = Describe("ScanIterator", func() { diff --git a/main_test.go b/main_test.go index a9afa822..67886e4b 100644 --- a/main_test.go +++ b/main_test.go @@ -14,7 +14,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) const ( @@ -94,7 +94,7 @@ var _ = AfterSuite(func() { func TestGinkgoSuite(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "gopkg.in/redis.v4") + RunSpecs(t, "gopkg.in/redis.v5") } //------------------------------------------------------------------------------ diff --git a/options.go b/options.go index bfe2e8a2..376fa6bf 100644 --- a/options.go +++ b/options.go @@ -4,7 +4,7 @@ import ( "net" "time" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5/internal/pool" ) type Options struct { diff --git a/parser.go b/parser.go index a4ad4e2a..50b2a956 100644 --- a/parser.go +++ b/parser.go @@ -5,7 +5,7 @@ import ( "net" "strconv" - "gopkg.in/redis.v4/internal/proto" + "gopkg.in/redis.v5/internal/proto" ) // Implements proto.MultiBulkParse diff --git a/pipeline.go b/pipeline.go index bf80d408..fe226ece 100644 --- a/pipeline.go +++ b/pipeline.go @@ -4,8 +4,8 @@ import ( "sync" "sync/atomic" - "gopkg.in/redis.v4/internal/errors" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5/internal/errors" + "gopkg.in/redis.v5/internal/pool" ) // Pipeline implements pipelining as described in diff --git a/pipeline_test.go b/pipeline_test.go index c3a37f66..74cdd385 100644 --- a/pipeline_test.go +++ b/pipeline_test.go @@ -7,7 +7,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) var _ = Describe("Pipelining", func() { diff --git a/pool_test.go b/pool_test.go index 2b0d2ad4..1adea5e8 100644 --- a/pool_test.go +++ b/pool_test.go @@ -6,8 +6,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5" + "gopkg.in/redis.v5/internal/pool" ) var _ = Describe("pool", func() { diff --git a/pubsub.go b/pubsub.go index 796bd4a2..78136f5f 100644 --- a/pubsub.go +++ b/pubsub.go @@ -5,9 +5,9 @@ import ( "net" "time" - "gopkg.in/redis.v4/internal" - "gopkg.in/redis.v4/internal/errors" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5/internal" + "gopkg.in/redis.v5/internal/errors" + "gopkg.in/redis.v5/internal/pool" ) // PubSub implements Pub/Sub commands as described in diff --git a/pubsub_test.go b/pubsub_test.go index 957d3031..ecbea768 100644 --- a/pubsub_test.go +++ b/pubsub_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) var _ = Describe("PubSub", func() { diff --git a/race_test.go b/race_test.go index ca4fb7f2..cf093f25 100644 --- a/race_test.go +++ b/race_test.go @@ -11,8 +11,8 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5" + "gopkg.in/redis.v5/internal/pool" ) var _ = Describe("races", func() { diff --git a/redis.go b/redis.go index 60df328e..9c8b490d 100644 --- a/redis.go +++ b/redis.go @@ -1,12 +1,12 @@ -package redis // import "gopkg.in/redis.v4" +package redis // import "gopkg.in/redis.v5" import ( "fmt" "log" - "gopkg.in/redis.v4/internal" - "gopkg.in/redis.v4/internal/errors" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5/internal" + "gopkg.in/redis.v5/internal/errors" + "gopkg.in/redis.v5/internal/pool" ) // Redis nil reply, .e.g. when key does not exist. diff --git a/redis_test.go b/redis_test.go index 0b595471..8d5f651a 100644 --- a/redis_test.go +++ b/redis_test.go @@ -7,7 +7,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) var _ = Describe("Client", func() { diff --git a/ring.go b/ring.go index 52badb35..77193f32 100644 --- a/ring.go +++ b/ring.go @@ -9,10 +9,10 @@ import ( "sync/atomic" "time" - "gopkg.in/redis.v4/internal" - "gopkg.in/redis.v4/internal/consistenthash" - "gopkg.in/redis.v4/internal/hashtag" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5/internal" + "gopkg.in/redis.v5/internal/consistenthash" + "gopkg.in/redis.v5/internal/hashtag" + "gopkg.in/redis.v5/internal/pool" ) var errRingShardsDown = errors.New("redis: all ring shards are down") diff --git a/ring_test.go b/ring_test.go index 0ab258d8..5e9d16f7 100644 --- a/ring_test.go +++ b/ring_test.go @@ -8,7 +8,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) var _ = Describe("Redis Ring", func() { diff --git a/sentinel.go b/sentinel.go index 66f0974c..0849dda3 100644 --- a/sentinel.go +++ b/sentinel.go @@ -8,8 +8,8 @@ import ( "sync" "time" - "gopkg.in/redis.v4/internal" - "gopkg.in/redis.v4/internal/pool" + "gopkg.in/redis.v5/internal" + "gopkg.in/redis.v5/internal/pool" ) //------------------------------------------------------------------------------ diff --git a/sentinel_test.go b/sentinel_test.go index 165cce66..d7038575 100644 --- a/sentinel_test.go +++ b/sentinel_test.go @@ -4,7 +4,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) var _ = Describe("Sentinel", func() { diff --git a/tx.go b/tx.go index 62e77018..ba2fd933 100644 --- a/tx.go +++ b/tx.go @@ -4,10 +4,10 @@ import ( "errors" "fmt" - "gopkg.in/redis.v4/internal" - ierrors "gopkg.in/redis.v4/internal/errors" - "gopkg.in/redis.v4/internal/pool" - "gopkg.in/redis.v4/internal/proto" + "gopkg.in/redis.v5/internal" + ierrors "gopkg.in/redis.v5/internal/errors" + "gopkg.in/redis.v5/internal/pool" + "gopkg.in/redis.v5/internal/proto" ) // Redis transaction failed. diff --git a/tx_test.go b/tx_test.go index ddb9ddfa..03d220bb 100644 --- a/tx_test.go +++ b/tx_test.go @@ -7,7 +7,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "gopkg.in/redis.v4" + "gopkg.in/redis.v5" ) var _ = Describe("Tx", func() {