未验证 提交 67cc2873 编写于 作者: 杨翊 SionYang 提交者: GitHub

Classify packets which need to be refactor or replaced in sharding-scaling-mysql (#4670)

* Classify the MySQL protocol packets that needs to be refactor or replaced for auth

* Classify the MySQL protocol packets that needs to be refactor or replaced for command

* Classify the MySQL protocol packets that needs to be refactor or replaced for response

* Classify the MySQL protocol packets that needs to be refactor or replaced for binlog

* Classify the MySQL protocol packets that needs to be refactor or replaced for binlog

* Classify the MySQL protocol packets that needs to be refactor or replaced for codec

* For checkstyle

* use new database-protocol-module
上级 dd69b044
...@@ -34,6 +34,11 @@ ...@@ -34,6 +34,11 @@
<artifactId>sharding-scaling-core</artifactId> <artifactId>sharding-scaling-core</artifactId>
<version>${parent.version}</version> <version>${parent.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-database-protocol-mysql</artifactId>
<version>${parent.version}</version>
</dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
......
...@@ -225,6 +225,7 @@ public final class MySQLConnector { ...@@ -225,6 +225,7 @@ public final class MySQLConnector {
} }
class MySQLCommandResponseHandler extends ChannelInboundHandlerAdapter { class MySQLCommandResponseHandler extends ChannelInboundHandlerAdapter {
@Override @Override
public void channelRead(final ChannelHandlerContext ctx, final Object msg) { public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
if (null != responseCallback) { if (null != responseCallback) {
...@@ -242,6 +243,7 @@ public final class MySQLConnector { ...@@ -242,6 +243,7 @@ public final class MySQLConnector {
} }
class MySQLBinlogEventHandler extends ChannelInboundHandlerAdapter { class MySQLBinlogEventHandler extends ChannelInboundHandlerAdapter {
@Override @Override
public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception { public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception {
if (msg instanceof AbstractBinlogEvent) { if (msg instanceof AbstractBinlogEvent) {
......
...@@ -24,7 +24,10 @@ package org.apache.shardingsphere.shardingscaling.mysql.binlog.codec; ...@@ -24,7 +24,10 @@ package org.apache.shardingsphere.shardingscaling.mysql.binlog.codec;
* MySQL Internals Manual / MySQL Client/Server Protocol / Connection Phase / CapabilityFlags Flags * MySQL Internals Manual / MySQL Client/Server Protocol / Connection Phase / CapabilityFlags Flags
* https://dev.mysql.com/doc/internals/en/capability-flags.html#flag-CLIENT_PROTOCOL_41 * https://dev.mysql.com/doc/internals/en/capability-flags.html#flag-CLIENT_PROTOCOL_41
* </p> * </p>
*
* @deprecated Replace with {@link org.apache.shardingsphere.database.protocol.mysql.constant.MySQLCapabilityFlag}
*/ */
@Deprecated
public final class CapabilityFlags { public final class CapabilityFlags {
public static final int CLIENT_LONG_PASSWORD = 0x00000001; public static final int CLIENT_LONG_PASSWORD = 0x00000001;
......
...@@ -28,7 +28,10 @@ import java.util.BitSet; ...@@ -28,7 +28,10 @@ import java.util.BitSet;
* <p> * <p>
* https://dev.mysql.com/doc/internals/en/describing-packets.html * https://dev.mysql.com/doc/internals/en/describing-packets.html
* </p> * </p>
*
* @deprecated Replace with {@link org.apache.shardingsphere.database.protocol.mysql.payload.MySQLPacketPayload}
*/ */
@Deprecated
public final class DataTypesCodec { public final class DataTypesCodec {
private static final BigInteger MAX_BIG_INTEGER_VALUE = new BigInteger("18446744073709551615"); private static final BigInteger MAX_BIG_INTEGER_VALUE = new BigInteger("18446744073709551615");
......
...@@ -32,8 +32,11 @@ import lombok.SneakyThrows; ...@@ -32,8 +32,11 @@ import lombok.SneakyThrows;
/** /**
* MySQL client authentication packet. * MySQL client authentication packet.
*
* @deprecated Replace with {@link org.apache.shardingsphere.database.protocol.mysql.packet.handshake.MySQLHandshakeResponse41Packet}
*/ */
@Setter @Setter
@Deprecated
public final class ClientAuthenticationPacket extends AbstractPacket { public final class ClientAuthenticationPacket extends AbstractPacket {
@Setter(AccessLevel.NONE) @Setter(AccessLevel.NONE)
......
...@@ -46,9 +46,12 @@ import lombok.Setter; ...@@ -46,9 +46,12 @@ import lombok.Setter;
* n rest of the plugin provided data (at least 12 bytes) * n rest of the plugin provided data (at least 12 bytes)
* 1 \0 byte, terminating the second part of a scramble * 1 \0 byte, terminating the second part of a scramble
* </p> * </p>
*
* @deprecated Replace with {@link org.apache.shardingsphere.database.protocol.mysql.packet.handshake.MySQLHandshakePacket}
*/ */
@Setter @Setter
@Getter @Getter
@Deprecated
public final class HandshakeInitializationPacket extends AbstractPacket { public final class HandshakeInitializationPacket extends AbstractPacket {
private short protocolVersion = 0x0a; private short protocolVersion = 0x0a;
......
...@@ -32,6 +32,8 @@ import lombok.Setter; ...@@ -32,6 +32,8 @@ import lombok.Setter;
* |timestamp|type code|server_id|event_length|end_log_pos|flags | * |timestamp|type code|server_id|event_length|end_log_pos|flags |
* |4 bytes |1 byte |4 bytes |4 bytes |4 bytes |2 bytes| * |4 bytes |1 byte |4 bytes |4 bytes |4 bytes |2 bytes|
* +---------+---------+---------+------------+-----------+-------+ * +---------+---------+---------+------------+-----------+-------+
*
* Refactor by extends {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.MySQLCommandPacket}.
* </p> * </p>
*/ */
@Setter @Setter
......
...@@ -19,7 +19,11 @@ package org.apache.shardingsphere.shardingscaling.mysql.binlog.packet.binlog; ...@@ -19,7 +19,11 @@ package org.apache.shardingsphere.shardingscaling.mysql.binlog.packet.binlog;
/** /**
* Mysql column types. * Mysql column types.
*
*
* @deprecated Replaced by {@link org.apache.shardingsphere.database.protocol.mysql.constant.MySQLColumnType}
*/ */
@Deprecated
public final class ColumnTypes { public final class ColumnTypes {
public static final int MYSQL_TYPE_DECIMAL = 0; public static final int MYSQL_TYPE_DECIMAL = 0;
......
...@@ -30,6 +30,8 @@ import lombok.Getter; ...@@ -30,6 +30,8 @@ import lombok.Getter;
* *
* Checksum in format description event include algorithm information. * Checksum in format description event include algorithm information.
* https://dev.mysql.com/worklog/task/?id=2540#tabs-2540-4 * https://dev.mysql.com/worklog/task/?id=2540#tabs-2540-4
*
* Refactor by extends {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.MySQLCommandPacket}.
* </p> * </p>
*/ */
@Getter @Getter
......
...@@ -24,6 +24,10 @@ import lombok.Getter; ...@@ -24,6 +24,10 @@ import lombok.Getter;
/** /**
* Rotate event. * Rotate event.
*
* <p>
* Refactor by extends {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.MySQLCommandPacket}.
* </p>
*/ */
@Getter @Getter
public final class RotateEventPacket { public final class RotateEventPacket {
......
...@@ -36,6 +36,8 @@ import java.util.List; ...@@ -36,6 +36,8 @@ import java.util.List;
* *
* <p> * <p>
* https://dev.mysql.com/doc/internals/en/rows-event.html * https://dev.mysql.com/doc/internals/en/rows-event.html
*
* Refactor by extends {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.MySQLCommandPacket}.
* </p> * </p>
*/ */
@Getter @Getter
......
...@@ -27,6 +27,8 @@ import lombok.Getter; ...@@ -27,6 +27,8 @@ import lombok.Getter;
* *
* <p> * <p>
* https://dev.mysql.com/doc/internals/en/table-map-event.html * https://dev.mysql.com/doc/internals/en/table-map-event.html
*
* Refactor by extends {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.MySQLCommandPacket}.
* </p> * </p>
*/ */
@Getter @Getter
......
...@@ -27,6 +27,10 @@ import io.netty.buffer.ByteBufAllocator; ...@@ -27,6 +27,10 @@ import io.netty.buffer.ByteBufAllocator;
/** /**
* MySQL binlog dump command packet. * MySQL binlog dump command packet.
*
* <p>
* Refactor by extends {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.MySQLCommandPacket}.
* </p>
*/ */
@Setter @Setter
public final class BinlogDumpCommandPacket extends AbstractCommandPacket { public final class BinlogDumpCommandPacket extends AbstractCommandPacket {
......
...@@ -26,8 +26,11 @@ import java.nio.charset.StandardCharsets; ...@@ -26,8 +26,11 @@ import java.nio.charset.StandardCharsets;
/** /**
* MySQL Query command packet. * MySQL Query command packet.
*
* @deprecated Replaced with {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.query.text.query.MySQLComQueryPacket}
*/ */
@Setter @Setter
@Deprecated
public final class QueryCommandPacket extends AbstractCommandPacket { public final class QueryCommandPacket extends AbstractCommandPacket {
private String queryString; private String queryString;
......
...@@ -25,6 +25,10 @@ import lombok.Setter; ...@@ -25,6 +25,10 @@ import lombok.Setter;
/** /**
* Register salve command packet. * Register salve command packet.
*
* <p>
* Refactor by extends {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.MySQLCommandPacket}.
* </p>
*/ */
@Setter @Setter
public final class RegisterSlaveCommandPacket extends AbstractCommandPacket { public final class RegisterSlaveCommandPacket extends AbstractCommandPacket {
......
...@@ -29,8 +29,11 @@ import io.netty.buffer.ByteBuf; ...@@ -29,8 +29,11 @@ import io.netty.buffer.ByteBuf;
* MySQL Internals Manual / MySQL Client/Server Protocol / Overview / Generic Response Packets / EOF_Packet * MySQL Internals Manual / MySQL Client/Server Protocol / Overview / Generic Response Packets / EOF_Packet
* https://dev.mysql.com/doc/internals/en/packet-EOF_Packet.html * https://dev.mysql.com/doc/internals/en/packet-EOF_Packet.html
* </p> * </p>
*
* @deprecated Replace with {@link org.apache.shardingsphere.database.protocol.mysql.packet.generic.MySQLEofPacket}
*/ */
@Getter @Getter
@Deprecated
public final class EofPacket extends AbstractPacket { public final class EofPacket extends AbstractPacket {
private short fieldCount; private short fieldCount;
......
...@@ -29,8 +29,11 @@ import lombok.Getter; ...@@ -29,8 +29,11 @@ import lombok.Getter;
* MySQL Internals Manual / MySQL Client/Server Protocol / Overview / Generic Response Packets / ERR_Packet * MySQL Internals Manual / MySQL Client/Server Protocol / Overview / Generic Response Packets / ERR_Packet
* https://dev.mysql.com/doc/internals/en/packet-ERR_Packet.html * https://dev.mysql.com/doc/internals/en/packet-ERR_Packet.html
* </p> * </p>
*
* @deprecated Replace with {@link org.apache.shardingsphere.database.protocol.mysql.packet.generic.MySQLErrPacket}
*/ */
@Getter @Getter
@Deprecated
public final class ErrorPacket extends AbstractPacket { public final class ErrorPacket extends AbstractPacket {
private short fieldCount; private short fieldCount;
......
...@@ -29,8 +29,11 @@ import lombok.Getter; ...@@ -29,8 +29,11 @@ import lombok.Getter;
* MySQL Internals Manual / MySQL Client/Server Protocol / Text Protocol / COM_QUERY / COM_QUERY Response * MySQL Internals Manual / MySQL Client/Server Protocol / Text Protocol / COM_QUERY / COM_QUERY Response
* https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnDefinition41 * https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnDefinition41
* </p> * </p>
*
* @deprecated Replace with {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.query.MySQLColumnDefinition41Packet}
*/ */
@Getter @Getter
@Deprecated
public final class FieldPacket extends AbstractPacket { public final class FieldPacket extends AbstractPacket {
private String catalog; private String catalog;
......
...@@ -29,8 +29,11 @@ import lombok.Getter; ...@@ -29,8 +29,11 @@ import lombok.Getter;
* MySQL Internals Manual / MySQL Client/Server Protocol / Overview / Generic Response Packets / OK_Packet * MySQL Internals Manual / MySQL Client/Server Protocol / Overview / Generic Response Packets / OK_Packet
* https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html * https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html
* </p> * </p>
*
* @deprecated Replace with {@link org.apache.shardingsphere.database.protocol.mysql.packet.generic.MySQLOKPacket}
*/ */
@Getter @Getter
@Deprecated
public final class OkPacket extends AbstractPacket { public final class OkPacket extends AbstractPacket {
private short fieldCount; private short fieldCount;
......
...@@ -27,12 +27,12 @@ import lombok.Getter; ...@@ -27,12 +27,12 @@ import lombok.Getter;
* *
* <p> * <p>
* There is no define for result set packet header. * There is no define for result set packet header.
*
* MySQL Internals Manual / MySQL Client/Server Protocol / Prepared Statements / Binary Protocol ResultSet
* https://dev.mysql.com/doc/internals/en/binary-protocol-resultset.html
* </p> * </p>
*
* @deprecated Replace with {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.query.MySQLFieldCountPacket}
*/ */
@Getter @Getter
@Deprecated
public final class ResultSetHeaderPacket extends AbstractPacket { public final class ResultSetHeaderPacket extends AbstractPacket {
private long columnCount; private long columnCount;
......
...@@ -32,8 +32,11 @@ import java.util.List; ...@@ -32,8 +32,11 @@ import java.util.List;
* MySQL Internals Manual / MySQL Client/Server Protocol / Text Protocol / COM_QUERY / COM_QUERY Response * MySQL Internals Manual / MySQL Client/Server Protocol / Text Protocol / COM_QUERY / COM_QUERY Response
* https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-ProtocolText::ResultsetRow * https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-ProtocolText::ResultsetRow
* </p> * </p>
*
* @deprecated Replace with {@link org.apache.shardingsphere.database.protocol.mysql.packet.command.query.text.MySQLTextResultSetRowPacket}
*/ */
@Getter @Getter
@Deprecated
public final class RowDataPacket extends AbstractPacket { public final class RowDataPacket extends AbstractPacket {
private List<String> columns = new ArrayList<>(); private List<String> columns = new ArrayList<>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册