-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix: creating gsi under on-demand mode #85
Fix: creating gsi under on-demand mode #85
Conversation
Hi @Julian-Chu. Thanks for your PR. I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much @Julian-Chu ! This is neat!
I have one questions below.
if pt == nil { | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch sir!
provisionedThroughput := &svcsdk.ProvisionedThroughput{ | ||
// ref: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ProvisionedThroughput.html | ||
// Minimum capacity units is 1 when using provisioned capacity mode | ||
ReadCapacityUnits: aws.Int64(1), | ||
WriteCapacityUnits: aws.Int64(1), | ||
} | ||
if pt.ReadCapacityUnits != nil { | ||
provisionedThroughput.ReadCapacityUnits = aws.Int64(*pt.ReadCapacityUnits) | ||
} | ||
|
||
if pt.WriteCapacityUnits != nil { | ||
provisionedThroughput.WriteCapacityUnits = aws.Int64(*pt.WriteCapacityUnits) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts: What if we're not using PROVISIONED capacity mode? Would 0's be allowed? If that's the case would it be worth to evaluate the capacity mode in this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean the PAY_PER_REQUEST
mode.
this is tricky part. IIRC, we don't allow to set 0 capacity units for PAY_PER_REQUEST
, please see the following message
conditions:
- message: |
InvalidParameter: 3 validation error(s) found.
- minimum field size of 1, UpdateTableInput.GlobalSecondaryIndexUpdates[0].Create.Projection.NonKeyAttributes.
- minimum field value of 1, UpdateTableInput.GlobalSecondaryIndexUpdates[0].Create.ProvisionedThroughput.ReadCapacityUnits.
- minimum field value of 1, UpdateTableInput.GlobalSecondaryIndexUpdates[0].Create.ProvisionedThroughput.WriteCapacityUnits.
status: "True"
type: ACK.Terminal
but aws DDB api will set capacity units as 0 when PAY_PER_REQUEST
If you set BillingMode as PROVISIONED, you must specify this property. If you set BillingMode as PAY_PER_REQUEST, you cannot specify this property.
If read/write capacity mode is PAY_PER_REQUEST the value is set to 0.
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ProvisionedThroughput.html
} | ||
} else { | ||
projection.ProjectionType = aws.String("") | ||
projection.NonKeyAttributes = []*string{} | ||
projection.NonKeyAttributes = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another nice catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: a-hilaly, Julian-Chu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test all |
Issue #, if available:
Description of changes:
pay-per-request
modeBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.