From ca67bc2d2b133086644f01e7161c7aa9949c7f00 Mon Sep 17 00:00:00 2001 From: yanhuqing Date: Sun, 28 Apr 2019 10:30:42 +0800 Subject: [PATCH] reachedConCount thread safe #1139 --- .../nio/handler/query/impl/MultiNodeEasyMergeHandler.java | 3 ++- .../mysql/nio/handler/query/impl/MultiNodeMergeHandler.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/actiontech/dble/backend/mysql/nio/handler/query/impl/MultiNodeEasyMergeHandler.java b/src/main/java/com/actiontech/dble/backend/mysql/nio/handler/query/impl/MultiNodeEasyMergeHandler.java index ef8645c17e..7fcce41589 100644 --- a/src/main/java/com/actiontech/dble/backend/mysql/nio/handler/query/impl/MultiNodeEasyMergeHandler.java +++ b/src/main/java/com/actiontech/dble/backend/mysql/nio/handler/query/impl/MultiNodeEasyMergeHandler.java @@ -23,6 +23,7 @@ */ public class MultiNodeEasyMergeHandler extends MultiNodeMergeHandler { private static final Logger LOGGER = LoggerFactory.getLogger(MultiNodeEasyMergeHandler.class); + private int rowEndConCount = 0; public MultiNodeEasyMergeHandler(long id, RouteResultsetNode[] route, boolean autocommit, NonBlockingSession session) { super(id, route, autocommit, session); @@ -88,7 +89,7 @@ public void rowEofResponse(byte[] data, boolean isLeft, BackendConnection conn) return; lock.lock(); try { - if (reachedConCount == route.length) { + if (++rowEndConCount == route.length) { session.setHandlerEnd(this); nextHandler.rowEofResponse(null, this.isLeft, conn); } diff --git a/src/main/java/com/actiontech/dble/backend/mysql/nio/handler/query/impl/MultiNodeMergeHandler.java b/src/main/java/com/actiontech/dble/backend/mysql/nio/handler/query/impl/MultiNodeMergeHandler.java index a3a7ca573d..adfd70df44 100644 --- a/src/main/java/com/actiontech/dble/backend/mysql/nio/handler/query/impl/MultiNodeMergeHandler.java +++ b/src/main/java/com/actiontech/dble/backend/mysql/nio/handler/query/impl/MultiNodeMergeHandler.java @@ -26,7 +26,7 @@ public abstract class MultiNodeMergeHandler extends OwnThreadDMLHandler { protected final ReentrantLock lock; final List exeHandlers; protected RouteResultsetNode[] route; - int reachedConCount; + int reachedConCount = 0; public MultiNodeMergeHandler(long id, RouteResultsetNode[] route, boolean autocommit, NonBlockingSession session) { super(id, session);