|
@@ -74,7 +74,7 @@ public class BinaryLogRemoteClient implements BinaryLogClient {
|
|
|
|
|
|
private EventDeserializer eventDeserializer;
|
|
|
private Map<Long, TableMapEventData> tableMapEventByTableId;
|
|
|
- private boolean blocking = true;
|
|
|
+ private final boolean blocking = true;
|
|
|
private long serverId = 65535L;
|
|
|
private volatile String binlogFilename;
|
|
|
private volatile long binlogPosition = 4;
|
|
@@ -96,8 +96,7 @@ public class BinaryLogRemoteClient implements BinaryLogClient {
|
|
|
private boolean useBinlogFilenamePositionInGtidMode;
|
|
|
private Boolean isMariaDB;
|
|
|
|
|
|
- private final int versionTag = 840000;
|
|
|
-
|
|
|
+ private static final int MYSQL_VERSION_8_4 = 840000;
|
|
|
private final List<BinaryLogRemoteClient.EventListener> eventListeners = new CopyOnWriteArrayList<>();
|
|
|
private final List<BinaryLogRemoteClient.LifecycleListener> lifecycleListeners = new CopyOnWriteArrayList<>();
|
|
|
|
|
@@ -427,21 +426,19 @@ public class BinaryLogRemoteClient implements BinaryLogClient {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private boolean comparisonVersion() throws IOException {
|
|
|
+ private Integer getVersion() throws IOException {
|
|
|
channel.write(new QueryCommand("SELECT VERSION()"));
|
|
|
ResultSetRowPacket[] resultSet = readResultSet();
|
|
|
if (resultSet.length == 0) {
|
|
|
- throw new IOException("Failed to comparisonVersion,command SELECT VERSION()");
|
|
|
+ throw new IOException("Failed to getVersion, command SELECT VERSION()");
|
|
|
}
|
|
|
ResultSetRowPacket resultSetRow = resultSet[0];
|
|
|
- String version = resultSetRow.getValue(0);
|
|
|
- version = version.replace(".", "");
|
|
|
- version = String.format("%-6s", version).replace(" ", "0");
|
|
|
- return Integer.parseInt(version) >= versionTag;
|
|
|
+ String version = resultSetRow.getValue(0).replace(".", "");
|
|
|
+ return Integer.parseInt(String.format("%-6s", version).replace(" ", "0")) ;
|
|
|
}
|
|
|
|
|
|
private void fetchBinlogFilenameAndPosition() throws IOException {
|
|
|
- if (comparisonVersion()) {
|
|
|
+ if (getVersion() >= MYSQL_VERSION_8_4) {
|
|
|
channel.write(new QueryCommand("SHOW BINARY LOG STATUS"));
|
|
|
} else {
|
|
|
channel.write(new QueryCommand("show master status"));
|