From b491fbc111d65d5090f26500f3d90f3aa8fe9181 Mon Sep 17 00:00:00 2001 From: "Roger.Chen" Date: Tue, 27 Oct 2020 16:29:11 +0800 Subject: [PATCH 1/3] =?UTF-8?q?BI-74885=20fix:=20clickhouse=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=87=BA=E9=94=99=E6=97=B6=E4=B8=80?= =?UTF-8?q?=E7=9B=B4=E5=B0=9D=E8=AF=95=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/third/alibaba/druid/pool/DruidDataSource.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java b/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java index 13c9ecdd6..873ad3818 100644 --- a/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java +++ b/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java @@ -2193,10 +2193,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat DruidDataSource.this.doSomethingBeforeCreationThreadBreak(); break; } - } catch (RuntimeException e) { - LOG.error("create connection error", e); - setFailContinuous(true); - continue; } catch (Error e) { LOG.error("create connection error", e); setFailContinuous(true); From 013ec71c298296e9d6a312068d897424780cd835 Mon Sep 17 00:00:00 2001 From: "Roger.Chen" Date: Tue, 27 Oct 2020 16:50:34 +0800 Subject: [PATCH 2/3] =?UTF-8?q?BI-74885=20fix:=20clickhouse=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=87=BA=E9=94=99=E6=97=B6=E4=B8=80?= =?UTF-8?q?=E7=9B=B4=E5=B0=9D=E8=AF=95=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/third/alibaba/druid/pool/DruidDataSource.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java b/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java index 873ad3818..31e47f25d 100644 --- a/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java +++ b/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java @@ -2193,6 +2193,11 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat DruidDataSource.this.doSomethingBeforeCreationThreadBreak(); break; } + } catch (Exception e) { + LOG.error("create connection error", e); + setFailContinuous(true); + DruidDataSource.this.doSomethingBeforeCreationThreadBreak(); + break; } catch (Error e) { LOG.error("create connection error", e); setFailContinuous(true); From 24d0d82701eb183460fd48092b1c504471dcfb97 Mon Sep 17 00:00:00 2001 From: "Roger.Chen" Date: Wed, 28 Oct 2020 09:33:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?BI-74885=20fix:=20clickhouse=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E5=87=BA=E9=94=99=E6=97=B6=E4=B8=80?= =?UTF-8?q?=E7=9B=B4=E5=B0=9D=E8=AF=95=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alibaba/druid/pool/DruidDataSource.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java b/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java index 31e47f25d..4cba25d96 100644 --- a/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java +++ b/fine-druid/src/main/java/com/fr/third/alibaba/druid/pool/DruidDataSource.java @@ -2164,10 +2164,13 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat try { connection = createPhysicalConnection(); setFailContinuous(false); - } catch (SQLException e) { - LOG.error("create connection error, url: " + jdbcUrl + ", errorCode " + e.getErrorCode() - + ", state " + e.getSQLState(), e); - + } catch (SQLException | RuntimeException e) { + if (e instanceof SQLException) { + LOG.error("create connection error, url: " + jdbcUrl + ", errorCode " + ((SQLException)e).getErrorCode() + + ", state " + ((SQLException)e).getSQLState(), e); + } else { + LOG.error("create connection error", e); + } errorCount++; if (errorCount > connectionErrorRetryAttempts && timeBetweenConnectErrorMillis > 0) { // fail over retry attempts @@ -2193,11 +2196,6 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat DruidDataSource.this.doSomethingBeforeCreationThreadBreak(); break; } - } catch (Exception e) { - LOG.error("create connection error", e); - setFailContinuous(true); - DruidDataSource.this.doSomethingBeforeCreationThreadBreak(); - break; } catch (Error e) { LOG.error("create connection error", e); setFailContinuous(true);