mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
fixed format
This commit is contained in:
@@ -4,9 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
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.GtidLogEvent;
|
||||
import com.taobao.tddl.dbsync.binlog.event.TableMapLogEvent;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,11 +3,10 @@ package com.taobao.tddl.dbsync.binlog;
|
||||
import java.io.IOException;
|
||||
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.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.BeginLoadQueryLogEvent;
|
||||
import com.taobao.tddl.dbsync.binlog.event.CreateFileLogEvent;
|
||||
@@ -52,12 +51,12 @@ import com.taobao.tddl.dbsync.binlog.event.mariadb.StartEncryptionLogEvent;
|
||||
* <pre>
|
||||
* LogDecoder decoder = new LogDecoder();
|
||||
* decoder.handle(...);
|
||||
*
|
||||
*
|
||||
* LogEvent event;
|
||||
* do
|
||||
* {
|
||||
* event = decoder.decode(buffer, context);
|
||||
*
|
||||
*
|
||||
* // process log event.
|
||||
* }
|
||||
* while (event != null);
|
||||
|
||||
@@ -14,10 +14,10 @@ import com.taobao.tddl.dbsync.binlog.LogEvent;
|
||||
public class GtidLogEvent extends LogEvent {
|
||||
|
||||
// / Length of the commit_flag in event encoding
|
||||
public static final int ENCODED_FLAG_LENGTH = 1;
|
||||
public static final int ENCODED_FLAG_LENGTH = 1;
|
||||
// / Length of SID in event encoding
|
||||
public static final int ENCODED_SID_LENGTH = 16;
|
||||
public static final int LOGICAL_TIMESTAMP_TYPE_CODE = 2;
|
||||
public static final int ENCODED_SID_LENGTH = 16;
|
||||
public static final int LOGICAL_TIMESTAMP_TYPE_CODE = 2;
|
||||
|
||||
private boolean commitFlag;
|
||||
private UUID sid;
|
||||
@@ -50,8 +50,6 @@ public class GtidLogEvent extends LogEvent {
|
||||
sequenceNumber = buffer.getLong64();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ignore gtid info read
|
||||
// sid.copy_from((uchar *)ptr_buffer);
|
||||
// ptr_buffer+= ENCODED_SID_LENGTH;
|
||||
|
||||
@@ -15,9 +15,7 @@ public class FetcherPerformanceTest {
|
||||
DirectLogFetcher fetcher = new DirectLogFetcher();
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306",
|
||||
"root",
|
||||
"hello");
|
||||
Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306", "root", "hello");
|
||||
Statement statement = connection.createStatement();
|
||||
statement.execute("SET @master_binlog_checksum='@@global.binlog_checksum'");
|
||||
statement.execute("SET @mariadb_slave_capability='" + LogEvent.MARIA_SLAVE_CAPABILITY_MINE + "'");
|
||||
|
||||
@@ -8,23 +8,23 @@ public class PositionNotFoundException extends CanalParseException {
|
||||
|
||||
private static final long serialVersionUID = -7382448928116244017L;
|
||||
|
||||
public PositionNotFoundException(String errorCode) {
|
||||
public PositionNotFoundException(String errorCode){
|
||||
super(errorCode);
|
||||
}
|
||||
|
||||
public PositionNotFoundException(String errorCode, Throwable cause) {
|
||||
public PositionNotFoundException(String errorCode, Throwable cause){
|
||||
super(errorCode, cause);
|
||||
}
|
||||
|
||||
public PositionNotFoundException(String errorCode, String errorDesc) {
|
||||
public PositionNotFoundException(String errorCode, String errorDesc){
|
||||
super(errorCode, errorDesc);
|
||||
}
|
||||
|
||||
public PositionNotFoundException(String errorCode, String errorDesc, Throwable cause) {
|
||||
public PositionNotFoundException(String errorCode, String errorDesc, Throwable cause){
|
||||
super(errorCode, errorDesc, cause);
|
||||
}
|
||||
|
||||
public PositionNotFoundException(Throwable cause) {
|
||||
public PositionNotFoundException(Throwable cause){
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,27 +6,27 @@ import com.alibaba.otter.canal.common.CanalException;
|
||||
* @author chengjin.lyf on 2018/8/8 下午1:07
|
||||
* @since 1.0.25
|
||||
*/
|
||||
public class ServerIdNotMatchException extends CanalException{
|
||||
public class ServerIdNotMatchException extends CanalException {
|
||||
|
||||
private static final long serialVersionUID = -6124989280379293953L;
|
||||
|
||||
public ServerIdNotMatchException(String errorCode) {
|
||||
public ServerIdNotMatchException(String errorCode){
|
||||
super(errorCode);
|
||||
}
|
||||
|
||||
public ServerIdNotMatchException(String errorCode, Throwable cause) {
|
||||
public ServerIdNotMatchException(String errorCode, Throwable cause){
|
||||
super(errorCode, cause);
|
||||
}
|
||||
|
||||
public ServerIdNotMatchException(String errorCode, String errorDesc) {
|
||||
public ServerIdNotMatchException(String errorCode, String errorDesc){
|
||||
super(errorCode, errorDesc);
|
||||
}
|
||||
|
||||
public ServerIdNotMatchException(String errorCode, String errorDesc, Throwable cause) {
|
||||
public ServerIdNotMatchException(String errorCode, String errorDesc, Throwable cause){
|
||||
super(errorCode, errorDesc, cause);
|
||||
}
|
||||
|
||||
public ServerIdNotMatchException(Throwable cause) {
|
||||
public ServerIdNotMatchException(Throwable cause){
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
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.exception.ExceptionUtils;
|
||||
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.filter.CanalEventFilter;
|
||||
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.exception.CanalParseException;
|
||||
import com.alibaba.otter.canal.parse.exception.PositionNotFoundException;
|
||||
import com.alibaba.otter.canal.parse.exception.TableIdNotFoundException;
|
||||
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.support.AuthenticationInfo;
|
||||
import com.alibaba.otter.canal.protocol.CanalEntry;
|
||||
|
||||
@@ -5,5 +5,6 @@ package com.alibaba.otter.canal.parse.inbound;
|
||||
* @since 1.0.25
|
||||
*/
|
||||
public interface ParserExceptionHandler {
|
||||
|
||||
void handle(Throwable e);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.slf4j.LoggerFactory;
|
||||
import com.alibaba.otter.canal.filter.CanalEventFilter;
|
||||
import com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter;
|
||||
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.inbound.AbstractEventParser;
|
||||
import com.alibaba.otter.canal.parse.inbound.BinlogParser;
|
||||
|
||||
@@ -83,8 +83,8 @@ public class MysqlMultiStageCoprocessor extends AbstractCanalLifeCycle implement
|
||||
ringBufferSize,
|
||||
new BlockingWaitStrategy());
|
||||
int tc = parserThreadCount > 0 ? parserThreadCount : 1;
|
||||
this.parserExecutor = Executors.newFixedThreadPool(tc,
|
||||
new NamedThreadFactory("MultiStageCoprocessor-Parser-" + destination));
|
||||
this.parserExecutor = Executors.newFixedThreadPool(tc, new NamedThreadFactory("MultiStageCoprocessor-Parser-"
|
||||
+ destination));
|
||||
|
||||
this.stageExecutor = Executors.newFixedThreadPool(2, new NamedThreadFactory("MultiStageCoprocessor-other-"
|
||||
+ destination));
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.alibaba.otter.canal.common.AbstractCanalLifeCycle;
|
||||
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.TableIdNotFoundException;
|
||||
import com.alibaba.otter.canal.parse.inbound.BinlogParser;
|
||||
|
||||
@@ -226,7 +226,7 @@ public class SimpleDdlParserTest {
|
||||
Assert.assertEquals("retl", result.getSchemaName());
|
||||
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)";
|
||||
result = SimpleDdlParser.parse(queryString, "retl");
|
||||
Assert.assertNotNull(result);
|
||||
|
||||
Reference in New Issue
Block a user