You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/08/19 07:55:00 UTC
(shardingsphere) branch master updated: Move ProxyFlowControlHandler and ChannelAttrInitializer to shardingsphere-proxy-frontend-core module (#36353)
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 268a62cd85d Move ProxyFlowControlHandler and ChannelAttrInitializer to shardingsphere-proxy-frontend-core module (#36353)
268a62cd85d is described below
commit 268a62cd85d15b807b7823fa9b501cb4ba5bd582
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Tue Aug 19 15:54:54 2025 +0800
Move ProxyFlowControlHandler and ChannelAttrInitializer to shardingsphere-proxy-frontend-core module (#36353)
---
db-protocol/mysql/pom.xml | 7 +++++++
.../db/protocol/mysql/netty/MySQLSequenceIdInboundHandlerTest.java | 4 ++--
kernel/data-pipeline/dialect/mysql/pom.xml | 5 +++++
.../mysql/ingest/incremental/client/MySQLBinlogClient.java | 4 ++--
.../shardingsphere/proxy/frontend/command/CommandExecutorTask.java | 6 +++---
.../shardingsphere/proxy/frontend}/event/WriteCompleteEvent.java | 2 +-
.../proxy/frontend}/netty/ChannelAttrInitializer.java | 2 +-
.../proxy/frontend}/netty/ProxyFlowControlHandler.java | 4 ++--
.../proxy/frontend/netty/ServerHandlerInitializer.java | 4 +---
.../proxy/frontend}/netty/ChannelAttrInitializerTest.java | 2 +-
.../proxy/frontend}/netty/ProxyFlowControlHandlerTest.java | 4 ++--
.../proxy/frontend/netty/ServerHandlerInitializerTest.java | 2 --
12 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/db-protocol/mysql/pom.xml b/db-protocol/mysql/pom.xml
index 086c5f12762..6af11fd6c30 100644
--- a/db-protocol/mysql/pom.xml
+++ b/db-protocol/mysql/pom.xml
@@ -43,5 +43,12 @@
<artifactId>shardingsphere-infra-database-mysql</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-proxy-frontend-core</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/netty/MySQLSequenceIdInboundHandlerTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/netty/MySQLSequenceIdInboundHandlerTest.java
index 650caa6210f..a326cce9fb2 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/netty/MySQLSequenceIdInboundHandlerTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/netty/MySQLSequenceIdInboundHandlerTest.java
@@ -25,9 +25,9 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
import io.netty.channel.embedded.EmbeddedChannel;
-import org.apache.shardingsphere.db.protocol.event.WriteCompleteEvent;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLConstants;
-import org.apache.shardingsphere.db.protocol.netty.ProxyFlowControlHandler;
+import org.apache.shardingsphere.proxy.frontend.event.WriteCompleteEvent;
+import org.apache.shardingsphere.proxy.frontend.netty.ProxyFlowControlHandler;
import org.junit.jupiter.api.Test;
import java.util.concurrent.atomic.AtomicInteger;
diff --git a/kernel/data-pipeline/dialect/mysql/pom.xml b/kernel/data-pipeline/dialect/mysql/pom.xml
index 0f3d3547499..a416189d82e 100644
--- a/kernel/data-pipeline/dialect/mysql/pom.xml
+++ b/kernel/data-pipeline/dialect/mysql/pom.xml
@@ -32,6 +32,11 @@
<artifactId>shardingsphere-data-pipeline-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-proxy-frontend-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-mysql-protocol</artifactId>
diff --git a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/incremental/client/MySQLBinlogClient.java b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/incremental/client/MySQLBinlogClient.java
index ea6bbfd6f24..faa5241e61c 100644
--- a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/incremental/client/MySQLBinlogClient.java
+++ b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/incremental/client/MySQLBinlogClient.java
@@ -49,9 +49,9 @@ import org.apache.shardingsphere.db.protocol.mysql.packet.command.binlog.MySQLCo
import org.apache.shardingsphere.db.protocol.mysql.packet.command.query.text.query.MySQLComQueryPacket;
import org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLErrPacket;
import org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLOKPacket;
-import org.apache.shardingsphere.db.protocol.netty.ChannelAttrInitializer;
import org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperationException;
import org.apache.shardingsphere.infra.util.json.JsonUtils;
+import org.apache.shardingsphere.proxy.frontend.netty.ChannelAttrInitializer;
import java.net.InetSocketAddress;
import java.util.Collections;
@@ -372,7 +372,7 @@ public final class MySQLBinlogClient {
} catch (final RuntimeException ex) {
// CHECKSTYLE:ON
log.error("Reconnect failed, reconnect times: {}, lastBinlogEvent: {}", reconnectTimes, JsonUtils.toJsonString(lastBinlogEvent.get()), ex);
- this.wait(1000L << reconnectTimes);
+ wait(1000L << reconnectTimes);
}
}
}
diff --git a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTask.java b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTask.java
index ea73381c321..7efbe99c048 100644
--- a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTask.java
+++ b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/command/CommandExecutorTask.java
@@ -23,20 +23,20 @@ import io.netty.channel.ChannelHandlerContext;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.db.protocol.constant.CommonConstants;
-import org.apache.shardingsphere.db.protocol.event.WriteCompleteEvent;
+import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
import org.apache.shardingsphere.db.protocol.packet.command.CommandPacket;
import org.apache.shardingsphere.db.protocol.packet.command.CommandPacketType;
-import org.apache.shardingsphere.db.protocol.packet.DatabasePacket;
import org.apache.shardingsphere.db.protocol.payload.PacketPayload;
-import org.apache.shardingsphere.infra.exception.dialect.exception.SQLDialectException;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
import org.apache.shardingsphere.infra.exception.core.external.sql.ShardingSphereSQLException;
+import org.apache.shardingsphere.infra.exception.dialect.exception.SQLDialectException;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.exception.BackendConnectionException;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.frontend.command.executor.CommandExecutor;
import org.apache.shardingsphere.proxy.frontend.command.executor.QueryCommandExecutor;
import org.apache.shardingsphere.proxy.frontend.constant.LogMDCConstants;
+import org.apache.shardingsphere.proxy.frontend.event.WriteCompleteEvent;
import org.apache.shardingsphere.proxy.frontend.exception.ExpectedExceptions;
import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
import org.slf4j.MDC;
diff --git a/db-protocol/core/src/main/java/org/apache/shardingsphere/db/protocol/event/WriteCompleteEvent.java b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/event/WriteCompleteEvent.java
similarity index 94%
rename from db-protocol/core/src/main/java/org/apache/shardingsphere/db/protocol/event/WriteCompleteEvent.java
rename to proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/event/WriteCompleteEvent.java
index 9416bb79ab8..0dd920052ca 100644
--- a/db-protocol/core/src/main/java/org/apache/shardingsphere/db/protocol/event/WriteCompleteEvent.java
+++ b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/event/WriteCompleteEvent.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.db.protocol.event;
+package org.apache.shardingsphere.proxy.frontend.event;
/**
* Write complete event.
diff --git a/db-protocol/core/src/main/java/org/apache/shardingsphere/db/protocol/netty/ChannelAttrInitializer.java b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ChannelAttrInitializer.java
similarity index 96%
rename from db-protocol/core/src/main/java/org/apache/shardingsphere/db/protocol/netty/ChannelAttrInitializer.java
rename to proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ChannelAttrInitializer.java
index 8fa85981fa5..859167fd389 100644
--- a/db-protocol/core/src/main/java/org/apache/shardingsphere/db/protocol/netty/ChannelAttrInitializer.java
+++ b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ChannelAttrInitializer.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.db.protocol.netty;
+package org.apache.shardingsphere.proxy.frontend.netty;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
diff --git a/db-protocol/core/src/main/java/org/apache/shardingsphere/db/protocol/netty/ProxyFlowControlHandler.java b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ProxyFlowControlHandler.java
similarity index 90%
rename from db-protocol/core/src/main/java/org/apache/shardingsphere/db/protocol/netty/ProxyFlowControlHandler.java
rename to proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ProxyFlowControlHandler.java
index d519bc38b82..baafdbd472a 100644
--- a/db-protocol/core/src/main/java/org/apache/shardingsphere/db/protocol/netty/ProxyFlowControlHandler.java
+++ b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ProxyFlowControlHandler.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.db.protocol.netty;
+package org.apache.shardingsphere.proxy.frontend.netty;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.flow.FlowControlHandler;
-import org.apache.shardingsphere.db.protocol.event.WriteCompleteEvent;
+import org.apache.shardingsphere.proxy.frontend.event.WriteCompleteEvent;
/**
* Flow control handler for ShardingSphere-Proxy.
diff --git a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializer.java b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializer.java
index ba54c7e0c68..68a7f45a073 100644
--- a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializer.java
+++ b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializer.java
@@ -22,10 +22,8 @@ import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.db.protocol.codec.PacketCodec;
-import org.apache.shardingsphere.db.protocol.netty.ChannelAttrInitializer;
-import org.apache.shardingsphere.db.protocol.netty.ProxyFlowControlHandler;
-import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
/**
diff --git a/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/netty/ChannelAttrInitializerTest.java b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ChannelAttrInitializerTest.java
similarity index 96%
rename from db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/netty/ChannelAttrInitializerTest.java
rename to proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ChannelAttrInitializerTest.java
index becaa52802e..8f28ceee489 100644
--- a/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/netty/ChannelAttrInitializerTest.java
+++ b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ChannelAttrInitializerTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.db.protocol.netty;
+package org.apache.shardingsphere.proxy.frontend.netty;
import io.netty.channel.ChannelHandlerContext;
import org.apache.shardingsphere.db.protocol.constant.CommonConstants;
diff --git a/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/netty/ProxyFlowControlHandlerTest.java b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ProxyFlowControlHandlerTest.java
similarity index 93%
rename from db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/netty/ProxyFlowControlHandlerTest.java
rename to proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ProxyFlowControlHandlerTest.java
index 2352a281f81..e2aec5f95b0 100644
--- a/db-protocol/core/src/test/java/org/apache/shardingsphere/db/protocol/netty/ProxyFlowControlHandlerTest.java
+++ b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ProxyFlowControlHandlerTest.java
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.db.protocol.netty;
+package org.apache.shardingsphere.proxy.frontend.netty;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.embedded.EmbeddedChannel;
-import org.apache.shardingsphere.db.protocol.event.WriteCompleteEvent;
+import org.apache.shardingsphere.proxy.frontend.event.WriteCompleteEvent;
import org.junit.jupiter.api.Test;
import java.util.concurrent.atomic.AtomicBoolean;
diff --git a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializerTest.java b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializerTest.java
index e217c5a9fb1..0506f362a1d 100644
--- a/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializerTest.java
+++ b/proxy/frontend/core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializerTest.java
@@ -20,8 +20,6 @@ package org.apache.shardingsphere.proxy.frontend.netty;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import org.apache.shardingsphere.db.protocol.codec.PacketCodec;
-import org.apache.shardingsphere.db.protocol.netty.ChannelAttrInitializer;
-import org.apache.shardingsphere.db.protocol.netty.ProxyFlowControlHandler;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.test.infra.framework.mock.AutoMockExtension;