isolation2 lockmodes fails on cassert builds: extra AccessShareLock on partition root

未关闭 适合新手
#2,356 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@tuhaihe 已经在做这个了。

开始于 2026年11月19日。

  • #2357 来自 @tuhaihe —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c, postgresql
领域
databases, testing

调研方向

从 isolation2 的 lockmodes 测试及其预期输出文件开始;issue 指出了 GDD-off 的 INSERT INTO t_lockmods_part_tbl_dml 情况,并解释了 cassert relcache 行为。在该情况之前结束会话 1,然后更新预期文件。完成标准是:测试在启用 assert 且包含 ORCA 的构建中通过,并且预期的锁输出匹配。

由索引模型根据 Issue 内容生成。

描述

The isolation2 lockmodes test fails on assert-enabled builds (--enable-cassert) with ORCA on. Seen on the Debug workflow in #2328, same diff on two runs:

 1: select * from show_locks_lockmodes;
  locktype | mode             | granted | relation
 ----------+------------------+---------+---------------------------------
+ relation | AccessShareLock  | t       | t_lockmods_part_tbl_dml
  relation | RowExclusiveLock | t       | t_lockmods_part_tbl_dml
  relation | RowExclusiveLock | t       | t_lockmods_part_tbl_dml_1_prt_1
  relation | RowExclusiveLock | t       | t_lockmods_part_tbl_dml_1_prt_2
-(3 rows)
+(4 rows)

https://github.com/apache/cloudberry/actions/runs/44457186410/job/135340162927

This is the GDD-off INSERT INTO t_lockmods_part_tbl_dml ... case. The test already explains why the extra lock appears: with cassert, RELCACHE_FORCE_RELEASE drops the relcache entry on close, so generate_partition_qual() reopens the root with AccessShareLock. That's why the later cases start with 1q:, so they always run without a cached relcache.

The INSERT case (added in 454814d0e8f) sits before that comment and reuses session 1. On a Release build the root is still cached, so there's no lock; on a cassert build there is.

Fix: quit session 1 before the INSERT case and update the expected files.

主要语言
C
星标
1.4k
派生
273
平均合并
4 天 6 小时
30 天内合并 PR
105

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/cloudberry 的其他 Issue

查看 apache/cloudberry 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。