fixed format

This commit is contained in:
七锋
2018-09-04 11:39:23 +08:00
parent 47ac10ca18
commit a9cccb3017
12 changed files with 24 additions and 32 deletions

View File

@@ -4,9 +4,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet; import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet;
import com.alibaba.otter.canal.parse.driver.mysql.packets.MysqlGTIDSet;
import com.taobao.tddl.dbsync.binlog.event.FormatDescriptionLogEvent; import com.taobao.tddl.dbsync.binlog.event.FormatDescriptionLogEvent;
import com.taobao.tddl.dbsync.binlog.event.GtidLogEvent;
import com.taobao.tddl.dbsync.binlog.event.TableMapLogEvent; import com.taobao.tddl.dbsync.binlog.event.TableMapLogEvent;
/** /**

View File

@@ -3,11 +3,10 @@ package com.taobao.tddl.dbsync.binlog;
import java.io.IOException; import java.io.IOException;
import java.util.BitSet; import java.util.BitSet;
import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet;
import com.alibaba.otter.canal.parse.driver.mysql.packets.MysqlGTIDSet;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet;
import com.taobao.tddl.dbsync.binlog.event.AppendBlockLogEvent; import com.taobao.tddl.dbsync.binlog.event.AppendBlockLogEvent;
import com.taobao.tddl.dbsync.binlog.event.BeginLoadQueryLogEvent; import com.taobao.tddl.dbsync.binlog.event.BeginLoadQueryLogEvent;
import com.taobao.tddl.dbsync.binlog.event.CreateFileLogEvent; import com.taobao.tddl.dbsync.binlog.event.CreateFileLogEvent;

View File

@@ -50,8 +50,6 @@ public class GtidLogEvent extends LogEvent {
sequenceNumber = buffer.getLong64(); sequenceNumber = buffer.getLong64();
} }
// ignore gtid info read // ignore gtid info read
// sid.copy_from((uchar *)ptr_buffer); // sid.copy_from((uchar *)ptr_buffer);
// ptr_buffer+= ENCODED_SID_LENGTH; // ptr_buffer+= ENCODED_SID_LENGTH;

View File

@@ -15,9 +15,7 @@ public class FetcherPerformanceTest {
DirectLogFetcher fetcher = new DirectLogFetcher(); DirectLogFetcher fetcher = new DirectLogFetcher();
try { try {
Class.forName("com.mysql.jdbc.Driver"); Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306", Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306", "root", "hello");
"root",
"hello");
Statement statement = connection.createStatement(); Statement statement = connection.createStatement();
statement.execute("SET @master_binlog_checksum='@@global.binlog_checksum'"); statement.execute("SET @master_binlog_checksum='@@global.binlog_checksum'");
statement.execute("SET @mariadb_slave_capability='" + LogEvent.MARIA_SLAVE_CAPABILITY_MINE + "'"); statement.execute("SET @mariadb_slave_capability='" + LogEvent.MARIA_SLAVE_CAPABILITY_MINE + "'");

View File

@@ -8,23 +8,23 @@ public class PositionNotFoundException extends CanalParseException {
private static final long serialVersionUID = -7382448928116244017L; private static final long serialVersionUID = -7382448928116244017L;
public PositionNotFoundException(String errorCode) { public PositionNotFoundException(String errorCode){
super(errorCode); super(errorCode);
} }
public PositionNotFoundException(String errorCode, Throwable cause) { public PositionNotFoundException(String errorCode, Throwable cause){
super(errorCode, cause); super(errorCode, cause);
} }
public PositionNotFoundException(String errorCode, String errorDesc) { public PositionNotFoundException(String errorCode, String errorDesc){
super(errorCode, errorDesc); super(errorCode, errorDesc);
} }
public PositionNotFoundException(String errorCode, String errorDesc, Throwable cause) { public PositionNotFoundException(String errorCode, String errorDesc, Throwable cause){
super(errorCode, errorDesc, cause); super(errorCode, errorDesc, cause);
} }
public PositionNotFoundException(Throwable cause) { public PositionNotFoundException(Throwable cause){
super(cause); super(cause);
} }
} }

View File

@@ -6,27 +6,27 @@ import com.alibaba.otter.canal.common.CanalException;
* @author chengjin.lyf on 2018/8/8 下午1:07 * @author chengjin.lyf on 2018/8/8 下午1:07
* @since 1.0.25 * @since 1.0.25
*/ */
public class ServerIdNotMatchException extends CanalException{ public class ServerIdNotMatchException extends CanalException {
private static final long serialVersionUID = -6124989280379293953L; private static final long serialVersionUID = -6124989280379293953L;
public ServerIdNotMatchException(String errorCode) { public ServerIdNotMatchException(String errorCode){
super(errorCode); super(errorCode);
} }
public ServerIdNotMatchException(String errorCode, Throwable cause) { public ServerIdNotMatchException(String errorCode, Throwable cause){
super(errorCode, cause); super(errorCode, cause);
} }
public ServerIdNotMatchException(String errorCode, String errorDesc) { public ServerIdNotMatchException(String errorCode, String errorDesc){
super(errorCode, errorDesc); super(errorCode, errorDesc);
} }
public ServerIdNotMatchException(String errorCode, String errorDesc, Throwable cause) { public ServerIdNotMatchException(String errorCode, String errorDesc, Throwable cause){
super(errorCode, errorDesc, cause); super(errorCode, errorDesc, cause);
} }
public ServerIdNotMatchException(Throwable cause) { public ServerIdNotMatchException(Throwable cause){
super(cause); super(cause);
} }
} }

View File

