-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[cdc] Bump Flink CDC version & migrate converter utils to Paimon repo #6532
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
3f4ec33
[cdc] Update flink.cdc.version to 3.5.0.
lvyanquan 084e709
[cdc] Add PaimonMetadataApplier.
lvyanquan a1b714d
[cdc] Add TypeConverter and DataConverter.
lvyanquan 57d93ae
[cdc] Add TypeConverter and DataConverter.
lvyanquan 737f184
[cdc] Add TypeConverter and DataConverter.
lvyanquan d15102f
[cdc] Add TypeConverter and DataConverter.
lvyanquan 6ae954c
Fix unstable CI
yuxiqian 6751a33
Polish error message
yuxiqian 94f158e
Fix fieldGetters' output
yuxiqian 64bee70
Optimize DataConverterTest & TypeConverterTest
yuxiqian 4e9e7db
Fix Typo
yuxiqian a7606ae
Revert log configuration changes
yuxiqian 05a0c58
Add partition keys into PK suite, too
yuxiqian 7465922
Rename PaimonMetadataApplierTest case to avoid confusion
yuxiqian 0983938
Set Future get timeout to avoid infinite waiting
yuxiqian 4349eb8
Remove unused methods
yuxiqian 714d80a
Reap jobs properly
yuxiqian 2c944cc
Revert incorrect fixes
yuxiqian 4353d1f
Avoid eagerly clearing connection pools
yuxiqian c605211
Fix Postgres connection pool clearing issue, too
yuxiqian cd5d53a
Dynamically load FlinkCatalogFactory
yuxiqian b9f7f1d
Update JavaDocs
yuxiqian a117271
Remove redundant arguments
yuxiqian 461d3e6
Modify row type
yuxiqian 2fa9940
Tweak DataConvertTest
yuxiqian 6a2f8c6
Address comments
yuxiqian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
.../java/org/apache/flink/cdc/connectors/base/relational/connection/JdbcConnectionPools.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.flink.cdc.connectors.base.relational.connection; | ||
|
|
||
| import com.zaxxer.hikari.HikariDataSource; | ||
| import org.apache.flink.cdc.common.annotation.VisibleForTesting; | ||
| import org.apache.flink.cdc.connectors.base.config.JdbcSourceConfig; | ||
| import org.apache.flink.util.FlinkRuntimeException; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * Copied from <a | ||
| * href="https://github.com/apache/flink-cdc/blob/release-3.5.0/flink-cdc-connect/flink-cdc-source-connectors/flink-cdc-base/src/main/java/org/apache/flink/cdc/connectors/base/relational/connection/JdbcConnectionPools.java">Flink | ||
| * CDC 3.5.0 resemblance</a>. Modified method {@link JdbcConnectionPools#clear()} at line 92 ~ 94. | ||
| */ | ||
| public class JdbcConnectionPools implements ConnectionPools<HikariDataSource, JdbcSourceConfig> { | ||
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(JdbcConnectionPools.class); | ||
|
|
||
| private static JdbcConnectionPools instance; | ||
| private final Map<ConnectionPoolId, HikariDataSource> pools = new HashMap<>(); | ||
| private static final Map<String, JdbcConnectionPoolFactory> POOL_FACTORY_MAP = new HashMap<>(); | ||
|
|
||
| private JdbcConnectionPools() {} | ||
|
|
||
| public static synchronized JdbcConnectionPools getInstance( | ||
| JdbcConnectionPoolFactory jdbcConnectionPoolFactory) { | ||
| if (instance == null) { | ||
| instance = new JdbcConnectionPools(); | ||
| } | ||
| POOL_FACTORY_MAP.put( | ||
| jdbcConnectionPoolFactory.getClass().getName(), jdbcConnectionPoolFactory); | ||
| return instance; | ||
| } | ||
|
|
||
| @Override | ||
| public HikariDataSource getOrCreateConnectionPool( | ||
| ConnectionPoolId poolId, JdbcSourceConfig sourceConfig) { | ||
| synchronized (pools) { | ||
| if (!pools.containsKey(poolId)) { | ||
| LOG.info("Create and register connection pool {}", poolId); | ||
| JdbcConnectionPoolFactory jdbcConnectionPoolFactory = | ||
| POOL_FACTORY_MAP.get(poolId.getDataSourcePoolFactoryIdentifier()); | ||
| if (jdbcConnectionPoolFactory == null) { | ||
| throw new FlinkRuntimeException( | ||
| String.format( | ||
| "Pool factory identifier is required for connection pool, but unknown pool factory identifier %s found.", | ||
| poolId.getDataSourcePoolFactoryIdentifier())); | ||
| } | ||
| pools.put(poolId, jdbcConnectionPoolFactory.createPooledDataSource(sourceConfig)); | ||
| } | ||
| return pools.get(poolId); | ||
| } | ||
| } | ||
|
|
||
| /** this method is only supported for test. */ | ||
| @VisibleForTesting | ||
| public String getJdbcUrl( | ||
| JdbcSourceConfig sourceConfig, String dataSourcePoolFactoryIdentifier) { | ||
| JdbcConnectionPoolFactory jdbcConnectionPoolFactory = | ||
| POOL_FACTORY_MAP.get(dataSourcePoolFactoryIdentifier); | ||
| if (jdbcConnectionPoolFactory == null) { | ||
| throw new FlinkRuntimeException( | ||
| String.format( | ||
| "Pool factory identifier is required for connection pools, but unknown pool factory identifier %s found.", | ||
| dataSourcePoolFactoryIdentifier)); | ||
| } | ||
| return jdbcConnectionPoolFactory.getJdbcUrl(sourceConfig); | ||
| } | ||
|
|
||
| public void clear() throws IOException { | ||
| // See org.apache.flink.cdc.connectors.mysql.source.connection.JdbcConnectionPools#clear. | ||
| } | ||
| } |
67 changes: 67 additions & 0 deletions
67
...ain/java/org/apache/flink/cdc/connectors/mysql/source/connection/JdbcConnectionPools.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.flink.cdc.connectors.mysql.source.connection; | ||
|
|
||
| import com.zaxxer.hikari.HikariDataSource; | ||
| import org.apache.flink.cdc.connectors.mysql.source.config.MySqlSourceConfig; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * Copied from <a | ||
| * href="https://github.com/apache/flink-cdc/blob/release-3.5.0/flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/connection/JdbcConnectionPools.java">Flink | ||
| * CDC 3.5.0 resemblance</a>. Modified method {@link JdbcConnectionPools#clear()} at line 60 ~ 66. | ||
| */ | ||
| public class JdbcConnectionPools implements ConnectionPools { | ||
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(JdbcConnectionPools.class); | ||
|
|
||
| private static final JdbcConnectionPools INSTANCE = new JdbcConnectionPools(); | ||
| private final Map<ConnectionPoolId, HikariDataSource> pools = new HashMap<>(); | ||
|
|
||
| private JdbcConnectionPools() {} | ||
|
|
||
| public static JdbcConnectionPools getInstance() { | ||
| return INSTANCE; | ||
| } | ||
|
|
||
| @Override | ||
| public HikariDataSource getOrCreateConnectionPool( | ||
| ConnectionPoolId poolId, MySqlSourceConfig sourceConfig) { | ||
| synchronized (pools) { | ||
| if (!pools.containsKey(poolId)) { | ||
| LOG.info("Create and register connection pool {}", poolId); | ||
| pools.put(poolId, PooledDataSourceFactory.createPooledDataSource(sourceConfig)); | ||
| } | ||
| return pools.get(poolId); | ||
| } | ||
| } | ||
|
|
||
| public void clear() throws IOException { | ||
| // Intentionally no-op. | ||
| // | ||
| // Flink CDC 3.2+ automatically clears connection pools to avoid connection leakage. | ||
| // However, this might accidentally affect two Paimon Action jobs running in one single mini | ||
| // cluster. We overwrite this class to get the same behaviors in CDC 3.1.1. | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.