Skip to content

Feature: Manage storage server owners and comments - #2312

Merged
leborchuk merged 1 commit into
apache:mainfrom
allenvox:feature/storage-server-owner-comments
Nov 19, 2026
Merged

leborchuk merged 1 commit into
apache:mainfrom
allenvox:feature/storage-server-owner-comments

Conversation

@allenvox

@allenvox allenvox commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1299

What does this PR do?

Storage servers currently reject ownership changes and comments. Add ALTER STORAGE SERVER ... OWNER TO and COMMENT ON STORAGE SERVER so administrators can transfer ownership and document storage configurations used by directory tables.

ALTER STORAGE SERVER archive OWNER TO archive_admin;
COMMENT ON STORAGE SERVER archive IS 'Storage for archived files';

Reuse the generic ownership machinery to update ACLs, owner dependencies and hooks. Ordinary roles must own the server and be able to SET ROLE to its new owner. Preserve the existing mdb_admin exception and its restrictions. Register owner dependencies when creating storage servers and support REASSIGN OWNED. Storage user mappings retain their mapped user, matching foreign user mappings. Ownership changes preserve server options.

Store comments in pg_shdescription because storage servers are shared across databases, and remove comments when a server is dropped. Both new commands dispatch metadata changes to segments. Add psql completion, SQL reference documentation and regression coverage, and update the existing directory-table test to accept ownership changes.

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Built and installed with assertions and debug enabled on Rocky Linux 9 / GCC 11.5, using a coordinator and three primary segments. ORCA, PAX, gpcloud and external FTS were disabled, with mirrors and standby omitted from the test cluster.

All seven selected regressions passed with clean fixtures and the standard tablespace setup.

make -C src/test/regress tablespace-setup
make -C src/test/regress installcheck-tests \
  TESTS='test_setup mdb_admin storage_server foreign_data dependency object_address directory_table'

Additional checks covered cross-database visibility, quoted identifiers and Unicode comments, owner dependencies, transaction rollback, concurrent owner/comment updates, permission checks after waiting for an ownership transfer, psql completion and storage servers created by the unmodified main backend. The new reference page passed DocBook 4.5 validation.

After rebasing onto current main 97c79c51a926f94eedae7486a6488ddae2e451e1, rebuilt and installed the branch and reran all seven selected regressions successfully. The full-suite comparison below was collected before this rebase.

A full-suite baseline run used unmodified main at 487864393a8d7fc1cd4f1749ce7458aac2fc3888, with the same build flags and cluster topology.

Full suite Passed Failed or interrupted
This branch, diagnostic run before rebase 680 46
Base main, fresh cluster 670 55

45 failing test names overlapped. The branch failure absent on main was test_setup from stale shared fixtures, cleared before the successful targeted rerun. Both runs hit the same relation.c:71 assertion and recovery cascades, plus expectations requiring ORCA or mirrors. Main had nine additional recovery-related connection failures and an interrupted anti-wraparound fault wait. The mirrored FTS failover wait was interrupted in both runs because the cluster has no mirrors. Main's directory_table difference was a truncated source path in a syntax-error diagnostic; the final targeted run on this branch passed that test.

Checklist

@allenvox

Copy link
Copy Markdown
Contributor Author

Hi @tuhaihe, this PR implements #1299. Could you please approve the CI workflows and suggest a reviewer for the storage-server ownership and comment changes?
I tested the branch builds locally and all seven targeted regressions pass. The full-suite results and comparison with main are documented in the description. Thanks!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @allenvox welcome!🎊 Thanks for taking the effort to make our project better! 🙌 Keep making such awesome contributions!

@my-ship-it

Copy link
Copy Markdown
Contributor

LGTM, thanks!
Currently, pg_dump cannot work with storage server, which could be supported in another PR.

Comment thread src/bin/psql/tab-complete.c Resolved

@leborchuk leborchuk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@leborchuk
leborchuk enabled auto-merge (squash) November 17, 2026 09:36
@Alena0704
Alena0704 force-pushed the feature/storage-server-owner-comments branch from d46de8c to b3e436c Compare November 18, 2026 09:40
Add ALTER STORAGE SERVER ... OWNER TO and COMMENT ON STORAGE SERVER.
Reuse generic owner updates while requiring SET ROLE access for ordinary
roles and preserving the mdb_admin exception. Track owner dependencies,
support REASSIGN OWNED with storage user mappings, and clean up shared
comments when dropping a server.

Add psql completion, SQL reference documentation and regression coverage
for permissions, mappings, rollback and segment metadata.

See: Issue#1299
@tuhaihe
tuhaihe force-pushed the feature/storage-server-owner-comments branch from b3e436c to cfef937 Compare November 19, 2026 02:25
@leborchuk
leborchuk merged commit aac2e92 into apache:main Nov 19, 2026
155 checks passed
leborchuk pushed a commit to leborchuk/cloudberry that referenced this pull request Nov 19, 2026
Add ALTER STORAGE SERVER ... OWNER TO and COMMENT ON STORAGE SERVER.
Reuse generic owner updates while requiring SET ROLE access for ordinary
roles and preserving the mdb_admin exception. Track owner dependencies,
support REASSIGN OWNED with storage user mappings, and clean up shared
comments when dropping a server.

Add psql completion, SQL reference documentation and regression coverage
for permissions, mappings, rollback and segment metadata.

See: Issue#1299
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.

Feature Request: Support ALTER STORAGE SERVER ... OWNER TO ... and COMMENT ON STORAGE SERVER

3 participants