mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
merge code and fixed issue #2755 #2756 #2735 #2714 #2711 #2710 #2616 #2602 #2585 #2565 #2935 #2434 #2623 #2418 #2387
This commit is contained in:
@@ -45,6 +45,7 @@ import com.taobao.tddl.dbsync.binlog.event.UpdateRowsLogEvent;
|
||||
import com.taobao.tddl.dbsync.binlog.event.WriteRowsLogEvent;
|
||||
import com.taobao.tddl.dbsync.binlog.event.XidLogEvent;
|
||||
import com.taobao.tddl.dbsync.binlog.event.mariadb.AnnotateRowsEvent;
|
||||
|
||||
@Ignore
|
||||
public class DirectLogFetcherTest {
|
||||
|
||||
@@ -85,6 +86,9 @@ public class DirectLogFetcherTest {
|
||||
// event).getFilename();
|
||||
System.out.println(((RotateLogEvent) event).getFilename());
|
||||
break;
|
||||
case LogEvent.TABLE_MAP_EVENT:
|
||||
parseTableMapEvent((TableMapLogEvent) event);
|
||||
break;
|
||||
case LogEvent.WRITE_ROWS_EVENT_V1:
|
||||
case LogEvent.WRITE_ROWS_EVENT:
|
||||
parseRowsEvent((WriteRowsLogEvent) event);
|
||||
@@ -173,13 +177,13 @@ public class DirectLogFetcherTest {
|
||||
logger.warn("update wait_timeout failed", e);
|
||||
}
|
||||
try {
|
||||
update("set net_write_timeout=1800", connector);
|
||||
update("set net_write_timeout=7200", connector);
|
||||
} catch (Exception e) {
|
||||
logger.warn("update net_write_timeout failed", e);
|
||||
}
|
||||
|
||||
try {
|
||||
update("set net_read_timeout=1800", connector);
|
||||
update("set net_read_timeout=7200", connector);
|
||||
} catch (Exception e) {
|
||||
logger.warn("update net_read_timeout failed", e);
|
||||
}
|
||||
@@ -272,6 +276,18 @@ public class DirectLogFetcherTest {
|
||||
System.out.println("sql : " + new String(event.getRowsQuery().getBytes("ISO-8859-1"), charset.name()));
|
||||
}
|
||||
|
||||
public void parseTableMapEvent(TableMapLogEvent event) {
|
||||
try {
|
||||
String charsetDbName = new String(event.getDbName().getBytes("ISO-8859-1"), charset.name());
|
||||
event.setDbname(charsetDbName);
|
||||
|
||||
String charsetTbName = new String(event.getTableName().getBytes("ISO-8859-1"), charset.name());
|
||||
event.setTblname(charsetTbName);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new CanalParseException(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void parseXidEvent(XidLogEvent event) throws Exception {
|
||||
System.out.println(String.format("================> binlog[%s:%s]", binlogFileName, event.getHeader()
|
||||
.getLogPos() - event.getHeader().getEventLen()));
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.alibaba.otter.canal.parse;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.junit.Ignore;
|
||||
|
||||
import com.alibaba.otter.canal.common.AbstractCanalLifeCycle;
|
||||
import com.alibaba.otter.canal.parse.exception.CanalParseException;
|
||||
import com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser;
|
||||
@@ -15,7 +16,6 @@ import com.alibaba.otter.canal.protocol.position.EntryPosition;
|
||||
import com.alibaba.otter.canal.protocol.position.LogPosition;
|
||||
import com.alibaba.otter.canal.sink.CanalEventSink;
|
||||
import com.alibaba.otter.canal.sink.exception.CanalSinkException;
|
||||
import org.junit.Ignore;
|
||||
|
||||
@Ignore
|
||||
public class MysqlBinlogDumpPerformanceTest {
|
||||
@@ -23,7 +23,7 @@ public class MysqlBinlogDumpPerformanceTest {
|
||||
public static void main(String args[]) {
|
||||
final MysqlEventParser controller = new MysqlEventParser();
|
||||
final EntryPosition startPosition = new EntryPosition("mysql-bin.000007", 89796293L, 100L);
|
||||
controller.setConnectionCharset(Charset.forName("UTF-8"));
|
||||
controller.setConnectionCharset("UTF-8");
|
||||
controller.setSlaveId(3344L);
|
||||
controller.setDetectingEnable(false);
|
||||
controller.setFilterQueryDml(true);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class LocalBinlogDumpTest {
|
||||
final EntryPosition startPosition = new EntryPosition("mysql-bin.000003", 123L);
|
||||
|
||||
controller.setMasterInfo(new AuthenticationInfo(new InetSocketAddress("127.0.0.1", 3306), "canal", "canal"));
|
||||
controller.setConnectionCharset(Charset.forName("UTF-8"));
|
||||
controller.setConnectionCharsetStd(Charset.forName("UTF-8"));
|
||||
controller.setDirectory(directory);
|
||||
controller.setMasterPosition(startPosition);
|
||||
controller.setEventSink(new AbstractCanalEventSinkTest<List<Entry>>() {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class MysqlDumpTest {
|
||||
final MysqlEventParser controller = new MysqlEventParser();
|
||||
final EntryPosition startPosition = new EntryPosition("mysql-bin.000001", 4L);
|
||||
// startPosition.setGtid("f1ceb61a-a5d5-11e7-bdee-107c3dbcf8a7:1-17");
|
||||
controller.setConnectionCharset(Charset.forName("UTF-8"));
|
||||
controller.setConnectionCharsetStd(Charset.forName("UTF-8"));
|
||||
controller.setSlaveId(3344L);
|
||||
controller.setDetectingEnable(false);
|
||||
controller.setMasterInfo(new AuthenticationInfo(new InetSocketAddress("127.0.0.1", 3306), "root", "hello"));
|
||||
|
||||
@@ -34,7 +34,7 @@ public class RdsLocalBinlogDumpTest {
|
||||
String directory = "/tmp/rds";
|
||||
final RdsLocalBinlogEventParser controller = new RdsLocalBinlogEventParser();
|
||||
controller.setMasterInfo(new AuthenticationInfo(new InetSocketAddress("127.0.0.1", 3306), "root", "hello"));
|
||||
controller.setConnectionCharset(Charset.forName("UTF-8"));
|
||||
controller.setConnectionCharsetStd(Charset.forName("UTF-8"));
|
||||
controller.setDirectory(directory);
|
||||
controller.setAccesskey("");
|
||||
controller.setSecretkey("");
|
||||
|
||||
Reference in New Issue
Block a user