|
@@ -4,6 +4,7 @@ import java.io.IOException;
|
|
|
import java.net.InetSocketAddress;
|
|
|
import java.nio.charset.Charset;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -28,6 +29,8 @@ import com.taobao.tddl.dbsync.binlog.LogContext;
|
|
|
import com.taobao.tddl.dbsync.binlog.LogDecoder;
|
|
|
import com.taobao.tddl.dbsync.binlog.LogEvent;
|
|
|
|
|
|
+import static com.alibaba.otter.canal.parse.inbound.mysql.dbsync.DirectLogFetcher.MASTER_HEARTBEAT_PERIOD_SECONDS;
|
|
|
+
|
|
|
public class MysqlConnection implements ErosaConnection {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(MysqlConnection.class);
|
|
@@ -293,6 +296,13 @@ public class MysqlConnection implements ErosaConnection {
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("update mariadb_slave_capability failed", e);
|
|
|
}
|
|
|
+
|
|
|
+ long periodNano = TimeUnit.SECONDS.toNanos(MASTER_HEARTBEAT_PERIOD_SECONDS);
|
|
|
+ try {
|
|
|
+ update("SET @master_heartbeat_period=" + periodNano);
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.warn("update master_heartbeat_period failed", e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|