-
Notifications
You must be signed in to change notification settings - Fork 4k
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
chore(rds): change the way Engines are modeled #8686
Conversation
d58f8ef
to
36f761f
Compare
@nija-at @rix0rrr this is a follow-up from #8412, and is ready for your review. In the interest of keeping this PR small, it doesn't include the following items agreed to in #8506 (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.
Comments so far...
export interface ClusterEngineBindOptions { | ||
/** | ||
* The role used for S3 importing. | ||
* | ||
* @default - none | ||
*/ | ||
readonly s3ImportRole?: iam.IRole; | ||
|
||
/** | ||
* The role used for S3 exporting. | ||
* | ||
* @default - none | ||
*/ | ||
readonly s3ExportRole?: iam.IRole; |
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.
These are only relevant for aurora. They should instead be modeled as properties of the aurora engine.
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.
Few things:
- I don't think they're actually relevant only for aurora. Let me experiment with it and verify.
- If that's true, then we should add validation for the other engines that fails if those have been provided. So they still should be passed here.
- These are properties of the Cluster though. That is, you can have 2 Clusters that have the same engine, but import/export from/to different S3 Buckets, using different Roles. I don't think it makes sense for them to be on Engine.
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.
Confirmed this works for PostgreSQL. Docs: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html#USER_PostgreSQL.S3Import
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 think they're actually relevant only for aurora. Let me experiment with it and verify.
Confirmed this works for PostgreSQL. Docs: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html#USER_PostgreSQL.S3Import
The heading on that article is 'Importing Amazon S3 Data into an Aurora PostgreSQL DB Cluster'. Did you try this on a non-Aurora PostgreSQL?
Can you confirm that the API will be approximately, as we discussed -
new rds.DatabaseCluster(this, 'Cluster', {
engine: new rds.AuroraClusterEngine({
s3ImportRole: ...,
s3ExportRole: ...,
// ...
}),
});
If not, what will the new API be when customers want to pass in s3ImportRole
and s3ExportRole
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 think they're actually relevant only for aurora. Let me experiment with it and verify.
Confirmed this works for PostgreSQL. Docs: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html#USER_PostgreSQL.S3Import
The heading on that article is 'Importing Amazon S3 Data into an Aurora PostgreSQL DB Cluster'. Did you try this on a non-Aurora PostgreSQL?
There is no cluster engine that's a non-Aurora PostgreSQL.
Either way, these options (S3 import/export) make sense for Clusters with all 3 currently supported engine types, which was the original question.
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.
engineMode
is an example of foobar
.
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 was hoping that we will be solving the problem where all properties are available on instances/clusters irrespective of whether they are supported or not.
As an example, the current (i.e. before this PR) experience allows customers to specify s3ImportRole
for even non-Aurora databases which will result in a validation error.
The best experience would be to present the user only with the options that the selected database engine supports.
Did you ever intend for this to be fixed here, or was this not your intention?
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.
As an example, the current (i.e. before this PR) experience allows customers to specify
s3ImportRole
for even non-Aurora databases which will result in a validation error.
Can you show me where that is? Because I actually don't think that's true.
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 was hoping that we will be solving the problem where all properties are available on instances/clusters irrespective of whether they are supported or not.
The best experience would be to present the user only with the options that the selected database engine supports.
Did you ever intend for this to be fixed here, or was this not your intention?
I thought we talked about this topic when we discussed how this API should look like, and we decided that the amount of axes an engine can vary on (family, version, mode, etc.) is too big to make a separate class for each variant. So, each engine can add runtime validation to make sure the properties of the Cluster/Instance it's being used for are correct (and, in your example, error out if it doesn't support S3 imports and/or exports).
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 thought we talked about this topic when we discussed how this API should look like, and we decided that the amount of axes an engine can vary on (family, version, mode, etc.) is too big to make a separate class for each variant. So, each engine can add runtime validation to make sure the properties of the Cluster/Instance it's being used for are correct (and, in your example, error out if it doesn't support S3 imports and/or exports).
As far as I can recall, we concluded that this will be the case for engine version and engine mode where it seemed like the number of properties affected are quite small and may not be worth modeling them separately. But I don't recall that being the conclusion for engine type.
I still think modeling the engine types separately and presenting only the options applicable to that engine type is a better ergonomic experience. Hence this issue is still valid #6713. Being closer to the RDS construct library than I, I'll let you decide whether it is or isn't.
I'm also not expecting this to be addressed in this PR (likely my mistake to have assumed that in the first place).
@nija-at can you address the |
2a63a95
to
893608a
Compare
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.
Next round of comments. Have got through the code changes for cluster engine and instance engine.
export interface ClusterEngineBindOptions { | ||
/** | ||
* The role used for S3 importing. | ||
* | ||
* @default - none | ||
*/ | ||
readonly s3ImportRole?: iam.IRole; | ||
|
||
/** | ||
* The role used for S3 exporting. | ||
* | ||
* @default - none | ||
*/ | ||
readonly s3ExportRole?: iam.IRole; |
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 was hoping that we will be solving the problem where all properties are available on instances/clusters irrespective of whether they are supported or not.
As an example, the current (i.e. before this PR) experience allows customers to specify s3ImportRole
for even non-Aurora databases which will result in a validation error.
The best experience would be to present the user only with the options that the selected database engine supports.
Did you ever intend for this to be fixed here, or was this not your intention?
} | ||
|
||
/** Creates a new Oracle Standard Edition instance engine. */ | ||
public static oracleStandardEdition(props: OracleSeInstanceEngineProps): IInstanceEngine { |
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.
oracleSE
and oracleEE
maybe? Does JSII do the right thing for other languages like Java here?
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.
Changed to oracleSe
and oracleEe
.
|
It will work exactly like it does today (the imported
No, because of point nr 2 above (customers need to be able to import existing ParameterGroups, including default ones that are created by RDS. In fact, we need it ourselves - we use that capability in the implementations of |
893608a
to
7861fae
Compare
@nija-at I've incorporated all of your comments, please re-review! |
export interface ClusterEngineBindOptions { | ||
/** | ||
* The role used for S3 importing. | ||
* | ||
* @default - none | ||
*/ | ||
readonly s3ImportRole?: iam.IRole; | ||
|
||
/** | ||
* The role used for S3 exporting. | ||
* | ||
* @default - none | ||
*/ | ||
readonly s3ExportRole?: iam.IRole; |
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 thought we talked about this topic when we discussed how this API should look like, and we decided that the amount of axes an engine can vary on (family, version, mode, etc.) is too big to make a separate class for each variant. So, each engine can add runtime validation to make sure the properties of the Cluster/Instance it's being used for are correct (and, in your example, error out if it doesn't support S3 imports and/or exports).
As far as I can recall, we concluded that this will be the case for engine version and engine mode where it seemed like the number of properties affected are quite small and may not be worth modeling them separately. But I don't recall that being the conclusion for engine type.
I still think modeling the engine types separately and presenting only the options applicable to that engine type is a better ergonomic experience. Hence this issue is still valid #6713. Being closer to the RDS construct library than I, I'll let you decide whether it is or isn't.
I'm also not expecting this to be addressed in this PR (likely my mistake to have assumed that in the first place).
* Return an optional default ParameterGroup, | ||
* possibly an imported one, | ||
* if one wasn't provided by the customer explicitly. |
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 needs a bit of work. It's not clear why it should be imported and how would an implementer know if it was provided by the customer.
Comments on protected methods should be written from the point of view of an implementor of this method. They must know what this method should do. They shouldn't have to see how it's used to reverse engineer it.
Change the types of the engine from DatabaseClusterEngine and its subclass, DatabaseInstanceEngine, to 2 separate interfaces, IClusterEngine and IInstanceEngine. Add properties to each of them, including engineVersion, and thus stop taking engineVersion separately as a property for instances, clusters and OptionGroups. Allow changing the version of an existing engine to an arbitrary string. Add a bind()-like protocol to both IClusterEngine and IInstanceEngine, which allows expressing validation and default values logic directly in the engines, instead of hard-coding them in cluster and instance. Because of those changes, creating a default cluster with Aurora MySQL or Postgres engines now works out of the box, instead of failing at deploy time. We also correctly set the port for Postgres clusters to 5432, instead of leaving it as the default 3306 (which is the MySQL port). Fixes aws#2213 Fixes aws#2512 Fixes aws#4150 Fixes aws#5126 Fixes aws#7072 BREAKING CHANGE: the class DatabaseClusterEngine has been replaced with the interface IClusterEngine in the type of DatabaseClusterProps.engine * **rds**: the class DatabaseInstanceEngine has been replaced with the interface IInstanceEngine in the type of DatabaseInstanceSourceProps.engine * **rds**: DatabaseClusterProps.engineVersion has been removed; instead, create an IClusterEngine with a specific version using the static factory methods in DatabaseClusterEngine * **rds**: DatabaseInstanceSourceProps.engineVersion has been removed; instead, create an IInstanceEngine with a specific version using the static factory methods in DatabaseInstanceEngine * **rds**: the property majorEngineVersion can no longer be passed when creating an OptionGroup; instead, create an IInstanceEngine with a specific version using the static factory methods in DatabaseInstanceEngine
7861fae
to
d23e930
Compare
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
Change the types of the engine from
DatabaseClusterEngine
and its subclass,DatabaseInstanceEngine
, to 2 separate interfaces,IClusterEngine
andIInstanceEngine
. Add properties to each of them, including engineVersion, and thus stop takingengineVersion
separately as a property for instances, clusters andOptionGroup
s. Allow creating engines with the version given as an arbitrary string.Add a
bind()
-like protocol to bothIClusterEngine
andIInstanceEngine
, which allows expressing validation and default values logic directly in the engines, instead of hard-coding them in cluster and instance.Because of those changes, creating a default cluster with Aurora MySQL or Postgres engines now works out of the box, instead of failing at deploy time. We also correctly set the port for Postgres clusters to 5432, instead of leaving it as the default 3306 (which is the MySQL port).
Fixes #2213
Fixes #2512
Fixes #4150
Fixes #5126
Fixes #7072
BREAKING CHANGE: the class
DatabaseClusterEngine
has been replaced with the interfaceIClusterEngine
in the type ofDatabaseClusterProps.engine
DatabaseInstanceEngine
has been replaced with the interfaceIInstanceEngine
in the type ofDatabaseInstanceSourceProps.engine
DatabaseClusterProps.engineVersion
has been removed; instead, create anIClusterEngine
with a specific version using the static factory methods inDatabaseClusterEngine
DatabaseInstanceSourceProps.engineVersion
has been removed; instead, create anIInstanceEngine
with a specific version using the static factory methods inDatabaseInstanceEngine
majorEngineVersion
can no longer be passed when creating anOptionGroup
; instead, create anIInstanceEngine
with a specific version using the static factory methods inDatabaseInstanceEngine
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license