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(redshift): single-node clusters fail with node count error #9961

Merged
merged 3 commits into from
Aug 27, 2020

Conversation

njlynch
Copy link
Contributor

@njlynch njlynch commented Aug 25, 2020

Single-node clusters defaulted to a numberOfNodes of 1; while this makes
sense, CloudFormation actually throws if any number of nodes is defined for a
single-node cluster. This change fixes this to default to undefined and
extends the validation for multi-node clusters.

fixes #9856


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

Single-node clusters defaulted to a `numberOfNodes` of 1; while this makes
sense, CloudFormation actually throws if any number of nodes is defined for a
single-node cluster. This change fixes this to default to `undefined` and
extends the validation for multi-node clusters.

fixes #9856
@njlynch njlynch requested a review from a team August 25, 2020 11:29
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Aug 25, 2020
packages/@aws-cdk/aws-redshift/lib/cluster.ts Outdated Show resolved Hide resolved
@@ -537,4 +533,20 @@ export class Cluster extends ClusterBase {
target: this,
});
}

private validateNodeCount(clusterType: ClusterType, numberOfNodes?: number): number | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to parseNodeCode because it returns a value. Usually "validateXxxx" methods return void.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

validateXxxx methods usually return void, and parseXxxx methods usually parse something. Neither really fits here IMO. I personally prefer "validate" here as describing more of the "main" intent rather than "parse", which doesn't describe the method at all.

That being said, I see only a few "validate" methods with return types (one of which was also my fault), and lots of "parse" methods that don't actually parse anything, so I guess that's the defined convention at this point. Would something like validateAndReturnXxx or validateOrDefault or something like that be any better?

@eladb eladb added the pr/do-not-merge This PR should not be merged at this time. label Aug 26, 2020
@eladb
Copy link
Contributor

eladb commented Aug 26, 2020

added do-not-merge label

@njlynch njlynch removed the pr/do-not-merge This PR should not be merged at this time. label Aug 27, 2020
@mergify
Copy link
Contributor

mergify bot commented Aug 27, 2020

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify
Copy link
Contributor

mergify bot commented Aug 27, 2020

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

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[aws-redshift] Single-node clusters fail with node count error
3 participants