This commit is contained in:
agapple
2016-12-30 14:32:52 +08:00
parent 5055fdb556
commit a1207060bf
4 changed files with 12 additions and 15 deletions

View File

@@ -8,7 +8,7 @@ if "%OS%" == "Windows_NT" set ENV_PATH=%~dp0%
set conf_dir=%ENV_PATH%\..\conf
set logback_configurationFile=%conf_dir%\logback.xml
set client_mode=Simple
if "%1" NEQ "" set client_mode=%1
if "%1%" != "" set client_mode=%1%
set CLASSPATH=%conf_dir%
set CLASSPATH=%conf_dir%\..\lib\*;%CLASSPATH%
@@ -20,8 +20,7 @@ set CANAL_OPTS= -DappName=otter-canal-example -Dlogback.configurationFile="%logb
set JAVA_OPTS= %JAVA_MEM_OPTS% %JAVA_OPTS_EXT% %JAVA_DEBUG_OPT% %CANAL_OPTS%
if "%client_mode%" == "Cluster" (
if "%client_mode%" == "Cluster"
java %JAVA_OPTS% -classpath "%CLASSPATH%" com.alibaba.otter.canal.example.ClusterCanalClientTest
) else (
else
java %JAVA_OPTS% -classpath "%CLASSPATH%" com.alibaba.otter.canal.example.SimpleCanalClientTest
)

View File

@@ -22,7 +22,6 @@ import com.alibaba.otter.canal.parse.CanalEventParser;
import com.alibaba.otter.canal.parse.exception.CanalParseException;
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.MysqlEventParser;
import com.alibaba.otter.canal.parse.index.CanalLogPositionManager;
import com.alibaba.otter.canal.parse.support.AuthenticationInfo;
import com.alibaba.otter.canal.protocol.CanalEntry;
@@ -387,10 +386,11 @@ public abstract class AbstractEventParser<EVENT> extends AbstractCanalLifeCycle
String name = String.format("destination = %s , address = %s , HeartBeatTimeTask",
destination,
runningInfo == null ? null : runningInfo.getAddress().toString());
synchronized(AbstractEventParser.class){
// synchronized (MysqlEventParser.class) {
// why use MysqlEventParser.class, u know, MysqlEventParser is the child class 4 AbstractEventParser,
// do this is ...
synchronized (AbstractEventParser.class) {
// synchronized (MysqlEventParser.class) {
// why use MysqlEventParser.class, u know, MysqlEventParser is
// the child class 4 AbstractEventParser,
// do this is ...
if (timer == null) {
timer = new Timer(name, true);
}

View File

@@ -279,9 +279,8 @@ public class MysqlConnection implements ErosaConnection {
}
List<String> columnValues = rs.getFieldValues();
if (columnValues.size() > 0 && columnValues.get(0) != null
&& columnValues.get(0).toUpperCase().equals("CRC32")) {
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_CRC32;
if(columnValues.get(0).toUpperCase().equals("CRC32")){
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_CRC32;
}else{
binlogChecksum = LogEvent.BINLOG_CHECKSUM_ALG_OFF;
}

View File

@@ -182,9 +182,7 @@ public class MysqlEventParser extends AbstractMysqlEventParser implements CanalE
protected void stopHeartBeat() {
TimerTask heartBeatTimerTask = this.heartBeatTimerTask;
super.stopHeartBeat();
if (heartBeatTimerTask != null) {
MysqlConnection mysqlConnection = ((MysqlDetectingTimeTask) heartBeatTimerTask).getMysqlConnection();
try {
mysqlConnection.disconnect();
@@ -414,7 +412,8 @@ public class MysqlEventParser extends AbstractMysqlEventParser implements CanalE
}
}
// 其余情况
logger.warn("prepare to find start position just last position\n {}",JsonUtils.marshalToString(logPosition));
logger.warn("prepare to find start position just last position\n {}",
JsonUtils.marshalToString(logPosition));
return logPosition.getPostion();
} else {
// 针对切换的情况,考虑回退时间