Open
[开源实习]: Proxool 连接 openGauss B 兼容模式测试代码及自测报告 #126
[开源实习]: Proxool 连接 openGauss B 兼容模式测试代码及自测报告 #126
Open
wsyAdd on Sep 23
wsy
wsy
Sep 23

【标题】Proxool 连接 openGauss B 兼容模式测试代码及自测报告

【实现内容】:
基于 openGauss B 库 dolphin 插件的 MySQL 协议兼容能力,测试验证 Proxool 连接池配合 MySQL JDBC 驱动连接 openGauss B 兼容模式数据库的可行性,并输出测试代码、测试思维导图与自测报告。本 PR 提交至 examples 仓库,内容包括:

1.Proxool 连接池测试代码(8 个 JUnit 测试类,共 37 项测试用例全部通过)
2.测试思维导图
3‘自测报告(markdown 格式,包含完整测试结果与兼容性差异分析)
4.readme.md、pom.xml、proxool.properties、依赖 JAR

【根因分析】:
不涉及。本 PR 为示例代码与测试报告提交,不修改 openGauss 或 dolphin 插件源码。

【实现方案】:
环境:openEuler 20.03 LTS + openGauss 7.0.0-RC3,开启 dolphin 插件,配置 MySQL 协议端口 3308,创建 B 兼容库 test_b_db。

测试框架:Maven 工程,依赖 Proxool 0.9.1 + proxool-cglib 0.9.1 + MySQL Connector/J 8.0.28 + JUnit 4.13.2,运行在 JDK 1.8。

使用 Proxool 的 Properties 配置方式(proxool.properties),通过 DriverManager.getConnection("proxool.openGaussPool") 获取池化连接。

编写 8 个 JUnit 测试类,用断言形式覆盖以下场景,共 37 个测试用例:

  • ProxoolJUnitTest(12 项):连接池初始化、连接获取、建表、增删改查、事务提交/回滚、批量插入、连接池监控、连接池关闭
  • ProxoolPoolParamTest(5 项):最大连接数、满池借出、归还复用、最小空闲、并发获取
  • ProxoolTransactionTest(4 项):隔离级别读取、commit 跨连接可见、rollback 跨连接不可见、池化事务
  • ProxoolSqlCategoryTest(5 项):DDL、DML、DQL(排序分页)、DCL、TCL(含保存点)
  • ProxoolDataTypeTest(3 项):中文、emoji、常用类型与 NULL
  • ProxoolStabilityTest(4 项):100 次借出归还、多线程并发事务、长连接保活、池状态快照
  • ProxoolConnectionValidationTest(3 项):借出连接校验、失效连接淘汰重建、池状态健康
  • ProxoolPoolExhaustTest(1 项):满池等待与恢复

【关联需求或issue】
Fixes https://gitcode.com/opengauss/opensource-intership/issues/50
【开发自验报告】:

  1. 请附上自验结果(内容或者截图):
    JUnit 测试结果:12 tests passed, 0 failed
    每个测试用例均有 Java 端断言截图 + 数据库端 MySQL 客户端验证截图
    详见 docs/Proxool 连接 openGauss B 兼容模式自测报告.docx
  2. 是否可以添加fastcheck测试用例,如是,请补充fastcheck用例:不涉及。
  3. 是否涉及资料修改,如是,在docs仓库补充资料:不涉及。
  4. 是否考虑升级场景(系统表修改、日志持久化以及修改执行态数据格式):不涉及。
  5. 是否考虑在线扩容等扩展场景:不涉及。
  6. 是否考虑异常场景/并发场景/前向兼容/性能场景:
    已测试异常场景:Proxool 0.9.1 与 JDK 21 不兼容(InaccessibleObjectException),解决方案为使用 JDK 8。
    已测试连接池关闭后再次获取连接抛异常的边界情况。
    并发、性能场景本次未覆盖,属后续可优化方向。
  7. 是否对其他模块产生影响:不涉及。
  8. 是否需要回合补丁版本(5.0、6.0),涉及(结果错误|coredump|性能劣化|内存泄露|集群异常)相关修复请排查回合补丁分支:不涉及。
  9. 针对Plugin仓dolphin插件,新增/修改的代码是否已使用 DOLPHIN 宏进行控制,方便后续回合openGauss-server仓代码:不涉及。

【当前PR是否有AI参与】:
[x] 是
[ ] 否
__1. AI Agent 平台: DeepSeek
__2. AI 模型: DeepSeek
__3. Prompt上下文 :用于辅助生成 JUnit 测试代码、Proxool 配置模板、文档排版

【其他说明】:
ProxoolConnectOpenGaussB/
├── docs/
│ ├── Proxool自测报告.md
│ ├── 测试思维导图.png
│ └── figures/
│ └── 00_overview.png
├── lib/
│ ├── proxool-0.9.1.jar
│ └── proxool-cglib-0.9.1.jar
├── src/
│ ├── main/
│ │ ├── java/ProxoolTest.java
│ │ └── resources/proxool.properties
│ └── test/
│ └── java/
│ ├── ProxoolJUnitTest.java
│ ├── ProxoolPoolParamTest.java
│ ├── ProxoolTransactionTest.java
│ ├── ProxoolSqlCategoryTest.java
│ ├── ProxoolDataTypeTest.java
│ ├── ProxoolStabilityTest.java
│ ├── ProxoolConnectionValidationTest.java
│ └── ProxoolPoolExhaustTest.java
├── pom.xml
└── readme.md

