-
Notifications
You must be signed in to change notification settings - Fork 215
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
Postgres schema name fix #5432
Postgres schema name fix #5432
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.
I have made this change in my PR
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.
Can remove all the changes associated with this pattern in other files
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 need to add schemaName in this class.
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.
Merged your other PR. Will resolve the conflicts here.
Signed-off-by: Hai Yan <oeyh@amazon.com>
3e4208a
to
3fbd0ad
Compare
Signed-off-by: Hai Yan <oeyh@amazon.com>
Signed-off-by: Hai Yan <oeyh@amazon.com>
@@ -25,9 +27,12 @@ public class DataFileProgressState { | |||
private String sourceDatabase; | |||
|
|||
/** | |||
* For MySQL, sourceTable is in the format of tableName | |||
* For Postgres, sourceTable is in the format of schemaName.tableName | |||
* For PostgreSQL engine type, schema is the schema name. |
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.
nit: sourceSchema is the schema name
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.
Fixed.
*/ | ||
@JsonProperty("sourceSchema") | ||
private String sourceSchema; |
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.
How do plan to use this field for MySQL ?
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 field will not be used when the source is MySQL database.
StreamProgressState progressState = streamPartition.getProgressState().get(); | ||
|
||
return progressState.getPrimaryKeyMap().get(databaseName + "." + schemaName + "." + tableName); | ||
} | ||
|
||
private String getDatabaseName(List<String> tableNames) { | ||
return tableNames.get(0).split("\\.")[0]; |
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.
nit: move the split delimiter to constant
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.
Done.
Signed-off-by: Hai Yan <oeyh@amazon.com>
Description
Postgres tables are specified as
database.schema.table
, while MySQL tables are specified asdatabase.table
. This PR fixes an issue that the metadata in Postgres export and stream are not consistent.In summary, we use
databaseName
,schemaName
andtableName
across the rds source plugin.schemaName
is specific for Postgres, but for MySQL, we also fill this field with the same value asdatabaseName
.Also refactors
TableMetadata
to use builder pattern. A lot of its usages in test code were updated.Issues Resolved
Contributes to #5309
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.