-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: first commit of globaltable l2 #25091
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like where this is going!
I'm noticing a whole bunch of code that is either no longer being used, or that should now be shared between table.ts
and global-table.ts
, so it's kinda hard to review on its own.
I assume you'll be doing a cleanup at some point, right?
// https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-secondary-indexes | ||
const MAX_LOCAL_SECONDARY_INDEX_COUNT = 5; | ||
|
||
/** | ||
* Options for configuring a system errors metric that considers multiple operations. | ||
*/ | ||
export interface SystemErrorsForOperationsMetricOptions extends cloudwatch.MetricOptions { | ||
|
||
/** | ||
* The operations to apply the metric to. | ||
* | ||
* @default - All operations available by DynamoDB tables will be considered. | ||
*/ | ||
readonly operations?: Operation[]; | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate that you copy/pasted all of this out to get started.
Now that we're working on landing this as "official" code in the CDK repository, it makes sense to start cleanup.
For all the definitions that are shared between table.ts
and global-table.ts
, it makes sense to move them out to a separate file (call it shared.ts
for example), and start referencing them from there.
/** | ||
* Represents the table schema attributes. | ||
*/ | ||
export interface SchemaOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this type. Remember how the existence of this type, shared as it was everywhere, made it impossible for us to make a change we needed to make to address one issue? We talked about this.
I hope you're not using it below :). If you are, just copy/paste these two fields into where you were using it before.
if (props.replicas) { | ||
if (props.stream && props.stream !== StreamViewType.NEW_AND_OLD_IMAGES) { | ||
throw new Error('`stream` must be set to `NEW_AND_OLD_IMAGES` when specifying `replicationRegions`'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is true. Do we also check this when addReplica
is called?
|
||
this.billingMode = props.billingMode ?? BillingMode.PAY_PER_REQUEST; | ||
} else { | ||
this.billingMode = props.billingMode ?? BillingMode.PAY_PER_REQUEST; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line occurs twice. It could occur only once, and doesn't have to be inside the if (props.replicas)
check, right?
* | ||
* @default - no replica tables are created | ||
*/ | ||
readonly replicationRegions?: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there be properties associated with replicas?
* When an item in the table is modified, StreamViewType determines what information | ||
* is written to the stream for this table. | ||
* | ||
* @default - streams are disabled unless `replicationRegions` is specified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/** | ||
* Indicates whether CloudFormation stack waits for replication to finish. | ||
* If set to false, the CloudFormation resource will mark the resource as | ||
* created and replication will be completed asynchronously. This property is | ||
* ignored if replicationRegions property is not set. | ||
* | ||
* DO NOT UNSET this property if adding/removing multiple replicationRegions | ||
* in one deployment, as CloudFormation only supports one region replication | ||
* at a time. CDK overcomes this limitation by waiting for replication to | ||
* finish before starting new replicationRegion. | ||
* | ||
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-globaltable.html#cfn-dynamodb-globaltable-replicas | ||
* @default true | ||
*/ | ||
readonly waitForReplicationToFinish?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a holdover from when we used to do the replication ourselves. Is this still necessary?
* | ||
* @param regions regions where to create tables | ||
*/ | ||
private createReplicaTables(regions: string[], timeout?: Duration, waitForReplicationToFinish?: boolean) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole function needs to disappear, doesn't it?
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
The pull request linter fails with the following errors:
PRs must pass status checks before we can provide a meaningful review. If you would like to request an exemption from the status checks or clarification on feedback, please leave a comment on this PR containing |
Drafting this until someone can work on it again. |
Superseded by #26563 |
This PR creates L2 construct for globalTable of Dynamodb
Resolves #16118
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license