From 32224cd7384acdcf7708cb5fa5ba3671f436a4eb Mon Sep 17 00:00:00 2001 From: Collapsar <838800176@qq.com> Date: Wed, 11 Nov 2020 14:00:28 +0800 Subject: [PATCH] fix bug that dble can't start in performance mode (#2268) * fix hang in performance mode * fix currentResponseService --- .../MySQLBackAuthService.java | 37 ++++++++++++------- .../MySQLCurrentResponseService.java | 8 +++- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/actiontech/dble/services/mysqlauthenticate/MySQLBackAuthService.java b/src/main/java/com/actiontech/dble/services/mysqlauthenticate/MySQLBackAuthService.java index bf2464635..ff1fa7408 100644 --- a/src/main/java/com/actiontech/dble/services/mysqlauthenticate/MySQLBackAuthService.java +++ b/src/main/java/com/actiontech/dble/services/mysqlauthenticate/MySQLBackAuthService.java @@ -238,20 +238,29 @@ public class MySQLBackAuthService extends AuthService { @Override public void taskToTotalQueue(ServiceTask task) { - Executor executor = DbleServer.getInstance().getBackendBusinessExecutor(); - if (isHandling.compareAndSet(false, true)) { - executor.execute(() -> { - try { - handleInnerData(); - } catch (Exception e) { - handleDataError(e); - } finally { - isHandling.set(false); - if (taskQueue.size() > 0) { - taskToTotalQueue(null); - } - } - }); + if (SystemConfig.getInstance().getUsePerformanceMode() == 1) { + if (isHandling.compareAndSet(false, true)) { + DbleServer.getInstance().getConcurrentBackHandlerQueue().offer(task); + } + } else { + Executor executor = DbleServer.getInstance().getBackendBusinessExecutor(); + if (isHandling.compareAndSet(false, true)) { + executor.execute(this::consumerInternalData); + } + } + } + + @Override + public void consumerInternalData() { + try { + handleInnerData(); + } catch (Exception e) { + handleDataError(e); + } finally { + isHandling.set(false); + if (taskQueue.size() > 0) { + taskToTotalQueue(null); + } } } diff --git a/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLCurrentResponseService.java b/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLCurrentResponseService.java index 2f779b72b..2bf7272e7 100644 --- a/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLCurrentResponseService.java +++ b/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLCurrentResponseService.java @@ -25,13 +25,17 @@ public class MySQLCurrentResponseService extends MySQLResponseService { } } - @Override public void consumerInternalData() { try { - super.handleInnerData(); + handleInnerData(); + } catch (Exception e) { + handleDataError(e); } finally { isHandling.set(false); + if (taskQueue.size() > 0) { + taskToTotalQueue(null); + } } } }