likedislike
Merge blocked
wsywsy
Sep 23 Created pull request, commit d0e6623f
opengauss_botopengauss_botCollaborators
Sep 23 Set ywzq1161327784,chenxiaobin19,totaj,congzhou2603,shenzheng4,chendong76,dodders,muyulinzhong,shirley_zhengx,quemingjian,jemappellehc,wofanzheng,wlff234,libiao2024,hwworkholic,CarrotGo,superlchf as approver
opengauss_botopengauss_botCollaborators
Sep 23 Added label: sig/Infra
opengauss_bot
opengauss_botCollaborators
Sep 23 Comments:

Welcome To openGauss Community

Hey @siying01-2026 , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.

Contact Guide

If you have any questions, please contact the SIG: Infra ,
and any of the maintainers: @CarrotGo, @chendong76, @chenxiaobin19, @congzhou2603, @dodders, @hwworkholic, @jemappellehc, @libiao2024, @muyulinzhong, @quemingjian, @shenzheng4, @shirley_zhengx, @superlchf, @totaj, @wlff234, @wofanzheng, @ywzq1161327784 ,
and any of the committers: @ailoooong, @gzbang, @libiao2024, @zhangxubo .

likedislike
opengauss_botopengauss_botCollaborators
Sep 23 Added label: stat/needs-squash
129 messages are collapsed here。 See more
wsywsy
4 days ago Pre merge succeeded (commit_id: 5e3ef9a38e3e34eb64d0c813e242223e4c05c611)
opengauss_bot
opengauss_botCollaborators
4 days ago Comments:

CLA Signature Guide

@siying01-2026 , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
850b2b00 test: use isolated pool and outs... the email used in the commit is an invalid email!
please check all commits.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

likedislike
liyangxCollaborators1 day agoStart code review1
ProxoolConnectOpenGaussB/src/test/java/ProxoolPoolParamTest.java
@@ -0,0 +245,4 @@
245+ try (Connection killer = DriverManager.getConnection("proxool." + HOUSEKEEPING_POOL);
246+ Statement st = killer.createStatement();
247+ ResultSet rs = st.executeQuery(
248+ "SELECT pg_terminate_backend(pid) FROM pg_stat_activity " +
liyangx1 day agoComments:

[P1] 这里杀连接的范围太大了

WHERE 只按用户名筛选,会把这个账号的其他会话也杀掉,包括主连接池和人工客户端的连接。新建一个 housekeepingPool,并不能限制这条 SQL 的作用范围。我在本地替身环境里同时建了两个池,跑完这个用例后,另一个池里持有的连接也断了。

请先记下本次隔离池中要终止的连接 PID,再由池外管理连接逐个终止这些 PID。顺便加个检查,确认其他池的连接还能正常查询。

likedislike
liyangxCollaborators1 day agoStart code review1
ProxoolConnectOpenGaussB/docs/Proxool连接openGaussB兼容模式自测报告.md
@@ -0,0 +53,4 @@
53+```text
54+Tests run: 38, Failures: 0, Errors: 0, Skipped: 0
55+```
56+ 
liyangx1 day agoComments:

[P2] 自测结果要跟这次提交一起更新

新增 test06 后,当前是 39 个测试,ProxoolPoolParamTest 有 6 个;报告、README 和两张截图还停留在 38 个。两张截图文件与上一版相同,不能说明这次改完后的运行结果。

报告 4.2 还在引用旧的 test04 方法名和已经删掉的轮询步骤,4.8 也没同步隔离池、池外管理连接的改法。

请修好后完整跑一次 mvn clean test,再把结果、截图和场景说明一起更新。有失败就把实际结果和原因写出来。图片路径和 README 的报告链接这次已经改对了。

likedislike
liyangxCollaborators1 day agoStart code review1
ProxoolConnectOpenGaussB/src/test/java/ProxoolConnectionValidationTest.java
@@ -0,0 +14,4 @@
14+ /** 容量为 1 的隔离验证池(仅 test02 使用,用后即删) */
15+ private static final String VALIDATION_POOL = "validationPool";
16+ 
17+ private static final String DIRECT_URL =
liyangx1 day agoComments:

[P2] 连接信息统一从配置里取

README 让读者只改 proxool.properties,但这里的 DIRECT_URL,以及 test06 里的地址、账号、密码都写死在源码里。换个环境按 README 操作,这两个用例还是会去连 192.168.198.135,完整测试就跑不起来。

请让新增的隔离池和池外连接也读取同一份连接配置,只单独设置池名、容量和维护参数。需要额外权限的话,在运行说明里写清楚。

likedislike