Skip to content

gpexpand: make new-segment shutdown mode configurable (#2041) - #2227

Open
aidekqz wants to merge 1 commit into
apache:REL_2_STABLEfrom
aidekqz:gpexpand-shutdown-rel2
Open

aidekqz wants to merge 1 commit into
apache:REL_2_STABLEfrom
aidekqz:gpexpand-shutdown-rel2

Conversation

@aidekqz

@aidekqz aidekqz commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Backports #2041 to REL_2_STABLE.

Adds the -M/--mode option to the gpexpand -i workflow, allowing users to select the pg_ctl shutdown mode used when stopping newly initialized primary segments.

Supported values are smart, fast, and immediate. The default remains smart, preserving the existing behavior. Users who need to avoid waiting for active connections can explicitly select --mode fast.

The option applies only during initialization with -i. It does not affect interactive input-file generation or table redistribution.

The original change was inspired by greenplum-db/gpdb-archive@f29ceca, which unconditionally switches the shutdown mode to fast. This implementation makes the mode configurable to preserve backward compatibility.

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

None. The default shutdown mode remains smart.

Test Plan

  • Unit tests added/updated
  • Unit tests passed on the backport branch
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Includes the unit test from #2041 verifying that the configured shutdown mode is passed to SegmentStop.

The backport contains one cherry-picked commit on top of the current REL_2_STABLE. git diff --check passes.

Unit tests have not been rerun on the backport branch. Command to run them:

cd gpMgmt/bin
python3 -m unittest discover --verbose -s gppylib -p "test_unit_gpexpand.py"

Impact

Performance:

No change by default. When --mode fast is selected, gpexpand does not wait for active connections while stopping newly initialized primary segments.

User-facing changes:

The gpexpand -i workflow now accepts -M/--mode with smart, fast, and immediate as valid values. The default is smart.

Dependencies:

No new dependencies.

Checklist

Additional Context

Original PR: #2041

Backported commit: 993e877

Upstream reference: greenplum-db/gpdb-archive@f29ceca

* Make gpexpand's new-segment shutdown mode configurable

gpexpand stops newly configured primary segments during the
initialization phase. Allow callers to choose the pg_ctl shutdown mode
instead of fixing it in the implementation.

Add -M/--mode to the -i workflow with smart, fast, and immediate as
valid values. Keep smart as the default to preserve existing behavior,
and document that the option does not apply to interactive input-file
generation or table redistribution.

(cherry picked from commit 993e877)

@Alena0704 Alena0704 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Thank you!

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