Skip to content

Commit

Permalink
Fix gpinitsystem (#490)
Browse files Browse the repository at this point in the history
* Fix gpinitsystem
   check if is is_external_fts in some places
* Remove guc gp_cbdb_deploy
  • Loading branch information
fanfuxiaoran authored Jul 8, 2024
1 parent c87fc6d commit 4a0af58
Show file tree
Hide file tree
Showing 13 changed files with 3 additions and 38 deletions.
1 change: 0 additions & 1 deletion gpMgmt/bin/gpaddmirrors
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ from gppylib.programs.clsAddMirrors import *

#-------------------------------------------------------------------------
if __name__ == '__main__':
check_deployment_mode('gpaddmirrors')
simple_main( GpAddMirrorsProgram.createParser, GpAddMirrorsProgram.createProgram)
11 changes: 0 additions & 11 deletions gpMgmt/bin/gpinitsystem
Original file line number Diff line number Diff line change
Expand Up @@ -2093,20 +2093,9 @@ CREATE_FTS() {
fi
}

CHECK_DEPLOYMENT_MODE() {
if [[ -n "${COORDINATOR_DIRECTORY}/${SEG_PREFIX}-1" && -f ${COORDINATOR_DIRECTORY}/${SEG_PREFIX}-1/postgresql.conf ]]; then
gp_cbdb_deploy=`grep gp_cbdb_deploy ${COORDINATOR_DIRECTORY}/${SEG_PREFIX}-1/postgresql.conf | awk -F= '{print $1}'`
deployment_mode=`grep gp_cbdb_deploy ${COORDINATOR_DIRECTORY}/${SEG_PREFIX}-1/postgresql.conf | awk -F= '{print $2}'`
if [[ ${gp_cbdb_deploy:0:1} != '#' && $deployment_mode == "'cloud'" ]]; then
ERROR_EXIT "[FATAL]:gpinitsystem is disabled in cloud mode."
fi
fi
}

#******************************************************************************
# Main Section
#******************************************************************************
CHECK_DEPLOYMENT_MODE
trap 'ERROR_EXIT "[FATAL]:-Received INT or TERM signal"' INT TERM
while getopts ":vaqe:c:l:-:p:m:h:n:s:P:S:b:DB:I:O:E:F:M:U:T:C" opt
do
Expand Down
3 changes: 1 addition & 2 deletions gpMgmt/bin/gpmovemirrors
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Copyright (c) EMC Inc 2010. All Rights Reserved.
#
from gppylib.mainUtils import SimpleMainLock, ExceptionNoStackTraceNeeded, check_deployment_mode
from gppylib.mainUtils import SimpleMainLock, ExceptionNoStackTraceNeeded

import os
import sys
Expand Down Expand Up @@ -55,7 +55,6 @@ The input file should be a plain text file with the format:
An input file must be specified.
""",
]
check_deployment_mode('gpmovemirrors')


# ----------------------- Command line option parser ----------------------
Expand Down
4 changes: 0 additions & 4 deletions gpMgmt/bin/gppylib/mainUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,6 @@ def parseStatusLine(line, isStart = False, isStop = False):
reasonStr = ":".join(reasonArr)
return reasonCode, reasonStr, started, dir

def check_deployment_mode(program_name):
deploymentMode = subprocess.check_output("gpconfig -s gp_cbdb_deploy | grep 'Coordinator value'| awk '{print $3}'", shell=True).decode().strip()
if deploymentMode == "cloud":
raise gp.GpError("%s is not supported in cloud deployment mode" % program_name)

def check_fts(fts):
fts_check_cmd= "ps -ef | awk '{print \$2, \$8}' | grep gpfts | grep -v grep"
Expand Down
3 changes: 1 addition & 2 deletions gpMgmt/bin/gprecoverseg
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ if mirroring is configured and operational.
# THIS IMPORT MUST COME FIRST
#
# import mainUtils FIRST to get python version check
from gppylib.mainUtils import simple_main, check_deployment_mode
from gppylib.mainUtils import simple_main
from gppylib.programs.clsRecoverSegment import GpRecoverSegmentProgram

if __name__ == '__main__':
check_deployment_mode('gprecoverseg')
simple_main(GpRecoverSegmentProgram.createParser,
GpRecoverSegmentProgram.createProgram,
GpRecoverSegmentProgram.mainOptions())
1 change: 0 additions & 1 deletion gpMgmt/bin/gpstart
Original file line number Diff line number Diff line change
Expand Up @@ -927,5 +927,4 @@ class GpStart:


if __name__ == '__main__':
check_deployment_mode('gpstart')
simple_main(GpStart.createParser, GpStart.createProgram)
2 changes: 0 additions & 2 deletions gpMgmt/bin/gpstop
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,4 @@ class GpStop:
is_external_fts=external_fts)

if __name__ == '__main__':
if len(sys.argv) != 2 or sys.argv[1] != "-u":
check_deployment_mode("gpstop")
simple_main(GpStop.createParser, GpStop.createProgram)
2 changes: 1 addition & 1 deletion gpMgmt/bin/lib/gp_bash_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ BUILD_COORDINATOR_PG_HBA_FILE () {
$ECHO "host replication $USER_NAME $STANDBY_HOSTNAME trust" >> ${GP_DIR}/$PG_HBA
fi
fi
if [ "$CLUSTER_BOOT_MODE" = "PRODUCTION" ];then
if [ "$CLUSTER_BOOT_MODE" = "PRODUCTION" ] && [ $USE_EXTERNAL_FTS -ne 0 ];then
for fts in ${FTS_HOST_MACHINE_LIST[*]}
do
if [ ! "$FTS_HOST" = "$COORDINATOR_HOSTNAME" ];then
Expand Down
1 change: 0 additions & 1 deletion src/backend/cdb/cdbutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -2142,7 +2142,6 @@ char *gp_etcd_account_id = NULL;
char *gp_etcd_cluster_id = NULL;
char *gp_etcd_namespace = NULL;
char *gp_etcd_endpoints = NULL;
char *gp_cbdb_deploy = NULL;

static etcdlib_endpoint_t etcd_endpoints[GP_ETCD_ENDPOINTS_NUM] = {0};
static int etcd_endpoints_num = 0;
Expand Down
10 changes: 0 additions & 10 deletions src/backend/utils/misc/guc_gp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4726,16 +4726,6 @@ struct config_string ConfigureNamesString_gp[] =
"localhost:2379",
NULL, NULL, NULL
},
{
{"gp_cbdb_deploy", PGC_BACKEND, CUSTOM_OPTIONS,
gettext_noop("CBDB deploy environment setup."),
gettext_noop("This indicates the cbdb is deployed with onpromise or cloud environment. Default is onpromise"),
GUC_SUPERUSER_ONLY
},
&gp_cbdb_deploy,
"onpromise",
NULL, NULL, NULL
},
#endif
#ifdef ENABLE_IC_PROXY
{
Expand Down
1 change: 0 additions & 1 deletion src/include/cdb/cdbutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ extern char *gp_etcd_account_id;
extern char *gp_etcd_cluster_id;
extern char *gp_etcd_namespace;
extern char *gp_etcd_endpoints;
extern char *gp_cbdb_deploy;

typedef struct GpSegConfigEntryForUDF
{
Expand Down
1 change: 0 additions & 1 deletion src/include/common/etcdutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#define GP_ETCD_ACCOUNT_ID_DEFAULT "00000000-0000-0000-0000-000000000000"
#define GP_ETCD_CLUSTER_ID_DEFAULT "00000000-0000-0000-0000-000000000000"
#define GP_ETCD_ENDPOINTS_DEFAULT "localhost:2379"
#define GP_CBDB_DEPLOY "onpromise"

typedef struct etcdlib_endpoint {
char *etcd_host;
Expand Down
1 change: 0 additions & 1 deletion src/include/utils/unsync_guc_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
"gp_etcd_cluster_id",
"gp_etcd_namespace",
"gp_etcd_endpoints",
"gp_cbdb_deploy",
#endif
"gp_force_random_redistribution",
"gp_gang_creation_retry_count",
Expand Down

0 comments on commit 4a0af58

Please sign in to comment.