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

[Optimization-4116][cdc] Add source url param in CDCSOURCE #4151

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ public boolean hasRelationShip(Integer id) {

@Override
public Table getTable(Integer id, String schemaName, String tableName) {
if (Asserts.isNullString(tableName)) {
return null;
}
DataBase dataBase = getById(id);
Asserts.checkNotNull(dataBase, Status.DATASOURCE_NOT_EXIST.getMessage());
try (Driver driver = Driver.build(dataBase.getDriverConfig())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,9 @@ public DataStreamSource<String> build(StreamExecutionEnvironment env) {

@Override
public Map<String, String> parseMetaDataConfig() {
boolean tinyInt1isBit = !config.getJdbc().containsKey("tinyInt1isBit")
|| "true".equalsIgnoreCase(config.getJdbc().get("tinyInt1isBit"));
boolean transformedBitIsBoolean = !config.getJdbc().containsKey("transformedBitIsBoolean")
|| "true".equalsIgnoreCase(config.getJdbc().get("transformedBitIsBoolean"));
String url = String.format("jdbc:mysql://%s:%d/", config.getHostname(), config.getPort());
if (tinyInt1isBit && transformedBitIsBoolean) {
url += "?tinyInt1isBit=true";
} else {
url += "?tinyInt1isBit=false";
}
String url = String.format(
"jdbc:mysql://%s:%d/%s",
config.getHostname(), config.getPort(), composeJdbcProperties(config.getJdbc()));
return parseMetaDataSingleConfig(url);
}

Expand All @@ -250,6 +243,7 @@ protected String generateUrl(String schema) {
config.getHostname(), config.getPort(), schema, composeJdbcProperties(config.getJdbc()));
}

// Append jdbc properties, such as: ?tinyInt1isBit=true&useSSL=true
private String composeJdbcProperties(Map<String, String> jdbcProperties) {
if (jdbcProperties == null || jdbcProperties.isEmpty()) {
return "";
Expand Down
Loading