Skip to content

Commit a754bd5

Browse files
committed
fix: spotless check
1 parent 7f06271 commit a754bd5

7 files changed

Lines changed: 23 additions & 29 deletions

File tree

flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/debezium/DebeziumUtils.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ public class DebeziumUtils {
6464

6565
/** Creates and opens a new {@link JdbcConnection} to the primary writer instance. */
6666
public static JdbcConnection openJdbcConnection(MySqlSourceConfig sourceConfig) {
67-
LOG.info(
68-
"Opening a new JDBC connection to MySQL server at {}",
69-
sourceConfig.getHostname());
67+
LOG.info("Opening a new JDBC connection to MySQL server at {}", sourceConfig.getHostname());
7068
JdbcConnection jdbc =
7169
new JdbcConnection(
7270
JdbcConfiguration.adapt(sourceConfig.getDbzConfiguration()),
@@ -76,8 +74,7 @@ public static JdbcConnection openJdbcConnection(MySqlSourceConfig sourceConfig)
7674
try {
7775
jdbc.connect();
7876
} catch (Exception e) {
79-
LOG.error(
80-
"Failed to open MySQL connection to {}", sourceConfig.getHostname(), e);
77+
LOG.error("Failed to open MySQL connection to {}", sourceConfig.getHostname(), e);
8178
throw new FlinkRuntimeException(e);
8279
}
8380
return jdbc;
@@ -122,13 +119,10 @@ public static MySqlConnection createMySqlConnection(MySqlSourceConfig sourceConf
122119
public static MySqlConnection createSnapshotMySqlConnection(MySqlSourceConfig sourceConfig) {
123120
String snapshotHostname = sourceConfig.getSnapshotHostname();
124121
if (snapshotHostname == null) {
125-
LOG.debug(
126-
"No snapshot hostname configured, using primary for snapshot queries");
122+
LOG.debug("No snapshot hostname configured, using primary for snapshot queries");
127123
return createMySqlConnection(sourceConfig);
128124
}
129-
LOG.info(
130-
"Creating MySQL connection for snapshot queries at {}",
131-
snapshotHostname);
125+
LOG.info("Creating MySQL connection for snapshot queries at {}", snapshotHostname);
132126
Configuration dbzConfig = sourceConfig.getDbzConfiguration();
133127
Configuration snapshotConfig =
134128
dbzConfig.edit().with("database.hostname", snapshotHostname).build();

flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/debezium/task/MySqlSnapshotSplitReadTask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public class MySqlSnapshotSplitReadTask
8989
* Creates a new MySqlSnapshotSplitReadTask with separate writer and reader connections.
9090
*
9191
* @param primaryConnection Connection to the primary writer instance (used for binlog position)
92-
* @param snapshotConnection Connection to the snapshot instance (used for snapshot data queries)
92+
* @param snapshotConnection Connection to the snapshot instance (used for snapshot data
93+
* queries)
9394
*/
9495
public MySqlSnapshotSplitReadTask(
9596
MySqlSourceConfig sourceConfig,

flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/connection/JdbcConnectionFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public JdbcConnectionFactory(MySqlSourceConfig sourceConfig) {
4646
*
4747
* @param sourceConfig the source configuration
4848
* @param hostnameOverride if non-null, connect to this host instead of
49-
* sourceConfig.getHostname()
49+
* sourceConfig.getHostname()
5050
*/
5151
public JdbcConnectionFactory(MySqlSourceConfig sourceConfig, String hostnameOverride) {
5252
this.sourceConfig = sourceConfig;
@@ -66,10 +66,10 @@ public Connection connect(JdbcConfiguration config) throws SQLException {
6666
HikariDataSource dataSource =
6767
hostnameOverride != null
6868
? JdbcConnectionPools.getInstance()
69-
.getOrCreateConnectionPool(
70-
connectionPoolId, sourceConfig, hostnameOverride)
69+
.getOrCreateConnectionPool(
70+
connectionPoolId, sourceConfig, hostnameOverride)
7171
: JdbcConnectionPools.getInstance()
72-
.getOrCreateConnectionPool(connectionPoolId, sourceConfig);
72+
.getOrCreateConnectionPool(connectionPoolId, sourceConfig);
7373

7474
int i = 0;
7575
while (i < connectRetryTimes) {

flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/connection/JdbcConnectionPools.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public HikariDataSource getOrCreateConnectionPool(
5656
ConnectionPoolId poolId, MySqlSourceConfig sourceConfig, String hostname) {
5757
synchronized (pools) {
5858
if (!pools.containsKey(poolId)) {
59-
LOG.info("Create and register connection pool {} for hostname {}", poolId, hostname);
59+
LOG.info(
60+
"Create and register connection pool {} for hostname {}", poolId, hostname);
6061
pools.put(
6162
poolId,
6263
PooledDataSourceFactory.createPooledDataSource(sourceConfig, hostname));

flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/test/java/org/apache/flink/cdc/connectors/mysql/debezium/DebeziumUtilsTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ void testCreateSnapshotMySqlConnectionWithSnapshotHostname() {
8686

8787
// Primary connection should point to primary hostname
8888
Assertions.assertThat(primaryConnection.connectionString()).contains(PRIMARY_HOSTNAME);
89-
Assertions.assertThat(primaryConnection.connectionString()).doesNotContain(SNAPSHOT_HOSTNAME);
89+
Assertions.assertThat(primaryConnection.connectionString())
90+
.doesNotContain(SNAPSHOT_HOSTNAME);
9091
}
9192

9293
@Test

flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/test/java/org/apache/flink/cdc/connectors/mysql/debezium/task/MySqlSnapshotSplitReadTaskConnectionTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ void testStatefulTaskContextWithSeparateConnections() {
6565

6666
// Create StatefulTaskContext with both connections
6767
StatefulTaskContext context =
68-
new StatefulTaskContext(config, binaryLogClient, writerConnection, readerConnection);
68+
new StatefulTaskContext(
69+
config, binaryLogClient, writerConnection, readerConnection);
6970

7071
// Verify the context returns the correct connections
7172
assertThat(context.getConnection()).isSameAs(writerConnection);
@@ -87,7 +88,8 @@ void testStatefulTaskContextWithSameConnectionWhenNoReaderConfigured() {
8788

8889
// Create StatefulTaskContext
8990
StatefulTaskContext context =
90-
new StatefulTaskContext(config, binaryLogClient, writerConnection, readerConnection);
91+
new StatefulTaskContext(
92+
config, binaryLogClient, writerConnection, readerConnection);
9193

9294
// Verify both connections point to the same host (writer)
9395
assertThat(context.getConnection().connectionString()).contains(PRIMARY_HOSTNAME);
@@ -101,8 +103,7 @@ void testStatefulTaskContextLegacyConstructorUsesSameConnection() {
101103

102104
// Use the legacy constructor that takes only one connection
103105
MySqlConnection connection = DebeziumUtils.createMySqlConnection(config);
104-
StatefulTaskContext context =
105-
new StatefulTaskContext(config, binaryLogClient, connection);
106+
StatefulTaskContext context = new StatefulTaskContext(config, binaryLogClient, connection);
106107

107108
// Both getConnection() and getReaderConnection() should return the same instance
108109
assertThat(context.getConnection()).isSameAs(context.getSnapshotConnection());

flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/test/java/org/apache/flink/cdc/connectors/mysql/source/connection/ReaderConnectionTest.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ void testJdbcConnectionFactoryUsesHostnameOverride() {
114114
@Test
115115
void testConnectionPoolIdDifferentForWriterAndReader() {
116116
// Pool IDs should be different for writer and reader to ensure separate pools
117-
ConnectionPoolId writerPoolId =
118-
new ConnectionPoolId(WRITER_HOSTNAME, PORT, "testuser");
119-
ConnectionPoolId readerPoolId =
120-
new ConnectionPoolId(READER_HOSTNAME, PORT, "testuser");
117+
ConnectionPoolId writerPoolId = new ConnectionPoolId(WRITER_HOSTNAME, PORT, "testuser");
118+
ConnectionPoolId readerPoolId = new ConnectionPoolId(READER_HOSTNAME, PORT, "testuser");
121119

122120
assertThat(writerPoolId).isNotEqualTo(readerPoolId);
123121
assertThat(writerPoolId.getHost()).isEqualTo(WRITER_HOSTNAME);
@@ -127,10 +125,8 @@ void testConnectionPoolIdDifferentForWriterAndReader() {
127125
@Test
128126
void testConnectionPoolIdSameForSameHostname() {
129127
// Same hostname should result in equal pool IDs
130-
ConnectionPoolId poolId1 =
131-
new ConnectionPoolId(WRITER_HOSTNAME, PORT, "testuser");
132-
ConnectionPoolId poolId2 =
133-
new ConnectionPoolId(WRITER_HOSTNAME, PORT, "testuser");
128+
ConnectionPoolId poolId1 = new ConnectionPoolId(WRITER_HOSTNAME, PORT, "testuser");
129+
ConnectionPoolId poolId2 = new ConnectionPoolId(WRITER_HOSTNAME, PORT, "testuser");
134130

135131
assertThat(poolId1).isEqualTo(poolId2);
136132
assertThat(poolId1.hashCode()).isEqualTo(poolId2.hashCode());

0 commit comments

Comments
 (0)