Skip to content

Commit

Permalink
Prepare v5 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Oct 9, 2016
1 parent eeba1d7 commit f5245ef
Show file tree
Hide file tree
Showing 37 changed files with 81 additions and 138 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
95 changes: 18 additions & 77 deletions bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()

Expand All @@ -88,93 +86,36 @@ func benchmarkSetGoRedis(b *testing.B, poolSize, payloadSize int) {
})
}

func BenchmarkSetGoRedis10Conns64Bytes(b *testing.B) {
benchmarkSetGoRedis(b, 10, 64)
}

func BenchmarkSetGoRedis100Conns64Bytes(b *testing.B) {
benchmarkSetGoRedis(b, 100, 64)
}

func BenchmarkSetGoRedis10Conns1KB(b *testing.B) {
benchmarkSetGoRedis(b, 10, 1024)
}

func BenchmarkSetGoRedis100Conns1KB(b *testing.B) {
benchmarkSetGoRedis(b, 100, 1024)
}

func BenchmarkSetGoRedis10Conns10KB(b *testing.B) {
benchmarkSetGoRedis(b, 10, 10*1024)
}

func BenchmarkSetGoRedis100Conns10KB(b *testing.B) {
benchmarkSetGoRedis(b, 100, 10*1024)
}

func BenchmarkSetGoRedis10Conns1MB(b *testing.B) {
benchmarkSetGoRedis(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 BenchmarkSetRedis10Conns64Bytes(b *testing.B) {
benchmarkSetRedis(b, 10, 64)
}

func BenchmarkSetRedigo100Conns64Bytes(b *testing.B) {
benchmarkSetRedigo(b, 100, 64)
func BenchmarkSetRedis100Conns64Bytes(b *testing.B) {
benchmarkSetRedis(b, 100, 64)
}

func BenchmarkSetRedigo10Conns1KB(b *testing.B) {
benchmarkSetRedigo(b, 10, 1024)
func BenchmarkSetRedis10Conns1KB(b *testing.B) {
benchmarkSetRedis(b, 10, 1024)
}

func BenchmarkSetRedigo100Conns1KB(b *testing.B) {
benchmarkSetRedigo(b, 100, 1024)
func BenchmarkSetRedis100Conns1KB(b *testing.B) {
benchmarkSetRedis(b, 100, 1024)
}

func BenchmarkSetRedigo10Conns10KB(b *testing.B) {
benchmarkSetRedigo(b, 10, 10*1024)
func BenchmarkSetRedis10Conns10KB(b *testing.B) {
benchmarkSetRedis(b, 10, 10*1024)
}

func BenchmarkSetRedigo100Conns10KB(b *testing.B) {
benchmarkSetRedigo(b, 100, 10*1024)
func BenchmarkSetRedis100Conns10KB(b *testing.B) {
benchmarkSetRedis(b, 100, 10*1024)
}

func BenchmarkSetRedigo10Conns1MB(b *testing.B) {
benchmarkSetRedigo(b, 10, 1024*1024)
func BenchmarkSetRedis10Conns1MB(b *testing.B) {
benchmarkSetRedis(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) {
Expand Down
8 changes: 4 additions & 4 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 3 additions & 4 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sync"
"time"

"gopkg.in/redis.v4"
"gopkg.in/redis.v5"
)

var client *redis.Client
Expand Down
2 changes: 1 addition & 1 deletion export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/pool/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion internal/pool/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net"
"time"

"gopkg.in/redis.v4/internal/proto"
"gopkg.in/redis.v5/internal/proto"
)

const defaultBufSize = 4096
Expand Down
2 changes: 1 addition & 1 deletion internal/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"gopkg.in/bsm/ratelimit.v1"

"gopkg.in/redis.v4/internal"
"gopkg.in/redis.v5/internal"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion internal/pool/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion internal/proto/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strconv"

"gopkg.in/redis.v4/internal/errors"
"gopkg.in/redis.v5/internal/errors"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion internal/proto/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion internal/proto/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 2 additions & 1 deletion internal/proto/writebuffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion iterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"gopkg.in/redis.v4"
"gopkg.in/redis.v5"
)

const (
Expand Down Expand Up @@ -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")
}

//------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net"
"time"

"gopkg.in/redis.v4/internal/pool"
"gopkg.in/redis.v5/internal/pool"
)

type Options struct {
Expand Down
2 changes: 1 addition & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net"
"strconv"

"gopkg.in/redis.v4/internal/proto"
"gopkg.in/redis.v5/internal/proto"
)

// Implements proto.MultiBulkParse
Expand Down
4 changes: 2 additions & 2 deletions pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit f5245ef

Please sign in to comment.