From 363fde376cb3bc98c87db932697afacc017acd81 Mon Sep 17 00:00:00 2001 From: wenyh1 <2365151147@qq.com> Date: Tue, 31 Oct 2023 18:03:06 +0800 Subject: [PATCH] [inner-2371] fix: sql execution hang problem caused by the inability to respond to the front side due to unprocessed packets. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit dcff228b4c13bf0fd9f7bb0d52f9c18aaba36b59、07c0c1f1c986a71fb74d0fcc0379965592c63b49) --- .../java/com/actiontech/dble/services/BackendService.java | 8 ++++---- .../dble/services/mysqlsharding/MySQLResponseService.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/actiontech/dble/services/BackendService.java b/src/main/java/com/actiontech/dble/services/BackendService.java index 64559481fd..79c80ac850 100644 --- a/src/main/java/com/actiontech/dble/services/BackendService.java +++ b/src/main/java/com/actiontech/dble/services/BackendService.java @@ -102,8 +102,8 @@ protected void doHandle(ServiceTask task) { handleDataError(e); } finally { isHandling.set(false); - if (taskQueue.size() > 0) { - doHandle(null); + if (!taskQueue.isEmpty()) { + doHandle(taskQueue.peek()); } } }); @@ -125,7 +125,7 @@ public void execute(ServiceTask task) { handleDataError(e); } finally { isHandling.set(false); - if (taskQueue.size() > 0) { + if (!taskQueue.isEmpty()) { doHandle(task); } } @@ -215,7 +215,7 @@ protected void handleInnerData(byte[] data) { protected void handleDataError(Exception e) { LOGGER.warn(this.toString() + " handle data error:", e); connection.close("handle data error:" + e.getMessage()); - while (taskQueue.size() > 0) { + while (!taskQueue.isEmpty()) { clearTaskQueue(); // clear all data from the client LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(1000)); diff --git a/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLResponseService.java b/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLResponseService.java index 5d7e460fe6..1f7a4f700f 100644 --- a/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLResponseService.java +++ b/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLResponseService.java @@ -491,7 +491,7 @@ protected boolean beforeHandlingTask() { @Override protected Executor getExecutor() { Executor executor; - if (complexQuery) { + if (complexQuery || SystemConfig.getInstance().getUsePerformanceMode() == 1) { executor = DbleServer.getInstance().getComplexQueryExecutor(); } else { executor = DbleServer.getInstance().getBackendBusinessExecutor();