You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by yj...@apache.org on 2025/01/02 03:12:39 UTC
(cloudberry) 31/41: Refactor to extract SET_VAR to gp_bash_functions.sh
This is an automated email from the ASF dual-hosted git repository.
yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 0f9ea5e85f451e96e6af9bb43c7df0634e3e2ac2
Author: Junwang Zhao <zh...@gmail.com>
AuthorDate: Fri Nov 4 14:43:57 2022 -0700
Refactor to extract SET_VAR to gp_bash_functions.sh
The `SET_VAR` function is indentical in gpcreateseg.sh and
gpinitsystem, since they both source the file gp_bash_functions.sh
Moving SET_VAR in gp_bash_functions.sh
---
gpMgmt/bin/gpinitsystem | 23 -----------------------
gpMgmt/bin/lib/gp_bash_functions.sh | 23 +++++++++++++++++++++++
gpMgmt/bin/lib/gpcreateseg.sh | 23 -----------------------
3 files changed, 23 insertions(+), 46 deletions(-)
diff --git a/gpMgmt/bin/gpinitsystem b/gpMgmt/bin/gpinitsystem
index e59bab05ce..f8d3bd37f8 100755
--- a/gpMgmt/bin/gpinitsystem
+++ b/gpMgmt/bin/gpinitsystem
@@ -1203,29 +1203,6 @@ DISPLAY_CONFIG () {
LOG_MSG "[INFO]:-End Function $FUNCNAME"
}
-SET_VAR () {
- #
- # MPP-13617: If segment contains a ~, we assume ~ is the field delimiter.
- # Otherwise we assume : is the delimiter. This allows us to easily
- # handle IPv6 addresses which may contain a : by using a ~ as a delimiter.
- #
- I=$1
- case $I in
- *~*)
- S="~"
- ;;
- *)
- S=":"
- ;;
- esac
- GP_HOSTNAME=`$ECHO $I|$CUT -d$S -f1`
- GP_HOSTADDRESS=`$ECHO $I|$CUT -d$S -f2`
- GP_PORT=`$ECHO $I|$CUT -d$S -f3`
- GP_DIR=`$ECHO $I|$CUT -d$S -f4`
- GP_DBID=`$ECHO $I|$CUT -d$S -f5`
- GP_CONTENT=`$ECHO $I|$CUT -d$S -f6`
-}
-
# Retrieve locale settings from the coordinator and set locale variables
# appropriately so those values can be used when initializing the segments.
SET_LOCALE_VARS_BASED_ON_COORDINATOR() {
diff --git a/gpMgmt/bin/lib/gp_bash_functions.sh b/gpMgmt/bin/lib/gp_bash_functions.sh
index 528ec9ae29..6c97005e84 100755
--- a/gpMgmt/bin/lib/gp_bash_functions.sh
+++ b/gpMgmt/bin/lib/gp_bash_functions.sh
@@ -1328,6 +1328,29 @@ CHECK_FTS () {
return $ret
}
+SET_VAR () {
+ #
+ # MPP-13617: If segment contains a ~, we assume ~ is the field delimiter.
+ # Otherwise we assume : is the delimiter. This allows us to easily
+ # handle IPv6 addresses which may contain a : by using a ~ as a delimiter.
+ #
+ I=$1
+ case $I in
+ *~*)
+ S="~"
+ ;;
+ *)
+ S=":"
+ ;;
+ esac
+ GP_HOSTNAME=`$ECHO $I|$CUT -d$S -f1`
+ GP_HOSTADDRESS=`$ECHO $I|$CUT -d$S -f2`
+ GP_PORT=`$ECHO $I|$CUT -d$S -f3`
+ GP_DIR=`$ECHO $I|$CUT -d$S -f4`
+ GP_DBID=`$ECHO $I|$CUT -d$S -f5`
+ GP_CONTENT=`$ECHO $I|$CUT -d$S -f6`
+}
+
#******************************************************************************
# Main Section
#******************************************************************************
diff --git a/gpMgmt/bin/lib/gpcreateseg.sh b/gpMgmt/bin/lib/gpcreateseg.sh
index b616f1bc57..2dfa970d86 100755
--- a/gpMgmt/bin/lib/gpcreateseg.sh
+++ b/gpMgmt/bin/lib/gpcreateseg.sh
@@ -68,29 +68,6 @@ CHK_CALL () {
fi
}
-SET_VAR () {
- #
- # MPP-13617: If segment contains a ~, we assume ~ is the field delimiter.
- # Otherwise we assume : is the delimiter. This allows us to easily
- # handle IPv6 addresses which may contain a : by using a ~ as a delimiter.
- #
- I=$1
- case $I in
- *~*)
- S="~"
- ;;
- *)
- S=":"
- ;;
- esac
- GP_HOSTNAME=`$ECHO $I|$CUT -d$S -f1`
- GP_HOSTADDRESS=`$ECHO $I|$CUT -d$S -f2`
- GP_PORT=`$ECHO $I|$CUT -d$S -f3`
- GP_DIR=`$ECHO $I|$CUT -d$S -f4`
- GP_DBID=`$ECHO $I|$CUT -d$S -f5`
- GP_CONTENT=`$ECHO $I|$CUT -d$S -f6`
-}
-
PARA_EXIT () {
if [ $1 -ne 0 ];then
$ECHO "FAILED:$SEGMENT_TO_CREATE" >> $PARALLEL_STATUS_FILE
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org