This is an automated email from the ASF dual-hosted git repository.
jshao pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/branch-0.9 by this push:
new 1ff297b3d5 [#6874] improvement(core): Set `testOnBorrow` to true to
avoid possible connection timeout problem (#6911)
1ff297b3d5 is described below
commit 1ff297b3d58155dc47fec53e8002521c89809332
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Apr 14 11:56:10 2025 +0800
[#6874] improvement(core): Set `testOnBorrow` to true to avoid possible
connection timeout problem (#6911)
### What changes were proposed in this pull request?
Set t`estOnBorrow` and `setTestWhileIdle` of JDBC connection pool from
`false` to `true`.
### Why are the changes needed?
If the configuration is false, there may be connection problems.
Fix: #6874
### Does this PR introduce _any_ user-facing change?
N/A.
### How was this patch tested?
The existing tests.
Co-authored-by: Mini Yu <[email protected]>
---
.../gravitino/storage/relational/session/SqlSessionFactoryHelper.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/core/src/main/java/org/apache/gravitino/storage/relational/session/SqlSessionFactoryHelper.java
b/core/src/main/java/org/apache/gravitino/storage/relational/session/SqlSessionFactoryHelper.java
index 6cfb428b92..fb870bc7f7 100644
---
a/core/src/main/java/org/apache/gravitino/storage/relational/session/SqlSessionFactoryHelper.java
+++
b/core/src/main/java/org/apache/gravitino/storage/relational/session/SqlSessionFactoryHelper.java
@@ -98,8 +98,8 @@ public class SqlSessionFactoryHelper {
dataSource.setRemoveAbandonedOnBorrow(true);
dataSource.setRemoveAbandonedTimeout(60);
dataSource.setTimeBetweenEvictionRunsMillis(Duration.ofMillis(10 * 60 *
1000L).toMillis());
- dataSource.setTestOnBorrow(BaseObjectPoolConfig.DEFAULT_TEST_ON_BORROW);
- dataSource.setTestWhileIdle(BaseObjectPoolConfig.DEFAULT_TEST_WHILE_IDLE);
+ dataSource.setTestOnBorrow(true);
+ dataSource.setTestWhileIdle(true);
dataSource.setMinEvictableIdleTimeMillis(1000);
dataSource.setNumTestsPerEvictionRun(BaseObjectPoolConfig.DEFAULT_NUM_TESTS_PER_EVICTION_RUN);
dataSource.setTestOnReturn(BaseObjectPoolConfig.DEFAULT_TEST_ON_RETURN);