File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed
parse/src/main/java/com/alibaba/otter/canal/parse Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1+ package com .alibaba .otter .canal .parse .exception ;import com .alibaba .otter .canal .common .CanalException ;public class ServerLogPurgedException extends CanalException { public ServerLogPurgedException (String errorCode ){ super ("ServerLogPurged by " + errorCode ); } }
Original file line number Diff line number Diff line change 55import java .net .SocketTimeoutException ;
66import java .nio .channels .ClosedByInterruptException ;
77
8+ import org .apache .commons .lang .StringUtils ;
89import org .slf4j .Logger ;
910import org .slf4j .LoggerFactory ;
1011
1112import com .alibaba .otter .canal .parse .driver .mysql .socket .SocketChannel ;
13+ import com .alibaba .otter .canal .parse .exception .ServerLogPurgedException ;
1214import com .taobao .tddl .dbsync .binlog .LogFetcher ;
1315
1416/**
@@ -99,6 +101,13 @@ public boolean fetch() throws IOException {
99101 final int errno = getInt16 ();
100102 String sqlstate = forward (1 ).getFixString (SQLSTATE_LENGTH );
101103 String errmsg = getFixString (limit - position );
104+ if (StringUtils .containsIgnoreCase (errmsg , "not find first log file name" )
105+ || StringUtils .containsIgnoreCase (errmsg , "purged binary logs" )) {
106+ // 开始 dump 后,server 位点过期,DUMP 和 DUMP_GTID 两种错误信息
107+ throw new ServerLogPurgedException (
108+ " errno = " + errno + ", sqlstate = " + sqlstate + " errmsg = " + errmsg );
109+ }
110+
102111 throw new IOException ("Received error packet:" + " errno = " + errno + ", sqlstate = " + sqlstate
103112 + " errmsg = " + errmsg );
104113 } else if (mark == 254 ) {
Original file line number Diff line number Diff line change 66import org .apache .commons .lang .StringUtils ;
77
88import com .alibaba .otter .canal .parse .exception .PositionNotFoundException ;
9+ import com .alibaba .otter .canal .parse .exception .ServerLogPurgedException ;
910import com .alibaba .otter .canal .parse .inbound .ParserExceptionHandler ;
1011import com .alibaba .otter .canal .parse .inbound .mysql .MysqlEventParser ;
1112
@@ -92,7 +93,7 @@ public void start() {
9293 }
9394
9495 private void handleMysqlParserException (Throwable throwable ) {
95- if (throwable instanceof PositionNotFoundException ) {
96+ if (throwable instanceof PositionNotFoundException || throwable instanceof ServerLogPurgedException ) {
9697 logger .info ("remove rds not found position, try download rds binlog!" );
9798 executorService .execute (() -> {
9899 try {
You can’t perform that action at this time.
0 commit comments