diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d8dc8e8dd..422cefdb47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan We use *breaking* word for marking changes that are not backward compatible (relates only to v0.y.z releases.) -## [v0.10.0-rc.0](https://github.com/thanos-io/thanos/releases/tag/v0.10.0-rc.0) - 2020.01.08 +## [v0.10.0-rc.1](https://github.com/thanos-io/thanos/releases/tag/v0.10.0-rc.1) - 2020.01.10 ### Fixed @@ -29,6 +29,7 @@ Compactor now properly handles partial block uploads for all operation like rete - [#1872](https://github.com/thanos-io/thanos/pull/1872) Ruler: `/api/v1/rules` now shows a properly formatted value - [#1945](https://github.com/thanos-io/thanos/pull/1945) `master` container images are now built with Go 1.13 - [#1956](https://github.com/thanos-io/thanos/pull/1956) Ruler: now properly ignores duplicated query addresses +- [#1975](https://github.com/thanos-io/thanos/pull/1975) Store Gateway: fixed panic caused by memcached servers selector when there's 1 memcached node ### Added diff --git a/VERSION b/VERSION index c8e421089d..2fe3f360c0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.10.0-rc.0 +0.10.0-rc.1 diff --git a/pkg/cacheutil/memcached_server_selector.go b/pkg/cacheutil/memcached_server_selector.go index 1318574045..37b693367c 100644 --- a/pkg/cacheutil/memcached_server_selector.go +++ b/pkg/cacheutil/memcached_server_selector.go @@ -74,9 +74,12 @@ func (s *MemcachedJumpHashSelector) PickServer(key string) (net.Addr, error) { return nil, memcache.ErrNoServers } if len(addrs) == 1 { + picked := addrs[0] + addrs = (addrs)[:0] addrsPool.Put(&addrs) - return (addrs)[0], nil + + return picked, nil } // Pick a server using the jump hash. diff --git a/pkg/cacheutil/memcached_server_selector_test.go b/pkg/cacheutil/memcached_server_selector_test.go index a215604ece..466db1c401 100644 --- a/pkg/cacheutil/memcached_server_selector_test.go +++ b/pkg/cacheutil/memcached_server_selector_test.go @@ -37,6 +37,54 @@ func TestNatSort(t *testing.T) { testutil.Equals(t, expected, input) } +func TestMemcachedJumpHashSelector_PickServer(t *testing.T) { + defer leaktest.CheckTimeout(t, 10*time.Second)() + + tests := []struct { + addrs []string + key string + expectedAddr string + expectedErr error + }{ + { + addrs: []string{}, + key: "test-1", + expectedErr: memcache.ErrNoServers, + }, + { + addrs: []string{"127.0.0.1:11211"}, + key: "test-1", + expectedAddr: "127.0.0.1:11211", + }, + { + addrs: []string{"127.0.0.1:11211", "127.0.0.2:11211"}, + key: "test-1", + expectedAddr: "127.0.0.1:11211", + }, + { + addrs: []string{"127.0.0.1:11211", "127.0.0.2:11211"}, + key: "test-2", + expectedAddr: "127.0.0.2:11211", + }, + } + + s := MemcachedJumpHashSelector{} + + for _, test := range tests { + testutil.Ok(t, s.SetServers(test.addrs...)) + + actualAddr, err := s.PickServer(test.key) + + if test.expectedErr != nil { + testutil.Equals(t, test.expectedErr, err) + testutil.Equals(t, nil, actualAddr) + } else { + testutil.Ok(t, err) + testutil.Equals(t, test.expectedAddr, actualAddr.String()) + } + } +} + func TestMemcachedJumpHashSelector_Each_ShouldRespectServersOrdering(t *testing.T) { defer leaktest.CheckTimeout(t, 10*time.Second)() diff --git a/tutorials/katacoda/thanos/1-globalview/courseBase.sh b/tutorials/katacoda/thanos/1-globalview/courseBase.sh index dfa288e0d8..cad8757226 100644 --- a/tutorials/katacoda/thanos/1-globalview/courseBase.sh +++ b/tutorials/katacoda/thanos/1-globalview/courseBase.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash docker pull quay.io/prometheus/prometheus:v2.14.0 -docker pull quay.io/thanos/thanos:v0.10.0-rc.0 +docker pull quay.io/thanos/thanos:v0.10.0-rc.1 diff --git a/tutorials/katacoda/thanos/1-globalview/step2.md b/tutorials/katacoda/thanos/1-globalview/step2.md index 6cb687d3c1..569a9de690 100644 --- a/tutorials/katacoda/thanos/1-globalview/step2.md +++ b/tutorials/katacoda/thanos/1-globalview/step2.md @@ -10,7 +10,7 @@ component and can be invoked in a single command. Let's take a look at all the Thanos commands: ``` -docker run --rm quay.io/thanos/thanos:v0.10.0-rc.0 --help +docker run --rm quay.io/thanos/thanos:v0.10.0-rc.1 --help ```{{execute}} You should see multiple commands that solves different purposes. @@ -53,7 +53,7 @@ docker run -d --net=host --rm \ -v $(pwd)/prometheus0_eu1.yml:/etc/prometheus/prometheus.yml \ --name prometheus-0-sidecar-eu1 \ -u root \ - quay.io/thanos/thanos:v0.10.0-rc.0 \ + quay.io/thanos/thanos:v0.10.0-rc.1 \ sidecar \ --http-address 0.0.0.0:19090 \ --grpc-address 0.0.0.0:19190 \ @@ -68,7 +68,7 @@ docker run -d --net=host --rm \ -v $(pwd)/prometheus0_us1.yml:/etc/prometheus/prometheus.yml \ --name prometheus-0-sidecar-us1 \ -u root \ - quay.io/thanos/thanos:v0.10.0-rc.0 \ + quay.io/thanos/thanos:v0.10.0-rc.1 \ sidecar \ --http-address 0.0.0.0:19091 \ --grpc-address 0.0.0.0:19191 \ @@ -81,7 +81,7 @@ docker run -d --net=host --rm \ -v $(pwd)/prometheus1_us1.yml:/etc/prometheus/prometheus.yml \ --name prometheus-1-sidecar-us1 \ -u root \ - quay.io/thanos/thanos:v0.10.0-rc.0 \ + quay.io/thanos/thanos:v0.10.0-rc.1 \ sidecar \ --http-address 0.0.0.0:19092 \ --grpc-address 0.0.0.0:19192 \ diff --git a/tutorials/katacoda/thanos/1-globalview/step3.md b/tutorials/katacoda/thanos/1-globalview/step3.md index bbdbb05981..987c918091 100644 --- a/tutorials/katacoda/thanos/1-globalview/step3.md +++ b/tutorials/katacoda/thanos/1-globalview/step3.md @@ -28,7 +28,7 @@ Click below snippet to start the Querier. ``` docker run -d --net=host --rm \ --name querier \ - quay.io/thanos/thanos:v0.10.0-rc.0 \ + quay.io/thanos/thanos:v0.10.0-rc.1 \ query \ --http-address 0.0.0.0:29090 \ --query.replica-label replica \