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

feat(dynamodb): recovery period in days for dynamodb table v1 #33010

Conversation

rrhodes
Copy link
Contributor

@rrhodes rrhodes commented Jan 18, 2025

Issue

Closes #32888.

Reason for this change

Support for point-in-time recovery period in days was introduced to L1 construct CfnTable in PointInTimeRecoverySpecification.

Description of changes

Added L2 construct support for point-in-time recovery period in days. This applies to the Table construct only. Happy to raise a separate PR for TableV2 or revisit the scope of this PR on request.

Describe any new or updated permissions being added

N/A.

Description of how you validated changes

New unit and integration test coverage provided.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Jan 18, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team January 18, 2025 17:48
@github-actions github-actions bot added the valued-contributor [Pilot] contributed between 6-12 PRs to the CDK label Jan 18, 2025
@@ -631,6 +631,15 @@ const table = new dynamodb.TableV2(this, 'Table', {
});
```

`recoveryPeriodInDays` specifies the number of preceding days for which continuous backups are taken and maintained. If this property is set without configuring `pointInTimeRecovery` then point-in-time recovery will be enabled by default.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to discuss default behaviour documented here if there's any concerns. IMO it makes sense to set pointInTimeRecovery = true by default if recoveryPeriodInDays is set (with the ability to override pointInTimeRecovery = false if desired).

pointInTimeRecoverySpecification = { pointInTimeRecoveryEnabled: true, recoveryPeriodInDays };
}

if (pointInTimeRecovery != null) {
Copy link
Contributor Author

@rrhodes rrhodes Jan 18, 2025

Choose a reason for hiding this comment

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

This was lifted-and-shifted from existing logic, but I think we should refactor this to a more precise check for undefined.

From this change, I understand the check was added to distinguish between undefined and false, which the proposed refactor would still fulfil.

Thoughts?

Suggested change
if (pointInTimeRecovery != null) {
if (pointInTimeRecovery !== undefined) {

pointInTimeRecovery?: boolean,
recoveryPeriodInDays?: number,
): CfnTable.PointInTimeRecoverySpecificationProperty | undefined {
if (pointInTimeRecovery == null && recoveryPeriodInDays === undefined) return undefined;
Copy link
Contributor Author

@rrhodes rrhodes Jan 18, 2025

Choose a reason for hiding this comment

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

I'd prefer to refactor this to the below suggestion but conditional on thoughts to this thread.

Suggested change
if (pointInTimeRecovery == null && recoveryPeriodInDays === undefined) return undefined;
if (pointInTimeRecovery === undefined && recoveryPeriodInDays === undefined) return undefined;

Copy link

codecov bot commented Jan 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.39%. Comparing base (53dc0d8) to head (44514ce).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #33010   +/-   ##
=======================================
  Coverage   81.39%   81.39%           
=======================================
  Files         225      225           
  Lines       13714    13714           
  Branches     2411     2411           
=======================================
  Hits        11162    11162           
  Misses       2277     2277           
  Partials      275      275           
Flag Coverage Δ
suite.unit 81.39% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 80.70% <ø> (ø)
packages/aws-cdk-lib/core 82.10% <ø> (ø)

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 44514ce
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@rrhodes
Copy link
Contributor Author

rrhodes commented Jan 18, 2025

Looks like there's ongoing changes to point-in-time recovery configuration so I'll keep this PR as a draft. May be able to close this if the other PR covers all required changes.

@GavinZZ
Copy link
Contributor

GavinZZ commented Jan 23, 2025

Hi @rrhodes thank you for drafting this PR. There's actually another PR from internal AWS DynamoDB team and we're working to get that merged https://github.com/aws/aws-cdk/pull/33059/files.

I apologize for the wasted effort but appreciate you for contributing. If you have any other PR that's pending review, feel free to ping me and I'll prioritize the review (so that this doesn't happen again). I'm going to close this PR in regards to the other PR we have.

@GavinZZ GavinZZ closed this Jan 23, 2025
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 valued-contributor [Pilot] contributed between 6-12 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-dynamodb: add RecoveryPeriodInDays to interface PointInTimeRecoverySpecificationProperty
3 participants