Skip to content

Conversation

giograno
Copy link
Member

This PR enables a minimal implementation for the UpdateContinuousBackups and DescribeContinuousBackups actions.

The feature of continuous backup is actually not implemented. We only return the minimum needed to achieve Terraform parity for #7569.

@giograno giograno temporarily deployed to localstack-ext-tests February 23, 2023 02:44 — with GitHub Actions Inactive
@github-actions
Copy link

github-actions bot commented Feb 23, 2023

LocalStack integration with Pro

       3 files  ±0         3 suites  ±0   1h 32m 55s ⏱️ - 5m 4s
1 756 tests +3  1 386 ✔️ +2  370 💤 +1  0 ±0 
2 474 runs  +3  1 762 ✔️ +2  712 💤 +1  0 ±0 

Results for commit 9db9c48. ± Comparison against base commit 4be5754.

♻️ This comment has been updated with latest results.

@giograno giograno temporarily deployed to localstack-ext-tests February 23, 2023 14:27 — with GitHub Actions Inactive
        Implemented only the required responsed for the update and
        describe continuous backup in DDB, as requested to increase the
        parity with Terraform.
@giograno giograno temporarily deployed to localstack-ext-tests February 23, 2023 15:36 — with GitHub Actions Inactive
@giograno giograno marked this pull request as ready for review February 23, 2023 15:55
@coveralls
Copy link

coveralls commented Feb 23, 2023

Coverage Status

Coverage: 85.058% (+0.002%) from 85.056% when pulling 9db9c48 on continuous-backup into 4be5754 on master.

Copy link
Member

@whummer whummer left a 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)
Copy link
Member

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)

Copy link
Member Author

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)
Copy link
Member

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..

Copy link
Member Author

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:
Copy link
Member

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?

Copy link
Member Author

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.

@giograno giograno temporarily deployed to localstack-ext-tests February 24, 2023 20:38 — with GitHub Actions Inactive
@giograno giograno added the aws:dynamodb Amazon DynamoDB label Feb 24, 2023
@giograno giograno merged commit 8ef5e66 into master Feb 27, 2023
@giograno giograno deleted the continuous-backup branch February 27, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:dynamodb Amazon DynamoDB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants