Skip to content

Fix concurrent distribution relation lock assertion#8679

Draft
ihalatci wants to merge 1 commit into
mainfrom
ihalatci-fix-concurrent-colocation-lock
Draft

Fix concurrent distribution relation lock assertion#8679
ihalatci wants to merge 1 commit into
mainfrom
ihalatci-fix-concurrent-colocation-lock

Conversation

@ihalatci

Copy link
Copy Markdown
Contributor

Summary

EnsureColocateWithTableIsValid called BuildDistributionKeyFromColumnName with NoLock during concurrent-distribution preflight. On cassert builds, PostgreSQL's try_relation_open asserts that callers using NoLock already hold at least AccessShareLock, but this path held no relation lock.

Acquire AccessShareLock through the existing distribution-key helper and release it immediately after extraction. This keeps preflight lock retention short and preserves the later ShareUpdateExclusiveLock acquisition and distribution-column revalidation.

Validation

  • PG16.14 --enable-cassert: focused create_distributed_table_concurrently regression passed.
  • PG17.10 --enable-cassert: focused create_distributed_table_concurrently regression passed.
  • The exact colocate_with := 'nocolo' case returns the expected distribution-column type mismatch with no assertion or signal 6.

The focused runs used check-base EXTRA_TESTS=create_distributed_table_concurrently; the target passed on both versions. The overall harness command remained nonzero because three unrelated out-of-tree fixture tests (multi_cluster_management, multi_create_table_superuser, and tablespace) failed due to the archived source layout.

Fixes #8671
Related to #8665

Fixes: #8672

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d2f6f2e9-3dd6-4f20-b84a-dece8bec442f
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.65%. Comparing base (f91592f) to head (4c6ef3f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8679      +/-   ##
==========================================
- Coverage   88.73%   88.65%   -0.08%     
==========================================
  Files         288      288              
  Lines       64428    64429       +1     
  Branches     8113     8114       +1     
==========================================
- Hits        57167    57117      -50     
- Misses       4917     4971      +54     
+ Partials     2344     2341       -3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist last_upgrade_version after Citus upgrade checks Fix unlocked relation access in concurrent distribution validation

2 participants