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

Open Beginner friendly
#2,356 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@tuhaihe is already working on this.

Since Nov 19, 2026.

  • #2357 by @tuhaihe — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c, postgresql
Domain
databases, testing

Research direction

Start with the isolation2 lockmodes test and its expected output files; the issue identifies the GDD-off INSERT INTO t_lockmods_part_tbl_dml case and explains the cassert relcache behavior. Quit session 1 before that case, then update the expected files. Done means the test passes on assert-enabled builds with ORCA and the expected lock output matches.

Written by the indexing model from the issue text.

Description

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.

Dominant language
C
Stars
1.4k
Forks
273
Avg merge
4d 6h
Merged PRs (30d)
105

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/cloudberry

All issues in apache/cloudberry

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.