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

fix(rds): instance engine can be (wrongly) specified as engine when defining a cluster #8514

Closed
wants to merge 1 commit into from

Conversation

skinny85
Copy link
Contributor

@skinny85 skinny85 commented Jun 12, 2020

Currently, InstanceEngine extended ClusterEngine,
which meant you could pass InstanceEngine when creating a Cluster,
which would fail at deploy time.
This change splits the two classes into distinct types,
without a subtyping relationship between the two.

BREAKING CHANGE: DatabaseClusterEngine now takes props in its constructor instead of positional arguments

  • rds: DatabaseInstanceEngine now takes props in its constructor instead of positional arguments

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

@skinny85 skinny85 requested a review from nija-at June 12, 2020 01:06
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 12, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 6da44bd
  • Result: FAILED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

@jogold jogold left a comment

Choose a reason for hiding this comment

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

Indeed better when split

@nija-at nija-at changed the title fix(rds): split DatabaseClusterEngine and DatabaseInstanceEngine into separate types fix(rds): instance engine can be (wrongly) passed when defining a cluster Jun 12, 2020
Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

So much easier to review when the changes are separated. Thanks for taking the effort!

I've updated the title of this PR to talk about what problem is being solved, rather than how it is solved. For future reference, this goes into our changelog under 'Bug Fixes'.
Customers who read this should see what got fixed.

packages/@aws-cdk/aws-rds/lib/engine.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-rds/lib/engine.ts Outdated Show resolved Hide resolved
@skinny85 skinny85 force-pushed the feat/rds-engines-split branch from 6da44bd to 456b137 Compare June 12, 2020 21:50
@skinny85 skinny85 requested a review from nija-at June 12, 2020 21:51
@skinny85
Copy link
Contributor Author

@nija-at this is ready for another round of reviews!

@skinny85 skinny85 added the pr-linter/exempt-test The PR linter will not require test changes label Jun 12, 2020
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 456b137
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

*/
public readonly multiUserRotationApplication: secretsmanager.SecretRotationApplication;

protected readonly parameterGroupFamilies?: ParameterGroupFamily[];
Copy link
Contributor

Choose a reason for hiding this comment

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

This, and the 4th parameter on the constructor, are only needed on the DatabaseClusterEngine class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but they will be used in later PRs for engines, so I'd rather not remove them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this a case where we're leaving the state of the module in a half baked state, if/when the other PR takes a different turn or plans change?

Would prefer that this PR do the correct thing now and adjust it later as part of the future PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't this a case where we're leaving the state of the module in a half baked state, if/when the other PR takes a different turn or plans change?

No. This field is not public in DatabaseInstanceEngine, so it doesn't leave the module in any different shape than it is now.

packages/@aws-cdk/aws-rds/lib/engine.ts Outdated Show resolved Hide resolved
@nija-at nija-at changed the title fix(rds): instance engine can be (wrongly) passed when defining a cluster fix(rds): instance engine can be (wrongly) specified as engine when defining a cluster Jun 16, 2020
@skinny85 skinny85 force-pushed the feat/rds-engines-split branch from 456b137 to c0a0e90 Compare June 16, 2020 17:13
@skinny85 skinny85 requested a review from nija-at June 16, 2020 17:16
@skinny85
Copy link
Contributor Author

@nija-at included your comments, this is ready for another review!

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: c0a0e90
  • Result: FAILED
  • Build Logs (available for 30 days)

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

… separate types

Currently, InstanceEngine extended ClusterEngine,
which meant you could pass InstanceEngine when creating a Cluster,
which would fail at deploy time.
This change splits the two classes into distinct types,
without a subtyping relationship between the two.

BREAKING CHANGE: DatabaseClusterEngine now takes props in its constructor instead of positional arguments
* **rds**: DatabaseInstanceEngine now takes props in its constructor instead of positional arguments
@skinny85 skinny85 force-pushed the feat/rds-engines-split branch from c0a0e90 to 40d8622 Compare June 16, 2020 18:01
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 40d8622
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

* Base properties for all types of engines
* (cluster and instances).
*/
export interface BaseEngineProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be not exported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it has to be exported (otherwise JSII fails).

*/
public readonly multiUserRotationApplication: secretsmanager.SecretRotationApplication;

protected readonly parameterGroupFamilies?: ParameterGroupFamily[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this a case where we're leaving the state of the module in a half baked state, if/when the other PR takes a different turn or plans change?

Would prefer that this PR do the correct thing now and adjust it later as part of the future PR.

@@ -83,18 +83,20 @@ export = {

'parameter group family'(test: Test) {
Copy link
Contributor

Choose a reason for hiding this comment

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

(Missed this in the last round)

Extract all tests around engines into test.engine.ts

@skinny85
Copy link
Contributor Author

Superseded by #8686 .

@skinny85 skinny85 closed this Jun 22, 2020
@skinny85 skinny85 deleted the feat/rds-engines-split branch June 22, 2020 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. pr-linter/exempt-test The PR linter will not require test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants