Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SingleNode deployment #206

Conversation

Ray-Eldath
Copy link
Contributor

@Ray-Eldath Ray-Eldath commented Sep 19, 2023

closes #69, closes #53, closes #100, closes #123


Change logs

This PR implements singlenode deployment. All code, scripts and tests are incorporated.

Please see the full design proposal: https://github.com/orgs/cloudberrydb/discussions/188#discussion-5593615 which has already been discussed with and approved by reviewers.

Commit messages're still in a mess. I'll squash them into a nice write-up after we finish reviewing.

This PR is heavily based on @wfnuser's previous work (#77).

Why are the changes needed?

Please refer to the Motivation section of the design proposal.

@CLAassistant
Copy link

CLAassistant commented Sep 19, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ wfnuser
✅ Ray-Eldath
❌ tglsfdc
You have signed the CLA already but the status is still pending? Let us recheck it.

@Ray-Eldath Ray-Eldath force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch 2 times, most recently from f5a1f51 to 2651b1c Compare September 19, 2023 07:58
@avamingli
Copy link
Collaborator

avamingli commented Sep 19, 2023

Commit messages're still in a mess. I'll squash them into a nice write-up after we finish reviewing.

Hi, thanks for your contribution.
Commit messages are also part of review process, please squash commits as three kinds: our CBDB codes change/All tests added/PG commits cherry-picked one-by-one.
Review by commits is helpful for reviewers as this pr have so many test files.

@Ray-Eldath Ray-Eldath force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch 8 times, most recently from 2706ccb to ff14705 Compare September 25, 2023 03:14
Copy link
Collaborator

@avamingli avamingli left a comment

Choose a reason for hiding this comment

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

Most codes look good.

src/backend/optimizer/plan/planner.c Outdated Show resolved Hide resolved
src/backend/optimizer/prep/prepunion.c Outdated Show resolved Hide resolved
src/backend/optimizer/path/allpaths.c Outdated Show resolved Hide resolved
src/backend/commands/vacuum.c Show resolved Hide resolved
src/backend/commands/tablecmds.c Show resolved Hide resolved
src/test/regress/pg_regress.c Outdated Show resolved Hide resolved
src/include/executor/executor.h Show resolved Hide resolved
src/backend/utils/misc/guc_gp.c Outdated Show resolved Hide resolved
src/backend/postmaster/postmaster.c Outdated Show resolved Hide resolved
src/backend/executor/execCurrent.c Show resolved Hide resolved
@Ray-Eldath Ray-Eldath force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch 5 times, most recently from 27757d7 to cf7f33c Compare September 26, 2023 10:40
@Ray-Eldath Ray-Eldath force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch 4 times, most recently from e64d6c6 to d724550 Compare October 10, 2023 09:17
@Ray-Eldath
Copy link
Contributor Author

Ray-Eldath commented Oct 10, 2023

really can't replicate the failure of https://github.com/cloudberrydb/cloudberrydb/actions/runs/6467257609/job/17557480521?pr=206 on my machine even i've already enabled xml support with --with-libxml

already fixed.


apart from this, all reviewer comments are fixed or replied. could you please check whether my response addressed all your concerns? @avamingli

@Ray-Eldath Ray-Eldath force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch 3 times, most recently from 4363279 to 1daf639 Compare October 11, 2023 02:47
@Ray-Eldath Ray-Eldath force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch 2 times, most recently from 60e4396 to 70421cd Compare October 11, 2023 03:25
@yjhjstz
Copy link
Collaborator

yjhjstz commented Oct 26, 2023

how to install single node with rpm package ? think about install like pg style: initdb, then pg_ctl start @Ray-Eldath

@Ray-Eldath Ray-Eldath force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch 2 times, most recently from 8d04121 to 4d3f71f Compare October 30, 2023 03:23
@Ray-Eldath
Copy link
Contributor Author

how to install single node with rpm package ? think about install like pg style: initdb, then pg_ctl start @Ray-Eldath

I've tried with proper postmaster.conf using env GPSESSID=0000000000 GPERA=f6a2f666f34494b3_230907184019 $GPHOME/bin/pg_ctl -D /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/standby -l /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/standby/log/startup.log -w -t 600 -o " -p 7001" start and env GPSESSID=0000000000 GPERA=f6a2f666f34494b3_230907184019 $GPHOME/bin/pg_ctl -D /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 -l /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1/log/startup.log -w -t 600 -o " -p 7000 -c gp_role=utility" start can successfully create a singlenode deployment. but the recommended approach is still to use gpinitsystem --singlenodeMode to start one coordinator and one coordinator standby.

@Ray-Eldath Ray-Eldath force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch from 4d3f71f to 223997d Compare October 30, 2023 07:12
@yjhjstz
Copy link
Collaborator

