Fix:修复达梦查看字段和 DDL 时的并行锁错误#3271
Conversation
t8y2
left a comment
There was a problem hiding this comment.
request changes: 还有一个同类元数据路径没有覆盖。
DamengAgent.listIndexes() 的 ALL_INDEXES 查询仍然是普通 SELECT,没有加 /*+ PARALLEL(1) */。这个方法是打开表数据/结构时实际使用的索引加载路径,和本次修复的其他系统目录查询属于同一类风险;目前只有生成表 DDL 时使用的索引查询被串行化。
新测试只通过 getTableDdl() 收集 SQL,因此不会执行或检查 listIndexes(),即使这个遗漏存在测试仍会通过。请给 listIndexes() 增加相同的串行 hint,并补一个直接覆盖该方法的断言。
|
我来补这个遗漏的同类路径。 Maintainer patch 会给 |
t8y2
left a comment
There was a problem hiding this comment.
Maintainer patch applied in da18185.
listIndexes() queried the same Dameng catalog family as the other affected metadata paths but did not disable parallel execution.
The patch adds /*+ PARALLEL(1) */ to the index metadata query and directly verifies the generated SQL in the Dameng metadata test suite.
Validation:
./gradlew :dameng:test :dameng:shadowJar --no-daemongit diff --check
Resolved by maintainer patch and verified by focused tests and CI.
|
Thanks for the contribution! Merged in 4475ccb, will be released in the next version. |
问题原因
达梦开启自动并行查询后,字段和 DDL 元数据 SQL 可能进入并行执行。查询过程中,系统目录或
DBMS_METADATA.GET_DDL需要获取锁,达梦会报错:表 DDL 路径还存在 JDBC 重入:读取
DBMS_METADATA.GET_DDL的 ResultSet 尚未关闭时,又在同一连接上查询表注释、字段和索引,进一步增加了触发该错误的概率。修复内容
DBMS_METADATA查询增加/*+ PARALLEL(1) */,按达梦语义强制单线程执行。验证结果
./gradlew :dameng:test:通过。./gradlew :dameng:shadowJar:通过。./gradlew test:111 个任务通过。git diff --check:通过。Closes #2270