Jack Ling
75f89f19ba
feat(database/gdb): add MaxIdleConnTime configuration for SetConnMaxIdleTime support (#4625)
## Summary
- Add `MaxIdleConnTime` configuration field to support Go 1.15+
`sql.DB.SetConnMaxIdleTime()` method
- Add `SetMaxIdleConnTime()` method to DB interface and Core
implementation
- Apply configuration during connection pool initialization
- Add unit tests for the new configuration option
## Related Issue
Closes #4596
## Changes
| File | Change |
|------|--------|
| `database/gdb/gdb_core_config.go` | Add `MaxIdleConnTime` field to
`ConfigNode`, add `SetMaxIdleConnTime()` method |
| `database/gdb/gdb.go` | Add interface method, `dynamicConfig` field,
initialization logic |
| `database/gdb/gdb_z_core_config_test.go` | Add unit test for
`SetMaxIdleConnTime` |
| `database/gdb/gdb_z_core_config_external_test.go` | Add `ConfigNode`
connection pool settings test |
## Usage
**Configuration file:**
```yaml
database:
default:
maxIdleTime: "10s" # Close idle connections after 10 seconds
```
**Code:**
```go
db.SetMaxIdleConnTime(10 * time.Second)
```
## Test Plan
- [x] Unit tests pass (`go test -run
"Test_Core_SetMaxConnections|Test_ConfigNode_ConnectionPoolSettings"`)
- [x] All database drivers compile successfully (mysql, pgsql, sqlite,
clickhouse, dm, mssql, oracle, etc.)
- [x] No breaking changes - follows Go's default behavior (0 = no idle
time limit)
2026-01-19 13:04:03 +08:00
..
2021-09-23 19:29:20 +08:00
2025-03-06 23:04:26 +08:00
2026-01-19 13:04:03 +08:00
2024-12-01 23:47:51 +08:00
2022-03-21 21:17:48 +08:00
2024-03-24 21:18:30 +08:00
2025-08-28 16:53:19 +08:00
2024-06-25 21:11:36 +08:00
2025-09-01 15:33:50 +08:00
2025-08-28 16:53:19 +08:00
2026-01-16 12:43:52 +08:00
2025-12-09 15:46:41 +08:00
2025-12-12 15:14:21 +08:00
2022-09-26 22:11:13 +08:00
2025-12-09 15:46:41 +08:00
2022-09-26 22:11:13 +08:00
2026-01-15 21:23:07 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2026-01-16 10:33:05 +08:00
2025-12-12 15:14:21 +08:00
2025-11-21 17:27:09 +08:00
2025-09-28 17:57:27 +08:00
2025-12-12 15:14:21 +08:00
2023-11-20 20:47:26 +08:00
2026-01-15 13:27:25 +08:00
2022-11-01 20:12:21 +08:00
2025-12-26 16:43:19 +08:00
2026-01-16 13:05:33 +08:00
2024-12-09 23:12:20 +08:00
2025-12-12 15:14:21 +08:00
2024-12-07 14:01:31 +08:00
2025-12-12 15:14:21 +08:00
2026-01-15 10:25:40 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2026-01-16 10:33:05 +08:00
2026-01-16 12:43:52 +08:00
2023-09-04 21:23:46 +08:00
2022-02-16 00:26:06 +08:00
2025-08-28 16:53:19 +08:00
2025-08-28 16:53:19 +08:00
2025-08-29 10:32:30 +08:00
2025-09-28 17:08:37 +08:00
2026-01-19 13:04:03 +08:00
2026-01-19 13:04:03 +08:00
2025-08-22 15:29:16 +08:00
2025-03-06 23:04:26 +08:00
2026-01-19 13:04:03 +08:00