yjhjstz commented Oct 31, 2023

how to install single node with rpm package ? think about install like pg style: initdb, then pg_ctl start @Ray-Eldath

I've tried with proper postmaster.conf using env GPSESSID=0000000000 GPERA=f6a2f666f34494b3_230907184019 $GPHOME/bin/pg_ctl -D /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/standby -l /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/standby/log/startup.log -w -t 600 -o " -p 7001" start and env GPSESSID=0000000000 GPERA=f6a2f666f34494b3_230907184019 $GPHOME/bin/pg_ctl -D /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 -l /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1/log/startup.log -w -t 600 -o " -p 7000 -c gp_role=utility" start can successfully create a singlenode deployment. but the recommended approach is still to use gpinitsystem --singlenodeMode to start one coordinator and one coordinator standby.

can we change default datadirs/qddir to make singlenode dir ?

@Ray-Eldath
Copy link
Contributor Author

how to install single node with rpm package ? think about install like pg style: initdb, then pg_ctl start @Ray-Eldath

I've tried with proper postmaster.conf using env GPSESSID=0000000000 GPERA=f6a2f666f34494b3_230907184019 $GPHOME/bin/pg_ctl -D /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/standby -l /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/standby/log/startup.log -w -t 600 -o " -p 7001" start and env GPSESSID=0000000000 GPERA=f6a2f666f34494b3_230907184019 $GPHOME/bin/pg_ctl -D /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 -l /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1/log/startup.log -w -t 600 -o " -p 7000 -c gp_role=utility" start can successfully create a singlenode deployment. but the recommended approach is still to use gpinitsystem --singlenodeMode to start one coordinator and one coordinator standby.

can we change default datadirs/qddir to make singlenode dir ?

we can arbitrarily change dir of the coordinator and the coordinator standby. when using gpinitsystem, env COORDINATOR_DATADIR can be set, and when using pg_ctl, just change -D argument.

@yjhjstz
Copy link
Collaborator

yjhjstz commented Nov 1, 2023

how to install single node with rpm package ? think about install like pg style: initdb, then pg_ctl start @Ray-Eldath

I've tried with proper postmaster.conf using env GPSESSID=0000000000 GPERA=f6a2f666f34494b3_230907184019 $GPHOME/bin/pg_ctl -D /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/standby -l /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/standby/log/startup.log -w -t 600 -o " -p 7001" start and env GPSESSID=0000000000 GPERA=f6a2f666f34494b3_230907184019 $GPHOME/bin/pg_ctl -D /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 -l /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1/log/startup.log -w -t 600 -o " -p 7000 -c gp_role=utility" start can successfully create a singlenode deployment. but the recommended approach is still to use gpinitsystem --singlenodeMode to start one coordinator and one coordinator standby.

can we change default datadirs/qddir to make singlenode dir ?

we can arbitrarily change dir of the coordinator and the coordinator standby. when using gpinitsystem, env COORDINATOR_DATADIR can be set, and when using pg_ctl, just change -D argument.

COORDINATOR_DATADIR can only change datadirs, but I want to rename qddir to singlenode dir.

@Ray-Eldath
Copy link
Contributor Author

Ray-Eldath commented Nov 2, 2023

how to install single node with rpm package ? think about install like pg style: initdb, then pg_ctl start @Ray-Eldath

I've tried with proper postmaster.conf using env GPSESSID=0000000000 GPERA=f6a2f666f34494b3_230907184019 $GPHOME/bin/pg_ctl -D /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/standby -l /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/standby/log/startup.log -w -t 600 -o " -p 7001" start and env GPSESSID=0000000000 GPERA=f6a2f666f34494b3_230907184019 $GPHOME/bin/pg_ctl -D /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1 -l /home/gpadmin/cbdb/gpAux/gpdemo/datadirs/qddir/demoDataDir-1/log/startup.log -w -t 600 -o " -p 7000 -c gp_role=utility" start can successfully create a singlenode deployment. but the recommended approach is still to use gpinitsystem --singlenodeMode to start one coordinator and one coordinator standby.

can we change default datadirs/qddir to make singlenode dir ?

we can arbitrarily change dir of the coordinator and the coordinator standby. when using gpinitsystem, env COORDINATOR_DATADIR can be set, and when using pg_ctl, just change -D argument.

COORDINATOR_DATADIR can only change datadirs, but I want to rename qddir to singlenode dir.

gpinitsystem accepts a clusterConfigFile where you can arbitrarily set COORDINATOR_DIRECTORY and DATA_DIRECTORY to put cluster data anywhere you want. this file (and the paths) is generated by demo_cluster.sh.

If we want singlenode deployment to have gpAux/gpdemo/datadirs/singlenodedir instead of gpAux/gpdemo/datadirs/qddir, we need to take care of this in demo_cluster.sh. Is this what you want? I think it's actually a great idea.

