Skip to content

Commit e85e5fb

Browse files
Merge remote-tracking branch 'origin/master' into lock-fix
2 parents 1161d31 + c2eb4e7 commit e85e5fb

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* [BUGFIX] Distributor: Shuffle-Sharding with IngestionTenantShardSize == 0, default sharding strategy should be used #5189
3737
* [BUGFIX] Cortex: Fix GRPC stream clients not honoring overrides for call options. #5797
3838
* [BUGFIX] Ring DDB: Fix lifecycle for ring counting unhealthy pods as healthy. #5838
39+
* [BUGFIX] Ring DDB: Fix region assignment. #5842
3940
* [BUGFIX] Improve GetRules performance #5805
4041

4142
## 1.16.0 2023-11-20

pkg/ring/kv/dynamodb/dynamodb.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,12 @@ func newDynamodbKV(cfg Config, logger log.Logger) (dynamodbKV, error) {
5757
return dynamodbKV{}, err
5858
}
5959

60+
awsCfg := aws.NewConfig()
6061
if len(cfg.Region) > 0 {
61-
sess.Config = &aws.Config{
62-
Region: aws.String(cfg.Region),
63-
}
62+
awsCfg = awsCfg.WithRegion(cfg.Region)
6463
}
6564

66-
dynamoDB := dynamodb.New(sess)
65+
dynamoDB := dynamodb.New(sess, awsCfg)
6766

6867
ddbKV := &dynamodbKV{
6968
ddbClient: dynamoDB,

pkg/ring/kv/dynamodb/dynamodb_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ func Test_TTLDisabled(t *testing.T) {
2828

2929
}
3030

31+
func Test_newDynamodbKV(t *testing.T) {
32+
_, err := newDynamodbKV(Config{Region: "us-west-2", TableName: "TEST"}, TestLogger{})
33+
34+
require.NoError(t, err)
35+
}
36+
3137
func Test_TTL(t *testing.T) {
3238
ddbClientMock := &mockDynamodb{
3339
putItem: func(input *dynamodb.PutItemInput) *dynamodb.PutItemOutput {

pkg/storage/tsdb/inmemory_index_cache.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package tsdb
22

33
import (
44
"context"
5-
"reflect"
65
"unsafe"
76

87
"github.com/VictoriaMetrics/fastcache"
@@ -122,12 +121,7 @@ func yoloBuf(s string) []byte {
122121
}
123122

124123
func copyString(s string) string {
125-
var b []byte
126-
h := (*reflect.SliceHeader)(unsafe.Pointer(&b))
127-
h.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data
128-
h.Len = len(s)
129-
h.Cap = len(s)
130-
return string(b)
124+
return string(unsafe.Slice(unsafe.StringData(s), len(s)))
131125
}
132126

133127
// copyToKey is required as underlying strings might be memory-mapped.

0 commit comments

Comments
 (0)