Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send ddb region as awsCfg #5842

Merged
merged 3 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* [BUGFIX] Distributor: Shuffle-Sharding with IngestionTenantShardSize == 0, default sharding strategy should be used #5189
* [BUGFIX] Cortex: Fix GRPC stream clients not honoring overrides for call options. #5797
* [BUGFIX] Ring DDB: Fix lifecycle for ring counting unhealthy pods as healthy. #5838
* [BUGFIX] Ring DDB: Fix region assignment. #5842


## 1.16.0 2023-11-20
Expand Down
7 changes: 3 additions & 4 deletions pkg/ring/kv/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ func newDynamodbKV(cfg Config, logger log.Logger) (dynamodbKV, error) {
return dynamodbKV{}, err
}

awsCfg := aws.NewConfig()
if len(cfg.Region) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this check still necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Region here is optional in the config.
I would need to do a test to see what the client will do if we send an empty string. I am not sure if it will try to use the env var.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool just a nit

sess.Config = &aws.Config{
Region: aws.String(cfg.Region),
}
awsCfg = awsCfg.WithRegion(cfg.Region)
}

dynamoDB := dynamodb.New(sess)
dynamoDB := dynamodb.New(sess, awsCfg)

ddbKV := &dynamodbKV{
ddbClient: dynamoDB,
Expand Down
6 changes: 6 additions & 0 deletions pkg/ring/kv/dynamodb/dynamodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ func Test_TTLDisabled(t *testing.T) {

}

func Test_newDynamodbKV(t *testing.T) {
_, err := newDynamodbKV(Config{Region: "us-west-2", TableName: "TEST"}, TestLogger{})

require.NoError(t, err)
}

func Test_TTL(t *testing.T) {
ddbClientMock := &mockDynamodb{
putItem: func(input *dynamodb.PutItemInput) *dynamodb.PutItemOutput {
Expand Down
Loading