You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/06/20 06:23:54 UTC
[doris] branch master updated: [improvement](jdbc) Set the JDBC connection timeout to be conf (#21000)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 53b2fe5db6 [improvement](jdbc) Set the JDBC connection timeout to be conf (#21000)
53b2fe5db6 is described below
commit 53b2fe5db669a860dfb529d6e556c6f2ba35daa0
Author: zy-kkk <zh...@gmail.com>
AuthorDate: Tue Jun 20 14:23:48 2023 +0800
[improvement](jdbc) Set the JDBC connection timeout to be conf (#21000)
---
bin/start_be.sh | 2 +-
conf/be.conf | 4 ++--
.../src/main/java/org/apache/doris/jdbc/JdbcExecutor.java | 5 ++++-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/bin/start_be.sh b/bin/start_be.sh
index 8c54818a5f..bf80f7928b 100755
--- a/bin/start_be.sh
+++ b/bin/start_be.sh
@@ -264,7 +264,7 @@ java_version="$(
CUR_DATE=$(date +%Y%m%d-%H%M%S)
LOG_PATH="-DlogPath=${DORIS_HOME}/log/jni.log"
COMMON_OPTS="-Dsun.java.command=DorisBE -XX:-CriticalJNINatives"
-JDBC_OPTS="-DJDBC_MIN_POOL=1 -DJDBC_MAX_POOL=100 -DJDBC_MAX_IDEL_TIME=300000"
+JDBC_OPTS="-DJDBC_MIN_POOL=1 -DJDBC_MAX_POOL=100 -DJDBC_MAX_IDEL_TIME=300000 -DJDBC_MAX_WAIT_TIME=5000"
if [[ "${java_version}" -gt 8 ]]; then
if [[ -z ${JAVA_OPTS_FOR_JDK_9} ]]; then
diff --git a/conf/be.conf b/conf/be.conf
index 455779b2df..e79efd55da 100644
--- a/conf/be.conf
+++ b/conf/be.conf
@@ -19,10 +19,10 @@ CUR_DATE=`date +%Y%m%d-%H%M%S`
PPROF_TMPDIR="$DORIS_HOME/log/"
-JAVA_OPTS="-Xmx1024m -DlogPath=$DORIS_HOME/log/jni.log -Xloggc:$DORIS_HOME/log/be.gc.log.$CUR_DATE -Dsun.java.command=DorisBE -XX:-CriticalJNINatives -DJDBC_MIN_POOL=1 -DJDBC_MAX_POOL=100 -DJDBC_MAX_IDEL_TIME=300000"
+JAVA_OPTS="-Xmx1024m -DlogPath=$DORIS_HOME/log/jni.log -Xloggc:$DORIS_HOME/log/be.gc.log.$CUR_DATE -Dsun.java.command=DorisBE -XX:-CriticalJNINatives -DJDBC_MIN_POOL=1 -DJDBC_MAX_POOL=100 -DJDBC_MAX_IDEL_TIME=300000 -DJDBC_MAX_WAIT_TIME=5000"
# For jdk 9+, this JAVA_OPTS will be used as default JVM options
-JAVA_OPTS_FOR_JDK_9="-Xmx1024m -DlogPath=$DORIS_HOME/log/jni.log -Xlog:gc:$DORIS_HOME/log/be.gc.log.$CUR_DATE -Dsun.java.command=DorisBE -XX:-CriticalJNINatives -DJDBC_MIN_POOL=1 -DJDBC_MAX_POOL=100 -DJDBC_MAX_IDEL_TIME=300000"
+JAVA_OPTS_FOR_JDK_9="-Xmx1024m -DlogPath=$DORIS_HOME/log/jni.log -Xlog:gc:$DORIS_HOME/log/be.gc.log.$CUR_DATE -Dsun.java.command=DorisBE -XX:-CriticalJNINatives -DJDBC_MIN_POOL=1 -DJDBC_MAX_POOL=100 -DJDBC_MAX_IDEL_TIME=300000 -DJDBC_MAX_WAIT_TIME=5000"
# since 1.2, the JAVA_HOME need to be set to run BE process.
# JAVA_HOME=/path/to/jdk/
diff --git a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcExecutor.java b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcExecutor.java
index b9188b4900..ef34922e88 100644
--- a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcExecutor.java
+++ b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/JdbcExecutor.java
@@ -89,6 +89,7 @@ public class JdbcExecutor {
private int maxPoolSize;
private int minIdleSize;
private int maxIdelTime;
+ private int maxWaitTime;
private TOdbcTableType tableType;
public JdbcExecutor(byte[] thriftParams) throws Exception {
@@ -103,10 +104,12 @@ public class JdbcExecutor {
minPoolSize = Integer.valueOf(System.getProperty("JDBC_MIN_POOL", "1"));
maxPoolSize = Integer.valueOf(System.getProperty("JDBC_MAX_POOL", "100"));
maxIdelTime = Integer.valueOf(System.getProperty("JDBC_MAX_IDEL_TIME", "300000"));
+ maxWaitTime = Integer.valueOf(System.getProperty("JDBC_MAX_WAIT_TIME", "5000"));
minIdleSize = minPoolSize > 0 ? 1 : 0;
LOG.info("JdbcExecutor set minPoolSize = " + minPoolSize
+ ", maxPoolSize = " + maxPoolSize
+ ", maxIdelTime = " + maxIdelTime
+ + ", maxWaitTime = " + maxWaitTime
+ ", minIdleSize = " + minIdleSize);
init(request.driver_path, request.statement, request.batch_size, request.jdbc_driver_class,
request.jdbc_url, request.jdbc_user, request.jdbc_password, request.op, request.table_type);
@@ -416,7 +419,7 @@ public class JdbcExecutor {
ds.setMinIdle(minIdleSize);
ds.setInitialSize(minPoolSize);
ds.setMaxActive(maxPoolSize);
- ds.setMaxWait(5000);
+ ds.setMaxWait(maxWaitTime);
ds.setTestWhileIdle(true);
ds.setTestOnBorrow(false);
setValidationQuery(ds, tableType);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org