[Proposal] Support SingleNode Deployment #188
Replies: 4 comments 5 replies
-
Hi @Ray-Eldath, thanks for submitting your proposal. You can access Proposal No.4 through the following URL: https://github.com/cloudberrydb/community/blob/main/proposals/cp-4/cp-4.md. |
Beta Was this translation helpful? Give feedback.
-
I've experimented with both design: use unmodified scripts, when a
|
Beta Was this translation helpful? Give feedback.
-
After discussed with reviewers we've settled with one particular design and the propsal has been updated to reflect the newest changes. |
Beta Was this translation helpful? Give feedback.
-
I want to know how to support expanding SingleNode Deployment to multi-segment Deployment ? |
Beta Was this translation helpful? Give feedback.
-
Proposers
Proposal Status
In Progress
Abstract
This proposal adds single node deployment to CBDB. It allows user to start a zero segment (no primary-mirror pairs) but still use, well, most of functionalities of a normal CBDB cluster.
Motivation
Customers have reported that a singlenode mode may be necessary. Since GPDB isn't fully compatible with Postgres, many features and grammars have been dependent upon. In a scenario where only one node is needed but GPDB is already relied by business logic, a singlenode mode can be used.
Implementation
Previously @wfnuser already crafted a draft version of singlenode (#77) but was deemed too radical and got rejected. Currently proposed implementation is nearly identical to that one, with the exception that no new
gp_role
are added. The implementation will be trifold:Code
bool
-typed GUCgp_internal_is_singlenode
has been added. The GUC can only be set throughpostgresql.conf
and shouldn't change by user manually. This GUC is to supportIS_SINGLENODE()
andIS_UTILITY_BUT_NOT_SINGLENODE()
macros.gpinitsystem
will modify this GUC when creating cluster, whilegpstart
will read it during the first phase of initialization and boot a utility coordinator-only "cluster" accordindly in the second phase.gp_role
, i.e.GP_ROLE_SINGLENODE
. The new role has been removed by taking the following global replacement:IS_UTILITY_OR_SINGLENODE(Gp_role)
->Gp_role == GP_ROLE_UTILITY
!Gp_role == GP_ROLE_UTILITY
->Gp_role != GP_ROLE_UTILITY
Gp_role != GP_ROLE_SINGLENODE
->!IS_SINGLENODE()
Gp_role != GP_ROLE_UTILITY && Gp_role != GP_ROLE_SINGLENODE
->Gp_role != GP_ROLE_UTILITY
Gp_role == GP_ROLE_SINGLENODE
->IS_SINGLENODE()
Gp_role == GP_ROLE_UTILITY
->Gp_role == GP_ROLE_UTILITY && !IS_SINGLENODE()
GP_ROLE_UTILITY
and all code already written for that code can now been leveraged. This approach has been discussed with and approved by reviewers for its simplicity and possibly smallest code change. For alternatives, see https://github.com/orgs/cloudberrydb/discussions/188#discussioncomment-6976028.Scripts
NUM_PRIMARY_MIRROR_PAIRS=0
to support create singlenode deployment in all scripts and commands (gpstop
,gpstart
, etc.)gp_internal_is_singlenode
. So user don't need add extra argument to the commands.Tests
The most challenging and irksome part of this PR is how to handle tests. Many tests in
regress
relies on test plan which surely is different under singlenode mode andisolation2
tests often require concurrent semantic and utility mode (-1U
,1U
, etc.) that singlenode does't support. This first implementation just copies and modifies all tests fromregress
andisolation2
intosinglenode_regress
andsinglenode_isolation2
. It's, undoubtedly, far from perfect.FAQ
utility
mode?A: To use
utility
mode one still needs to create a multi-segment cluster, and then connects to one of them using-c gp_role=utility
. This is different fromsinglenode
because the latter requires no segment at all from the ground up. Regarding code changes, as described above, they're mostly identical. There're a few cases wheresinglenode
mode behaves different fromutility
mode and thus need special care, but they're generally rare.Rollout/Adoption Plan
No response
Are you willing to submit a PR?
Beta Was this translation helpful? Give feedback.
All reactions