@yjhjstz
Copy link
Collaborator

yjhjstz commented Nov 2, 2023

gpinitsystem accepts a clusterConfigFile where you can arbitrarily set COORDINATOR_DIRECTORY and DATA_DIRECTORY to put cluster data anywhere you want. this file (and the paths) is generated by demo_cluster.sh.

If we want singlenode deployment to have gpAux/gpdemo/datadirs/singlenodedir instead of gpAux/gpdemo/datadirs/qddir, we need to take care of this in demo_cluster.sh. Is this what you want? I think it's actually a great idea.

yes, make different dir.

@Ray-Eldath Ray-Eldath force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch 2 times, most recently from 229bcab to 2f8bdf3 Compare November 2, 2023 08:56
@Ray-Eldath
Copy link
Contributor Author

Ray-Eldath commented Nov 2, 2023

yes, make different dir.

fixed in

QDDIR=$DATADIRS/singlenodedir

@Ray-Eldath Ray-Eldath force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch 3 times, most recently from 4fbc2ba to 4534e4c Compare November 6, 2023 02:36
tglsfdc and others added 5 commits November 8, 2023 10:55
check_agg_arguments_walker() supposed that it needn't descend into
the arguments of a lower-level aggregate function, but this is
just wrong in the presence of multiple levels of sub-select.  The
oversight would lead to executor failures on queries that should
be rejected.  (Prior to v11, they actually were rejected, thanks
to a "redundant" execution-time check.)

Per bug #17835 from Anban Company.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/17835-4f29f3098b2d0ba4@postgresql.org
Commit 3e310d837 taught isAssignmentIndirectionExpr() to look through
CoerceToDomain nodes.  That's not sufficient, because since commit
04fe805 it's been possible for the planner to simplify
CoerceToDomain to RelabelType when the domain has no constraints
to enforce.  So we need to look through RelabelType too.

Per bug #17897 from Alexander Lakhin.  Although 3e310d837 was
back-patched to v11, it seems sufficient to apply this change
to v12 and later, since 04fe805 came in in v12.

Dmitry Dolgov

Discussion: https://postgr.es/m/17897-4216c546c3874044@postgresql.org
This commit is a squash of the following commits:
- Fix all isolation2_schedule cases in single node mode
- Pass all the selected isolation2_schedule tests in single node mode.
- Copy tests from test/isolation2 for isolation2 schedule in single-node.
- Fix all greenplum_schedule tests diffs in single node mode.
- Fix all parallel_schedule tests diff in single node mode
- Fix test singlenode_regress/xml (only failed on CI)
Since CBDB isn't fully compatible with Postgres, many features and
grammars have been dependent upon. In a scenario where only one node is
needed but CBDB is already relied by business logic, a singlenode mode
can be used. Utility mode is different from singlenode because it still
requires segments be created, it just connects to one of them in a
special mode designated by PGOPTIONS. On the contrary, singlenode mode is
fully supported by all deploying scripts, user can create a running node
that have no segment and directly connect to it as if it were a normal
cluster. Plus, there're some functionalities that aren't enabled in
utility mode but should be in singlenode.

This new mode is supported by adding a new GUC gp_internal_is_singlenode.
We've settled to leverage the already-written code to support
GP_ROLE_UTILITY by running singlenode deployment in GP_ROLE_UTILITY.
This way seems leads to the minimum code change. There're several places
where special care are needed: code that should run only under
normal utility mode but not in singlenode are taken care of by
IS_UTILITY_BUT_NOT_SINGLENODE() macro, and, conversely, code that should
only run in singlenode are handled by
Gp_role == GP_ROLE_DISPATCH || IS_SINGLENODE(). For the remaining code
changes, they're all caused by several global replacements.

Scripts has been changed to support singlenode deployment. When creating
demo cluster, use NUM_PRIMARY_MIRROR_PAIRS=0 to create singlenode
deployment. It'll write the GUC in postgresql.conf and only start QD and
one standby. gpstart and gpstop behaves normally because singlenode mode
is controlled by a GUC that only initialized in gpinitsystem. We
delibrately pick a long name because we don't want user to accidentally
change this after cluster initialization.

See: Discussion#188 <https://github.com/orgs/cloudberrydb/discussions/188>
This PR adds a new GitHub Actions job, ic-singlenode-test, to build
workflow. It has been verified that the build procedure and log
uploading both work as expected.
@avamingli avamingli force-pushed the feat/feat-singlenode/utility-fix-plan-1 branch from 4534e4c to a3c6f7e Compare November 8, 2023 02:55
@avamingli avamingli merged commit 6658030 into cloudberrydb:main Nov 8, 2023
8 of 9 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
6 participants