-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Minimal implementation for continuous backup #7735
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
Conversation
Implemented only the required responsed for the update and describe continuous backup in DDB, as requested to increase the parity with Terraform.
557662f
to
def5207
Compare
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.
Great to see this supported @giograno , further increasing our parity and TF compatibility! 🎉 Added a few minor comments, would be great if we can address them before merging 👍
def describe_continuous_backups( | ||
self, context: RequestContext, table_name: TableName | ||
) -> DescribeContinuousBackupsOutput: | ||
self.get_global_table_region(context, table_name) |
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.
Should we take the result of this call and use it as the region for the store? (same pattern we're also using for other methods in the provider..)
global_table_region = self.get_global_table_region(context, table_name)
store = get_store(context.account_id, region=global_table_region)
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 am actually not sure about the behavior here.
If I remember correctly our implementation of global tables, we actually keep in DynamoDB local a single table in a given region. When we receive a request from a global region, we check with get_global_table_region
which is the region that actually holds the data in DDBLocal, and forwards the calls to that specific region with self._forward_request(context=context, region=global_table_region)
(we basically modify the region in the context to hit the "original" region). All over the provider, we use this global_table_region
only to patch the forwarded request, but we access the store with the actual region in the context.
table_name: TableName, | ||
point_in_time_recovery_specification: PointInTimeRecoverySpecification, | ||
) -> UpdateContinuousBackupsOutput: | ||
self.get_global_table_region(context, table_name) |
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.
same as above, regarding assigning and using global_table_region
..
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.
Same case as above.
), | ||
) | ||
return True | ||
except ContinuousBackupsUnavailableException: |
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.
Out of curiosity - under which circumstances would we run into this error here? Is this happening during creation of the DDB table, until the table status becomes ACTIVE
? Wondering if we should add a flag to the dynamodb_create_table
fixture to wait until the table becomes active. Also, we have a dynamodb_wait_for_table_active
fixture, which may come in handy here?
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.
By default, all the tables in DDB have continuous backup enabled. However, I found that AWS takes a few seconds to enable such backups after a table has been created and is active. This basically was needed to generate the snapshot.
This PR enables a minimal implementation for the
UpdateContinuousBackups
andDescribeContinuousBackups
actions.The feature of continuous backup is actually not implemented. We only return the minimum needed to achieve Terraform parity for #7569.