Skip to content

Backport #8466 to release-12.1: Fix role propagation error due to missing grantor dependencies#8569

Open
ihalatci wants to merge 2 commits into
release-12.1from
release-12.1-backport-8466
Open

Backport #8466 to release-12.1: Fix role propagation error due to missing grantor dependencies#8569
ihalatci wants to merge 2 commits into
release-12.1from
release-12.1-backport-8466

Conversation

@ihalatci
Copy link
Copy Markdown
Contributor

Backport of #8466 to release-12.1.

DESCRIPTION: Add grantor role dependencies to fix node addition with interdependent roles

Modified ExpandRolesToGroups in dependency.c to track grantor roles as dependencies alongside role memberships during node activation. This ensures grantors are propagated before roles that reference them in GRANT ... GRANTED BY statements.

Added regression test covering the interdependent role scenario.

Fixes #8425

12.1-specific notes

The cherry-pick required minor expected/create_role_propagation.out adjustments:

  • Reverted unrelated column-width / non_dist_role_1 rows that were absent in 12.1's baseline.
  • New test's worker_2 grantor column: interdep_role1postgres (on 12.1, GRANTED BY is not preserved when re-propagating to a re-added worker — a separate, pre-existing limitation). The fix's core behavior (master_add_node no longer fails with the missing-admin-option error) works correctly.

Verification

  • Build: PG 16.10 ✅
  • Regression (check-multi): 183/183 ✅
  • Style (CI stylechecker image ghcr.io/citusdata/stylechecker:0.8.18-dev-85e972b, uncrustify 0.68.1): ✅

DESCRIPTION: Add grantor role dependencies to fix node addition with interdependent roles

Modified ExpandRolesToGroups in dependency.c to track grantor roles as
dependencies alongside role memberships during node activation. This
ensures grantors are propagated before roles that reference them in
GRANT ... GRANTED BY statements.

Added regression test covering the interdependent role scenario.

Fixes #8425
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.65%. Comparing base (377c1f2) to head (03cc6b2).

Additional details and impacted files
@@               Coverage Diff                @@
##           release-12.1    #8569      +/-   ##
================================================
- Coverage         89.65%   89.65%   -0.01%     
================================================
  Files               276      276              
  Lines             59790    59804      +14     
  Branches           7471     7473       +2     
================================================
+ Hits              53605    53617      +12     
  Misses             4041     4041              
- Partials           2144     2146       +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

On PG <= 15, an additional non_dist_role_1 entry appears in pg_authid
on worker_2 after node re-activation, due to pre-PG16 role/grant
propagation semantics. Add a PG14/15-specific alternative-expected
file so the test passes on those versions while keeping the strong
assertion on PG16+.
ihalatci added a commit that referenced this pull request May 15, 2026
DESCRIPTION: Add grantor role dependencies to fix node addition with
interdependent roles

Modified `ExpandRolesToGroups` in `dependency.c` to track grantor roles
as dependencies alongside role memberships during node activation. This
ensures grantors are propagated before roles that reference them in
`GRANT ... GRANTED BY` statements.

Added regression test covering the interdependent role scenario.

Fixes #8425

Note: this is a clean re-application of #8466 onto current main
(replacing that PR, which had accumulated unrelated merge commits). The
change has already been backported and merged into release-14.0 (#8568),
release-13.2 (#8579), and release-12.1 (#8569).
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.

Role propagation error due to interdependent roles while adding new nodes

2 participants