@@ -8,8 +8,6 @@ import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet;
import com.alibaba.otter.canal.parse.inbound.mysql.MysqlMultiStageCoprocessor;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang.math.RandomUtils; import org.apache.commons.lang.math.RandomUtils;
@@ -21,11 +19,13 @@ import com.alibaba.otter.canal.common.AbstractCanalLifeCycle;
import com.alibaba.otter.canal.common.alarm.CanalAlarmHandler; import com.alibaba.otter.canal.common.alarm.CanalAlarmHandler;
import com.alibaba.otter.canal.filter.CanalEventFilter; import com.alibaba.otter.canal.filter.CanalEventFilter;
import com.alibaba.otter.canal.parse.CanalEventParser; import com.alibaba.otter.canal.parse.CanalEventParser;
import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet;
import com.alibaba.otter.canal.parse.driver.mysql.packets.MysqlGTIDSet; import com.alibaba.otter.canal.parse.driver.mysql.packets.MysqlGTIDSet;
import com.alibaba.otter.canal.parse.exception.CanalParseException; import com.alibaba.otter.canal.parse.exception.CanalParseException;
import com.alibaba.otter.canal.parse.exception.PositionNotFoundException; import com.alibaba.otter.canal.parse.exception.PositionNotFoundException;
import com.alibaba.otter.canal.parse.exception.TableIdNotFoundException; import com.alibaba.otter.canal.parse.exception.TableIdNotFoundException;
import com.alibaba.otter.canal.parse.inbound.EventTransactionBuffer.TransactionFlushCallback; import com.alibaba.otter.canal.parse.inbound.EventTransactionBuffer.TransactionFlushCallback;
import com.alibaba.otter.canal.parse.inbound.mysql.MysqlMultiStageCoprocessor;
import com.alibaba.otter.canal.parse.index.CanalLogPositionManager; import com.alibaba.otter.canal.parse.index.CanalLogPositionManager;
import com.alibaba.otter.canal.parse.support.AuthenticationInfo; import com.alibaba.otter.canal.parse.support.AuthenticationInfo;
import com.alibaba.otter.canal.protocol.CanalEntry; import com.alibaba.otter.canal.protocol.CanalEntry;

View File

@@ -5,5 +5,6 @@ package com.alibaba.otter.canal.parse.inbound;
* @since 1.0.25 * @since 1.0.25
*/ */
public interface ParserExceptionHandler { public interface ParserExceptionHandler {
void handle(Throwable e); void handle(Throwable e);
} }

View File

@@ -9,7 +9,6 @@ import org.slf4j.LoggerFactory;
import com.alibaba.otter.canal.filter.CanalEventFilter; import com.alibaba.otter.canal.filter.CanalEventFilter;
import com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter; import com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter;
import com.alibaba.otter.canal.parse.CanalEventParser; import com.alibaba.otter.canal.parse.CanalEventParser;
import com.alibaba.otter.canal.parse.driver.mysql.packets.MysqlGTIDSet;
import com.alibaba.otter.canal.parse.exception.CanalParseException; import com.alibaba.otter.canal.parse.exception.CanalParseException;
import com.alibaba.otter.canal.parse.inbound.AbstractEventParser; import com.alibaba.otter.canal.parse.inbound.AbstractEventParser;
import com.alibaba.otter.canal.parse.inbound.BinlogParser; import com.alibaba.otter.canal.parse.inbound.BinlogParser;

View File

@@ -83,8 +83,8 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement
ringBufferSize, ringBufferSize,
new BlockingWaitStrategy()); new BlockingWaitStrategy());
int tc = parserThreadCount > 0 ? parserThreadCount : 1; int tc = parserThreadCount > 0 ? parserThreadCount : 1;
this.parserExecutor = Executors.newFixedThreadPool(tc, this.parserExecutor = Executors.newFixedThreadPool(tc, new NamedThreadFactory("MultiStageCoprocessor-Parser-"
new NamedThreadFactory("MultiStageCoprocessor-Parser-" + destination)); + destination));
this.stageExecutor = Executors.newFixedThreadPool(2, new NamedThreadFactory("MultiStageCoprocessor-other-" this.stageExecutor = Executors.newFixedThreadPool(2, new NamedThreadFactory("MultiStageCoprocessor-other-"
+ destination)); + destination));

View File

@@ -17,7 +17,6 @@ import org.slf4j.LoggerFactory;
import com.alibaba.otter.canal.common.AbstractCanalLifeCycle; import com.alibaba.otter.canal.common.AbstractCanalLifeCycle;
import com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter; import com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter;
import com.alibaba.otter.canal.parse.driver.mysql.packets.GTIDSet;
import com.alibaba.otter.canal.parse.exception.CanalParseException; import com.alibaba.otter.canal.parse.exception.CanalParseException;
import com.alibaba.otter.canal.parse.exception.TableIdNotFoundException; import com.alibaba.otter.canal.parse.exception.TableIdNotFoundException;
import com.alibaba.otter.canal.parse.inbound.BinlogParser; import com.alibaba.otter.canal.parse.inbound.BinlogParser;

View File

@@ -226,7 +226,7 @@ public class SimpleDdlParserTest {
Assert.assertEquals("retl", result.getSchemaName()); Assert.assertEquals("retl", result.getSchemaName());
Assert.assertEquals("retl_mark", result.getTableName()); Assert.assertEquals("retl_mark", result.getTableName());
//test index name contains 'on' -- version // test index name contains 'on' -- version
queryString = "create index schema_new_index_version_s_idx on q_contract_account (contract_id,main_contract_id)"; queryString = "create index schema_new_index_version_s_idx on q_contract_account (contract_id,main_contract_id)";
result = SimpleDdlParser.parse(queryString, "retl"); result = SimpleDdlParser.parse(queryString, "retl");
Assert.assertNotNull(result); Assert.assertNotNull(result);