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(rds): support for local write forwarding in an Aurora Mysql cluster #31524

Merged
merged 11 commits into from
Sep 26, 2024

Conversation

badmintoncryer
Copy link
Contributor

Issue # (if applicable)

Closes #31523 .

Reason for this change

Cloudformation supports enabling local write forwarding feature but AWS CDK does not support it.

Description of changes

  • Add enableLocalWriteForwarding to DatabaseClusterBaseProps
  • Add validation that engineType is either aurora or aurora-mysql
    • Having engineType set to aurora means launching a MySQL-compatible Aurora cluster.

Description of how you validated changes

Add both unit and integ tests.

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 feature-request A feature should be added or improved. p2 labels Sep 23, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team September 23, 2024 01:50
@github-actions github-actions bot added the distinguished-contributor [Pilot] contributed 50+ PRs to the CDK label Sep 23, 2024
@badmintoncryer badmintoncryer changed the title feat(rds): support for local write forwarding for an Aurora Mysql cluster feat(rds): support for local write forwarding in an Aurora Mysql cluster Sep 23, 2024
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Sep 23, 2024
Copy link
Contributor

@go-to-k go-to-k left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I made one very minor comment.

(And below is just my note)

I ran CFn to see if CFn really throws when enableLocalWriteForwarding is false and engine type is not mysql. Then I got an error even though it was false. In other words, the validation was correct :)

    if (props.enableLocalWriteForwarding !== undefined && !['aurora', 'aurora-mysql'].includes(props.engine.engineType)) {
      throw new Error(`\'enableLocalWriteForwarding\' is only supported for Aurora Mysql cluster engine type, got: ${props.engine.engineType}`);
    }

packages/aws-cdk-lib/aws-rds/lib/cluster.ts Outdated Show resolved Hide resolved
@badmintoncryer
Copy link
Contributor Author

@go-to-k Thank you for your review!

Then I got an error even though it was false.

This result was also something I did not anticipate. The validation using !== undefined was not intended to account for this but happened by chance.

I added a case to the unit test to verify that an error occurs even when false is passed!

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Sep 23, 2024
@go-to-k
Copy link
Contributor

go-to-k commented Sep 23, 2024

It might be good to add a code comment at the conditional branch that says that a CFn error will occur not only when the property is true but also when false, if the engine type is not mysql. Otherwise developers might get confused.

@badmintoncryer
Copy link
Contributor Author

@go-to-k I have updated the description!

Copy link
Contributor

@go-to-k go-to-k left a comment

Choose a reason for hiding this comment

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

LGTM!

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Sep 25, 2024
Copy link
Contributor

@sumupitchayan sumupitchayan left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

Copy link
Contributor

mergify bot commented Sep 26, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Sep 26, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 8db1fef
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit 48c4192 into aws:main Sep 26, 2024
12 checks passed
Copy link
Contributor

mergify bot commented Sep 26, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

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 Sep 26, 2024
@badmintoncryer badmintoncryer deleted the writeForwarding branch September 26, 2024 23:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rds: support for local write forwarding for an Aurora mysql cluster
4 participants