Skip to content

Behave: run gpstart utility-mode tests in CI - #2457

Merged
tuhaihe merged 5 commits into
apache:mainfrom
tuhaihe:behave-gpstart-utility-mode
Dec 4, 2026
Merged

tuhaihe merged 5 commits into
apache:mainfrom
tuhaihe:behave-gpstart-utility-mode

Conversation

@tuhaihe

@tuhaihe tuhaihe commented Dec 1, 2026

Copy link
Copy Markdown
Member

Will rebase after #2452 is merged.

What does this PR do?

Type of Change

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

Breaking Changes

Test Plan

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

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context


@tuhaihe
tuhaihe marked this pull request as ready for review December 1, 2026 03:00
@tuhaihe

tuhaihe commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

We need some commits from #2452. Will rebase this PR once #2452 is merged.

@tuhaihe tuhaihe added this to the Behave tests milestone Dec 1, 2026
The scenario "validate session GUC passed with -x is set" has the
@not_implemented tag, so CI does not run it. Remove the tag.

The scenario starts the coordinator with gpstart -ma and expects
gpcheckcat to fail without -x gp_role=utility. It fails on main,
because Cloudberry does not reject non-utility connections to a
utility-mode postmaster. The next commit restores that check.

Assisted-by: Claude Code
gpstart -m starts the coordinator alone, in utility mode, so that an
administrator can do maintenance on an isolated system. Greenplum
rejects each connection to such a postmaster unless the client also
asks for utility mode (gp_role=utility). Cloudberry lost this check,
so any client can connect.

Restore the check from Greenplum (gpdb-archive commit 482967c1b4).
InitPostgres() sets a flag before it reads the startup packet, and
assign_gp_role() clears the flag when the client sets gp_role=utility.

Cloudberry needs more exemptions than Greenplum:

- A single-node deployment always runs in the utility role, so the
  check uses IS_UTILITY_BUT_NOT_SINGLENODE().
- The login monitor, background workers (such as logical replication
  apply workers and parallel workers) and walsenders do not send
  gp_role, so do not check them. Without this exemption, the TAP test
  recovery/035_standby_logical_decoding fails.

After gpstart -m, a client must set PGOPTIONS='-c gp_role=utility' to
connect, as in Greenplum.

Assisted-by: Claude Code
TAP nodes run in utility mode, and the test framework sets
PGOPTIONS='-c gp_role=utility' for each client. Two blocks in
pgbench/001 replace PGOPTIONS to set default_transaction_isolation,
so pgbench connects without gp_role=utility. With the utility-mode
check from the previous commit, the node rejects these connections
and the retry tests 434-443 fail. Keep gp_role=utility in both
blocks.

Other TAP tests that set PGOPTIONS and then use $node->psql are not
affected, because Cluster.pm sets gp_role=utility again inside psql.

Assisted-by: Claude Code
The gpstart scenarios that check connections in -m, -m -R and -R mode
have the @concourse_cluster tag, so CI does not run them. They only
need the single-host demo cluster. Remove the tag from them, and from
the foouser setup and cleanup scenarios that they use.

Assisted-by: Claude Code
Fix the two problems that stop these scenarios from passing:

- The step "when utility mode is set to {utility_mode}" kept the
  quotes around the value. The value never matched "True", so the
  step never set PGOPTIONS. Put the quotes in the step pattern.
- The expected error messages were old. psql now prints "connection
  to server ... failed:" before FATAL, and PostgreSQL 16 changed the
  message for reserved connection slots.

The CI gpstart job now runs 21 scenarios instead of 3.

Assisted-by: Claude Code
@tuhaihe
tuhaihe force-pushed the behave-gpstart-utility-mode branch from c5e7b61 to da96451 Compare December 4, 2026 07:43
@tuhaihe
tuhaihe enabled auto-merge (rebase) December 4, 2026 07:44
@tuhaihe
tuhaihe merged commit afaa9c7 into apache:main Dec 4, 2026
182 checks passed
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.

3 participants