File tree 1 file changed +5
-1
lines changed
server/src/main/java/com/alibaba/otter/canal/server
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 15
15
import org .slf4j .MDC ;
16
16
17
17
import java .util .Map ;
18
+ import java .util .Objects ;
18
19
import java .util .concurrent .ConcurrentHashMap ;
19
20
import java .util .concurrent .ExecutorService ;
20
21
import java .util .concurrent .Executors ;
@@ -106,7 +107,10 @@ public synchronized void destroy() {
106
107
107
108
public synchronized void startDestination (String destination ) {
108
109
CanalInstance canalInstance = canalServer .getCanalInstances ().get (destination );
109
- if (canalInstance != null ) {
110
+ CanalMQRunnable canalMQRunable = canalMQWorks .get (destination );
111
+ //当zk出现session time out可能会导致instance出现多个消费者,从而出现乱序
112
+ //因此当抢占成功的实例已经启动CanalMQRunnable时就不需要stop然后start了
113
+ if (canalInstance != null && Objects .isNull (canalMQRunable )) {
110
114
stopDestination (destination );
111
115
CanalMQRunnable canalMQRunnable = new CanalMQRunnable (destination );
112
116
canalMQWorks .put (canalInstance .getDestination (), canalMQRunnable );
You can’t perform that action at this time.
0 commit comments