This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new db3a1b94e42 Rename MySQLClient to MySQLBinlogClient (#32535)
db3a1b94e42 is described below
commit db3a1b94e421cb72778b3c3f3bb12a03eb3b035a
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Aug 15 18:36:51 2024 +0800
Rename MySQLClient to MySQLBinlogClient (#32535)
---
.../{MySQLClient.java => MySQLBinlogClient.java} | 4 +-
.../ingest/dumper/MySQLIncrementalDumper.java | 6 +--
...LClientTest.java => MySQLBinlogClientTest.java} | 44 +++++++++++-----------
src/resources/spotbugs.xml | 2 +-
4 files changed, 28 insertions(+), 28 deletions(-)
diff --git
a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLClient.java
b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLBinlogClient.java
similarity index 99%
rename from
kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLClient.java
rename to
kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLBinlogClient.java
index 401dc1d7c03..38a167372ec 100644
---
a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLClient.java
+++
b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLBinlogClient.java
@@ -67,11 +67,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
/**
- * MySQL client.
+ * MySQL binlog client.
*/
@RequiredArgsConstructor
@Slf4j
-public final class MySQLClient {
+public final class MySQLBinlogClient {
private final ConnectInfo connectInfo;
diff --git
a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/dumper/MySQLIncrementalDumper.java
b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/dumper/MySQLIncrementalDumper.java
index f5f8ddb33b4..263d7dd9ac3 100644
---
a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/dumper/MySQLIncrementalDumper.java
+++
b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/dumper/MySQLIncrementalDumper.java
@@ -40,7 +40,7 @@ import
org.apache.shardingsphere.data.pipeline.mysql.ingest.binlog.event.DeleteR
import
org.apache.shardingsphere.data.pipeline.mysql.ingest.binlog.event.UpdateRowsEvent;
import
org.apache.shardingsphere.data.pipeline.mysql.ingest.binlog.event.WriteRowsEvent;
import org.apache.shardingsphere.data.pipeline.mysql.ingest.client.ConnectInfo;
-import org.apache.shardingsphere.data.pipeline.mysql.ingest.client.MySQLClient;
+import
org.apache.shardingsphere.data.pipeline.mysql.ingest.client.MySQLBinlogClient;
import
org.apache.shardingsphere.data.pipeline.mysql.ingest.binlog.column.MySQLDataTypeHandler;
import
org.apache.shardingsphere.db.protocol.mysql.packet.binlog.row.column.value.string.MySQLBinaryString;
import org.apache.shardingsphere.infra.annotation.HighFrequencyInvocation;
@@ -74,7 +74,7 @@ public final class MySQLIncrementalDumper extends
AbstractPipelineLifecycleRunna
private final PipelineChannel channel;
- private final MySQLClient client;
+ private final MySQLBinlogClient client;
private final String catalog;
@@ -89,7 +89,7 @@ public final class MySQLIncrementalDumper extends
AbstractPipelineLifecycleRunna
ConnectInfo connectInfo = new ConnectInfo(
generateServerId(), connectionProps.getHostname(),
connectionProps.getPort(), pipelineDataSourceConfig.getUsername(),
pipelineDataSourceConfig.getPassword());
log.info("incremental dump, jdbcUrl={}, serverId={}, hostname={},
port={}", pipelineDataSourceConfig.getUrl(), connectInfo.getServerId(),
connectInfo.getHost(), connectInfo.getPort());
- client = new MySQLClient(connectInfo, dumperContext.isDecodeWithTX());
+ client = new MySQLBinlogClient(connectInfo,
dumperContext.isDecodeWithTX());
catalog = connectionProps.getCatalog();
}
diff --git
a/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLClientTest.java
b/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLBinlogClientTest.java
similarity index 74%
rename from
kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLClientTest.java
rename to
kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLBinlogClientTest.java
index 0485c7d65be..3866f3c4a1c 100644
---
a/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLClientTest.java
+++
b/kernel/data-pipeline/dialect/mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLBinlogClientTest.java
@@ -51,7 +51,7 @@ import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
-class MySQLClientTest {
+class MySQLBinlogClientTest {
@Mock
private Channel channel;
@@ -62,12 +62,12 @@ class MySQLClientTest {
@Mock
private ChannelFuture channelFuture;
- private MySQLClient mysqlClient;
+ private MySQLBinlogClient client;
@SuppressWarnings("unchecked")
@BeforeEach
void setUp() throws InterruptedException {
- mysqlClient = new MySQLClient(new ConnectInfo(1, "host", 3306,
"username", "password"), false);
+ client = new MySQLBinlogClient(new ConnectInfo(1, "host", 3306,
"username", "password"), false);
when(channel.pipeline()).thenReturn(pipeline);
when(channel.isOpen()).thenReturn(true);
when(channel.close()).thenReturn(channelFuture);
@@ -84,17 +84,17 @@ class MySQLClientTest {
void assertConnect() throws ReflectiveOperationException {
ServerInfo expected = new ServerInfo(new ServerVersion("5.5.0-log"));
mockChannelResponse(expected);
- mysqlClient.connect();
- ServerInfo actual = (ServerInfo)
Plugins.getMemberAccessor().get(MySQLClient.class.getDeclaredField("serverInfo"),
mysqlClient);
+ client.connect();
+ ServerInfo actual = (ServerInfo)
Plugins.getMemberAccessor().get(MySQLBinlogClient.class.getDeclaredField("serverInfo"),
client);
assertThat(actual, is(expected));
}
@Test
void assertExecute() throws ReflectiveOperationException {
mockChannelResponse(new MySQLOKPacket(0));
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("channel"),
mysqlClient, channel);
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("eventLoopGroup"),
mysqlClient, new NioEventLoopGroup(1));
- assertTrue(mysqlClient.execute(""));
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("channel"),
client, channel);
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("eventLoopGroup"),
client, new NioEventLoopGroup(1));
+ assertTrue(client.execute(""));
verify(channel).writeAndFlush(ArgumentMatchers.any(MySQLComQueryPacket.class));
}
@@ -103,9 +103,9 @@ class MySQLClientTest {
MySQLOKPacket expected = new MySQLOKPacket(10L, 0L, 0);
Plugins.getMemberAccessor().set(MySQLOKPacket.class.getDeclaredField("affectedRows"),
expected, 10L);
mockChannelResponse(expected);
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("channel"),
mysqlClient, channel);
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("eventLoopGroup"),
mysqlClient, new NioEventLoopGroup(1));
- assertThat(mysqlClient.executeUpdate(""), is(10));
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("channel"),
client, channel);
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("eventLoopGroup"),
client, new NioEventLoopGroup(1));
+ assertThat(client.executeUpdate(""), is(10));
verify(channel).writeAndFlush(ArgumentMatchers.any(MySQLComQueryPacket.class));
}
@@ -113,20 +113,20 @@ class MySQLClientTest {
void assertExecuteQuery() throws ReflectiveOperationException {
InternalResultSet expected = new InternalResultSet(null);
mockChannelResponse(expected);
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("channel"),
mysqlClient, channel);
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("eventLoopGroup"),
mysqlClient, new NioEventLoopGroup(1));
- assertThat(mysqlClient.executeQuery(""), is(expected));
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("channel"),
client, channel);
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("eventLoopGroup"),
client, new NioEventLoopGroup(1));
+ assertThat(client.executeQuery(""), is(expected));
verify(channel).writeAndFlush(ArgumentMatchers.any(MySQLComQueryPacket.class));
}
@Test
void assertSubscribeBelow56Version() throws ReflectiveOperationException {
ServerInfo serverInfo = new ServerInfo(new ServerVersion("5.5.0-log"));
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("serverInfo"),
mysqlClient, serverInfo);
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("channel"),
mysqlClient, channel);
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("eventLoopGroup"),
mysqlClient, new NioEventLoopGroup(1));
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("serverInfo"),
client, serverInfo);
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("channel"),
client, channel);
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("eventLoopGroup"),
client, new NioEventLoopGroup(1));
mockChannelResponse(new MySQLOKPacket(0));
- mysqlClient.subscribe("", 4L);
+ client.subscribe("", 4L);
verify(channel).writeAndFlush(ArgumentMatchers.any(MySQLComRegisterSlaveCommandPacket.class));
verify(channel).writeAndFlush(ArgumentMatchers.any(MySQLComBinlogDumpCommandPacket.class));
}
@@ -140,7 +140,7 @@ class MySQLClientTest {
while (true) {
Promise<Object> responseCallback;
try {
- responseCallback = (Promise<Object>)
Plugins.getMemberAccessor().get(MySQLClient.class.getDeclaredField("responseCallback"),
mysqlClient);
+ responseCallback = (Promise<Object>)
Plugins.getMemberAccessor().get(MySQLBinlogClient.class.getDeclaredField("responseCallback"),
client);
} catch (final ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
@@ -153,8 +153,8 @@ class MySQLClientTest {
@Test
void assertPollFailed() throws ReflectiveOperationException {
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("channel"),
mysqlClient, channel);
-
Plugins.getMemberAccessor().set(MySQLClient.class.getDeclaredField("running"),
mysqlClient, false);
- assertThat(mysqlClient.poll(), is(Collections.emptyList()));
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("channel"),
client, channel);
+
Plugins.getMemberAccessor().set(MySQLBinlogClient.class.getDeclaredField("running"),
client, false);
+ assertThat(client.poll(), is(Collections.emptyList()));
}
}
diff --git a/src/resources/spotbugs.xml b/src/resources/spotbugs.xml
index 1e37cd018dd..1de37dbe349 100644
--- a/src/resources/spotbugs.xml
+++ b/src/resources/spotbugs.xml
@@ -95,7 +95,7 @@
<Bug code="OBL" />
</Match>
<Match>
- <Class
name="org.apache.shardingsphere.data.pipeline.mysql.ingest.client.MySQLClient"
/>
+ <Class
name="org.apache.shardingsphere.data.pipeline.mysql.ingest.client.MySQLBinlogClient"
/>
<Bug code="IS" />
</Match>
</FindBugsFilter>