Skip to content

Commit

Permalink
DBZ-8194 Add more GTID logging
Browse files Browse the repository at this point in the history
  • Loading branch information
vjuranek authored and jpechane committed Oct 24, 2024
1 parent 6599af2 commit 5d3c791
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ public void setGtidSet(String gtidStr) {
return;

synchronized (gtidSetAccessLock) {
logger.info("Enabling GTID");
this.gtidEnabled = true;

if (this.binlogFilename == null) {
Expand Down Expand Up @@ -569,6 +570,7 @@ public void setMariaDbSlaveCapability(int mariaDbSlaveCapability) {
* @throws IllegalStateException if binary log client is already connected
*/
public void connect() throws IOException, IllegalStateException {
logger.fine("Trying to connect to " + hostname + ":" + port);
if (!connectLock.tryLock()) {
throw new IllegalStateException("BinaryLogClient is already connected");
}
Expand Down Expand Up @@ -797,11 +799,13 @@ private void requestBinaryLogStreamMysql(long serverId) throws IOException {
Command dumpBinaryLogCommand;
synchronized (gtidSetAccessLock) {
if (this.gtidEnabled) {
logger.info("Requesting streaming from position filename: " + binlogFilename + ", position: " + binlogPosition + ", GTID set: " + gtidSet);
dumpBinaryLogCommand = new DumpBinaryLogGtidCommand(serverId,
useBinlogFilenamePositionInGtidMode ? binlogFilename : "",
useBinlogFilenamePositionInGtidMode ? binlogPosition : 4,
gtidSet);
} else {
logger.info("Requesting streaming from position filename: " + binlogFilename + ", position: " + binlogPosition);
dumpBinaryLogCommand = new DumpBinaryLogCommand(serverId, binlogFilename, binlogPosition);
}
}
Expand All @@ -819,7 +823,7 @@ protected void requestBinaryLogStreamMaria(long serverId) throws IOException {

synchronized (gtidSetAccessLock) {
if (this.gtidEnabled) {
logger.info(gtidSet.toString());
logger.info("Requesting streaming from GTID set: " + gtidSet);
channel.write(new QueryCommand("SET @slave_connect_state = '" + gtidSet.toString() + "'"));
checkError(channel.read());
channel.write(new QueryCommand("SET @slave_gtid_strict_mode = 0"));
Expand All @@ -828,6 +832,7 @@ protected void requestBinaryLogStreamMaria(long serverId) throws IOException {
checkError(channel.read());
dumpBinaryLogCommand = new DumpBinaryLogCommand(serverId, "", 0L, isUseSendAnnotateRowsEvent());
} else {
logger.info("Requesting streaming from position filename: " + binlogFilename + ", position: " + binlogPosition);
dumpBinaryLogCommand = new DumpBinaryLogCommand(serverId, binlogFilename, binlogPosition, isUseSendAnnotateRowsEvent());
}
}
Expand Down Expand Up @@ -1209,6 +1214,7 @@ protected void commitGtid(String sql) {
private void commitGtid() {
if (gtid != null) {
synchronized (gtidSetAccessLock) {
logger.finest("Adding GTID " + gtid);
gtidSet.addGtid(gtid);
}
}
Expand Down Expand Up @@ -1320,6 +1326,7 @@ public void unregisterLifecycleListener(LifecycleListener eventListener) {
* As the result following {@link #connect()} resumes client from where it left off.
*/
public void disconnect() throws IOException {
logger.fine("Disconnecting from " + hostname + ":" + port);
terminateKeepAliveThread();
terminateConnect();
}
Expand Down

0 comments on commit 5d3c791

Please sign in to comment.