Prepare v5 release.

This commit is contained in:
Vladimir Mihailenco 2016-10-09 10:49:28 +00:00
parent eeba1d7db1
commit f5245efa73
37 changed files with 81 additions and 138 deletions

View File

@ -18,7 +18,5 @@ install:
- go get gopkg.in/bsm/ratelimit.v1 - go get gopkg.in/bsm/ratelimit.v1
- go get github.com/onsi/ginkgo - go get github.com/onsi/ginkgo
- go get github.com/onsi/gomega - go get github.com/onsi/gomega
- go get github.com/garyburd/redigo/redis
- mkdir -p $HOME/gopath/src/gopkg.in - mkdir -p $HOME/gopath/src/gopkg.in
- mv $HOME/gopath/src/github.com/go-redis/redis $HOME/gopath/src/gopkg.in/redis.v4 - mv `pwd` $HOME/gopath/src/gopkg.in/redis.v5
- cd $HOME/gopath/src/gopkg.in/redis.v4

3
CHANGELOG.md Normal file
View File

@ -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.

View File

@ -5,9 +5,7 @@ import (
"testing" "testing"
"time" "time"
redigo "github.com/garyburd/redigo/redis" "gopkg.in/redis.v5"
"gopkg.in/redis.v4"
) )
func benchmarkRedisClient(poolSize int) *redis.Client { 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) client := benchmarkRedisClient(poolSize)
defer client.Close() defer client.Close()
@ -88,93 +86,36 @@ func benchmarkSetGoRedis(b *testing.B, poolSize, payloadSize int) {
}) })
} }
func BenchmarkSetGoRedis10Conns64Bytes(b *testing.B) { func BenchmarkSetRedis10Conns64Bytes(b *testing.B) {
benchmarkSetGoRedis(b, 10, 64) benchmarkSetRedis(b, 10, 64)
} }
func BenchmarkSetGoRedis100Conns64Bytes(b *testing.B) { func BenchmarkSetRedis100Conns64Bytes(b *testing.B) {
benchmarkSetGoRedis(b, 100, 64) benchmarkSetRedis(b, 100, 64)
} }
func BenchmarkSetGoRedis10Conns1KB(b *testing.B) { func BenchmarkSetRedis10Conns1KB(b *testing.B) {
benchmarkSetGoRedis(b, 10, 1024) benchmarkSetRedis(b, 10, 1024)
} }
func BenchmarkSetGoRedis100Conns1KB(b *testing.B) { func BenchmarkSetRedis100Conns1KB(b *testing.B) {
benchmarkSetGoRedis(b, 100, 1024) benchmarkSetRedis(b, 100, 1024)
} }
func BenchmarkSetGoRedis10Conns10KB(b *testing.B) { func BenchmarkSetRedis10Conns10KB(b *testing.B) {
benchmarkSetGoRedis(b, 10, 10*1024) benchmarkSetRedis(b, 10, 10*1024)
} }
func BenchmarkSetGoRedis100Conns10KB(b *testing.B) { func BenchmarkSetRedis100Conns10KB(b *testing.B) {
benchmarkSetGoRedis(b, 100, 10*1024) benchmarkSetRedis(b, 100, 10*1024)
} }
func BenchmarkSetGoRedis10Conns1MB(b *testing.B) { func BenchmarkSetRedis10Conns1MB(b *testing.B) {
benchmarkSetGoRedis(b, 10, 1024*1024) benchmarkSetRedis(b, 10, 1024*1024)
} }
func BenchmarkSetGoRedis100Conns1MB(b *testing.B) { func BenchmarkSetRedis100Conns1MB(b *testing.B) {
benchmarkSetGoRedis(b, 100, 1024*1024) benchmarkSetRedis(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 BenchmarkRedisSetGetBytes(b *testing.B) { func BenchmarkRedisSetGetBytes(b *testing.B) {

View File

@ -6,10 +6,10 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"gopkg.in/redis.v4/internal" "gopkg.in/redis.v5/internal"
"gopkg.in/redis.v4/internal/errors" "gopkg.in/redis.v5/internal/errors"
"gopkg.in/redis.v4/internal/hashtag" "gopkg.in/redis.v5/internal/hashtag"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
// ClusterOptions are used to configure a cluster client and should be // ClusterOptions are used to configure a cluster client and should be

View File

@ -13,8 +13,8 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
"gopkg.in/redis.v4/internal/hashtag" "gopkg.in/redis.v5/internal/hashtag"
) )
type clusterScenario struct { type clusterScenario struct {

View File

@ -7,10 +7,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-redis/redis/internal" "gopkg.in/redis.v5/internal"
"gopkg.in/redis.v5/internal/pool"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/proto"
"gopkg.in/redis.v4/internal/proto"
) )
var ( var (

View File

@ -4,7 +4,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
var _ = Describe("Cmd", func() { var _ = Describe("Cmd", func() {

View File

@ -5,8 +5,8 @@ import (
"strconv" "strconv"
"time" "time"
"gopkg.in/redis.v4/internal" "gopkg.in/redis.v5/internal"
"gopkg.in/redis.v4/internal/errors" "gopkg.in/redis.v5/internal/errors"
) )
func readTimeout(timeout time.Duration) time.Duration { func readTimeout(timeout time.Duration) time.Duration {

View File

@ -9,7 +9,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
var _ = Describe("Commands", func() { var _ = Describe("Commands", func() {

View File

@ -6,7 +6,7 @@ import (
"sync" "sync"
"time" "time"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
var client *redis.Client var client *redis.Client

View File

@ -3,7 +3,7 @@ package redis
import ( import (
"time" "time"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
func (c *baseClient) Pool() pool.Pooler { func (c *baseClient) Pool() pool.Pooler {

View File

@ -5,7 +5,7 @@ import (
"testing" "testing"
"time" "time"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
func benchmarkPoolGetPut(b *testing.B, poolSize int) { func benchmarkPoolGetPut(b *testing.B, poolSize int) {

View File

@ -4,7 +4,7 @@ import (
"net" "net"
"time" "time"
"gopkg.in/redis.v4/internal/proto" "gopkg.in/redis.v5/internal/proto"
) )
const defaultBufSize = 4096 const defaultBufSize = 4096

View File

@ -10,7 +10,7 @@ import (
"gopkg.in/bsm/ratelimit.v1" "gopkg.in/bsm/ratelimit.v1"
"gopkg.in/redis.v4/internal" "gopkg.in/redis.v5/internal"
) )
var ( var (

View File

@ -8,7 +8,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
var _ = Describe("ConnPool", func() { var _ = Describe("ConnPool", func() {

View File

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"gopkg.in/redis.v4/internal/errors" "gopkg.in/redis.v5/internal/errors"
) )
const ( const (

View File

@ -7,7 +7,7 @@ import (
"io" "io"
"strconv" "strconv"
ierrors "gopkg.in/redis.v4/internal/errors" ierrors "gopkg.in/redis.v5/internal/errors"
) )
type MultiBulkParse func(*Reader, int64) (interface{}, error) type MultiBulkParse func(*Reader, int64) (interface{}, error)

View File

@ -7,7 +7,8 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4/internal/proto"
"gopkg.in/redis.v5/internal/proto"
) )
var _ = Describe("Reader", func() { var _ = Describe("Reader", func() {

View File

@ -6,7 +6,8 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4/internal/proto"
"gopkg.in/redis.v5/internal/proto"
) )
var _ = Describe("WriteBuffer", func() { var _ = Describe("WriteBuffer", func() {

View File

@ -6,7 +6,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
var _ = Describe("ScanIterator", func() { var _ = Describe("ScanIterator", func() {

View File

@ -14,7 +14,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
const ( const (
@ -94,7 +94,7 @@ var _ = AfterSuite(func() {
func TestGinkgoSuite(t *testing.T) { func TestGinkgoSuite(t *testing.T) {
RegisterFailHandler(Fail) RegisterFailHandler(Fail)
RunSpecs(t, "gopkg.in/redis.v4") RunSpecs(t, "gopkg.in/redis.v5")
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -4,7 +4,7 @@ import (
"net" "net"
"time" "time"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
type Options struct { type Options struct {

View File

@ -5,7 +5,7 @@ import (
"net" "net"
"strconv" "strconv"
"gopkg.in/redis.v4/internal/proto" "gopkg.in/redis.v5/internal/proto"
) )
// Implements proto.MultiBulkParse // Implements proto.MultiBulkParse

View File

@ -4,8 +4,8 @@ import (
"sync" "sync"
"sync/atomic" "sync/atomic"
"gopkg.in/redis.v4/internal/errors" "gopkg.in/redis.v5/internal/errors"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
// Pipeline implements pipelining as described in // Pipeline implements pipelining as described in

View File

@ -7,7 +7,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
var _ = Describe("Pipelining", func() { var _ = Describe("Pipelining", func() {

View File

@ -6,8 +6,8 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
var _ = Describe("pool", func() { var _ = Describe("pool", func() {

View File

@ -5,9 +5,9 @@ import (
"net" "net"
"time" "time"
"gopkg.in/redis.v4/internal" "gopkg.in/redis.v5/internal"
"gopkg.in/redis.v4/internal/errors" "gopkg.in/redis.v5/internal/errors"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
// PubSub implements Pub/Sub commands as described in // PubSub implements Pub/Sub commands as described in

View File

@ -9,7 +9,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
var _ = Describe("PubSub", func() { var _ = Describe("PubSub", func() {

View File

@ -11,8 +11,8 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
var _ = Describe("races", func() { var _ = Describe("races", func() {

View File

@ -1,12 +1,12 @@
package redis // import "gopkg.in/redis.v4" package redis // import "gopkg.in/redis.v5"
import ( import (
"fmt" "fmt"
"log" "log"
"gopkg.in/redis.v4/internal" "gopkg.in/redis.v5/internal"
"gopkg.in/redis.v4/internal/errors" "gopkg.in/redis.v5/internal/errors"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
// Redis nil reply, .e.g. when key does not exist. // Redis nil reply, .e.g. when key does not exist.

View File

@ -7,7 +7,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
var _ = Describe("Client", func() { var _ = Describe("Client", func() {

View File

@ -9,10 +9,10 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"gopkg.in/redis.v4/internal" "gopkg.in/redis.v5/internal"
"gopkg.in/redis.v4/internal/consistenthash" "gopkg.in/redis.v5/internal/consistenthash"
"gopkg.in/redis.v4/internal/hashtag" "gopkg.in/redis.v5/internal/hashtag"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
var errRingShardsDown = errors.New("redis: all ring shards are down") var errRingShardsDown = errors.New("redis: all ring shards are down")

View File

@ -8,7 +8,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
var _ = Describe("Redis Ring", func() { var _ = Describe("Redis Ring", func() {

View File

@ -8,8 +8,8 @@ import (
"sync" "sync"
"time" "time"
"gopkg.in/redis.v4/internal" "gopkg.in/redis.v5/internal"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -4,7 +4,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
var _ = Describe("Sentinel", func() { var _ = Describe("Sentinel", func() {

8
tx.go
View File

@ -4,10 +4,10 @@ import (
"errors" "errors"
"fmt" "fmt"
"gopkg.in/redis.v4/internal" "gopkg.in/redis.v5/internal"
ierrors "gopkg.in/redis.v4/internal/errors" ierrors "gopkg.in/redis.v5/internal/errors"
"gopkg.in/redis.v4/internal/pool" "gopkg.in/redis.v5/internal/pool"
"gopkg.in/redis.v4/internal/proto" "gopkg.in/redis.v5/internal/proto"
) )
// Redis transaction failed. // Redis transaction failed.

View File

@ -7,7 +7,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"gopkg.in/redis.v4" "gopkg.in/redis.v5"
) )
var _ = Describe("Tx", func() { var _ = Describe("Tx", func() {