4242
4343public class MysqlConnection implements ErosaConnection {
4444
45- private static final Logger logger = LoggerFactory .getLogger (MysqlConnection .class );
45+ private static final Logger logger = LoggerFactory .getLogger (MysqlConnection .class );
4646
4747 private MysqlConnector connector ;
4848 private long slaveId ;
49- private Charset charset = Charset .forName ("UTF-8" );
49+ private Charset charset = Charset .forName ("UTF-8" );
5050 private BinlogFormat binlogFormat ;
5151 private BinlogImage binlogImage ;
5252
5353 // tsdb releated
5454 private AuthenticationInfo authInfo ;
55- protected int connTimeout = 5 * 1000 ; // 5秒
56- protected int soTimeout = 60 * 60 * 1000 ; // 1小时
57- private int binlogChecksum = LogEvent .BINLOG_CHECKSUM_ALG_OFF ;
55+ protected int connTimeout = 5 * 1000 ; // 5秒
56+ protected int soTimeout = 60 * 60 * 1000 ; // 1小时
57+ private int binlogChecksum = LogEvent .BINLOG_CHECKSUM_ALG_OFF ;
5858 // dump binlog bytes, 暂不包括meta与TSDB
5959 private AtomicLong receivedBinlogBytes ;
6060 private boolean compatiablePercona = false ;
@@ -223,7 +223,7 @@ public void dump(GTIDSet gtidSet, SinkFunction func) throws IOException {
223223 List <LogEvent > iterateEvents = decoder .processIterateDecode (event , context );
224224 if (!iterateEvents .isEmpty ()) {
225225 // 处理compress event
226- for (LogEvent itEvent : iterateEvents ) {
226+ for (LogEvent itEvent : iterateEvents ) {
227227 if (!func .sink (event )) {
228228 break ;
229229 }
@@ -480,13 +480,13 @@ private void updateSettings() throws IOException {
480480 }
481481
482482 /**
483- * MASTER_HEARTBEAT_PERIOD sets the interval in seconds between
484- * replication heartbeats. Whenever the master's binary log is updated
485- * with an event, the waiting period for the next heartbeat is reset.
486- * interval is a decimal value having the range 0 to 4294967 seconds and
487- * a resolution in milliseconds; the smallest nonzero value is 0.001.
488- * Heartbeats are sent by the master only if there are no unsent events
489- * in the binary log file for a period longer than interval.
483+ * MASTER_HEARTBEAT_PERIOD sets the interval in seconds between replication
484+ * heartbeats. Whenever the master's binary log is updated with an event, the
485+ * waiting period for the next heartbeat is reset. interval is a decimal value
486+ * having the range 0 to 4294967 seconds and a resolution in milliseconds; the
487+ * smallest nonzero value is 0.001. Heartbeats are sent by the master only if
488+ * there are no unsent events in the binary log file for a period longer than
489+ * interval.
490490 */
491491 try {
492492 long periodNano = TimeUnit .SECONDS .toNanos (MASTER_HEARTBEAT_PERIOD_SECONDS );
@@ -509,7 +509,8 @@ private void loadBinlogFormat() {
509509
510510 List <String > columnValues = rs .getFieldValues ();
511511 if (columnValues == null || columnValues .size () != 2 ) {
512- logger .warn ("unexpected binlog format query result, this may cause unexpected result, so throw exception to request network to io shutdown." );
512+ logger .warn (
513+ "unexpected binlog format query result, this may cause unexpected result, so throw exception to request network to io shutdown." );
513514 throw new IllegalStateException ("unexpected binlog format query result:" + rs .getFieldValues ());
514515 }
515516
@@ -577,11 +578,10 @@ private void loadVersionComment() {
577578 try {
578579 rs = query ("select @@version_comment" );
579580 List <String > columnValues = rs .getFieldValues ();
580- if (columnValues != null && columnValues .size () >= 1 && columnValues .get (0 ) != null ){
581- logger .warn ("--> loadVersionComment(), select @@version_comment : " + columnValues .get (0 ));
582- if (StringUtils .containsIgnoreCase (columnValues .get (0 ),"Percona" )){
581+ if (columnValues != null && columnValues .size () >= 1 && columnValues .get (0 ) != null ) {
582+ logger .warn ("load MySQL @@version_comment : " + columnValues .get (0 ));
583+ if (StringUtils .containsIgnoreCase (columnValues .get (0 ), "Percona" )) {
583584 compatiablePercona = true ;
584- logger .warn ("--> loadVersionComment(), set compatiablePercona = true" );
585585 }
586586 }
587587 } catch (Throwable e ) {
0 commit comments