fix expansion failed problems

This commit is contained in:
zhang_xubo
2022-03-14 19:43:31 +08:00
parent e148212355
commit 0f6fc9a86c
3 changed files with 21 additions and 15 deletions

View File

@ -553,12 +553,9 @@ class ExpansionClusterInfo(dbClusterInfo):
self.compare_list(a_dict.get(a_key), b_dict.get(a_key))
self._remove_normal_msg(a_key)
elif isinstance(a_dict.get(a_key), str):
if a_key not in IGNORE_CHECK_KEY:
self.compare_string(a_dict.get(a_key), b_dict.get(a_key))
self._remove_normal_msg(a_key)
pass
elif isinstance(a_dict.get(a_key), int):
self.compare_int(a_dict.get(a_key), b_dict.get(a_key))
self._remove_normal_msg(a_key)
pass
else:
raise Exception("Not support type. key is {0} , "
"static value is {1}, XML value is {2}, "

View File

@ -28,7 +28,7 @@ import grp
sys.path.append(sys.path[0] + "/../../")
from gspylib.common.ErrorCode import ErrorCode
from gspylib.common.VersionInfo import VersionInfo
from domain_utils.cluster_file.version_info import VersionInfo
from gspylib.os.gsplatform import g_Platform, findCmdInPath
from gspylib.os.gsfile import g_file

View File

@ -177,7 +177,7 @@ class ExpansionImpl():
GaussLog.exitWithError("Package [%s] is not found." % file)
sshTool.scpFiles(file, srcFile, [host])
sshTool.executeCommand("cd %s;tar -xf %s" % (srcFile, pkgfiles[0]),
"", DefaultValue.SUCCESS, [host])
DefaultValue.SUCCESS, [host])
self.cleanSshToolFile(sshTool)
self.logger.log("End to send soft to each standby nodes.")
@ -373,7 +373,7 @@ class ExpansionImpl():
self.getIncreaseAppNames(len(standbyHosts))):
if not self.expansionSuccess[newHost]:
continue
log_path = DefaultValue.getUserLogDirWithUser(self.user)
log_path = ClusterDir.getUserLogDirWithUser(self.user)
log_dir = "%s/pg_log/dn_%d" % (log_path, appName)
audit_dir = "%s/pg_audit/dn_%d" % (log_path, appName)
installCmd = "source {envFile} ; gs_install -X {xmlFile}" \
@ -463,12 +463,12 @@ class ExpansionImpl():
if not EnvUtil.getEnv("MPPDB_ENV_SEPARATE_PATH"):
preinstallCmd = "{softPath}/script/gs_preinstall -U {user} -G {group} "\
"-X {xmlFile} --non-interactive 2>&1".format(
"-X {xmlFile} --non-interactive --skip-hostname-set 2>&1".format(
softPath = self.context.packagepath, user = self.user,
group = self.group, xmlFile = tempXmlFile)
else:
preinstallCmd = "{softPath}/script/gs_preinstall -U {user} -G {group} " \
"-X {xmlFile} --sep-env-file={envFile} " \
"-X {xmlFile} --sep-env-file={envFile} --skip-hostname-set " \
"--non-interactive 2>&1".format(softPath = self.context.packagepath,
user = self.user,
group = self.group,
@ -935,9 +935,8 @@ gs_guc set -D {dn} -c "available_zone='{azName}'"
srcFile = staticConfigPath
if not os.path.exists(srcFile):
GaussLog.exitWithError(ErrorCode.GAUSS_357["GAUSS_35710"] % srcFile)
hostSsh = SshTool([hostName])
targetFile = "%s/bin/cluster_static_config" % appPath
hostSsh.scpFiles(srcFile, targetFile, [hostName], self.envFile)
# if dynamic config file exists on primary node, refreshconf on each host.
# if not, remove it on standby nodes if exists.
dynamic_opt_cmd = ""
@ -946,8 +945,18 @@ gs_guc set -D {dn} -c "available_zone='{azName}'"
else:
dynamic_opt_cmd = "if [ -f '%s' ];then rm %s;fi" % \
(dynamic_file, dynamic_file)
if hostName != socket.gethostname():
hostSsh = SshTool([hostName])
hostSsh.scpFiles(srcFile, targetFile, [hostName], self.envFile)
hostSsh.getSshStatusOutput(dynamic_opt_cmd, [hostName], self.envFile)
self.cleanSshToolFile(hostSsh)
else:
scpcmd = "cp %s %s" % (srcFile, targetFile)
(status, output) = subprocess.getstatusoutput(scpcmd)
if status != 0:
GaussLog.exitWithError("Copy file faild. %s" % output)
self.logger.log("End to generate and send cluster static file.\n")
if DefaultValue.get_cm_server_num_from_static(self.context.clusterInfo) > 0:
self.logger.debug("Check new host state after restart.")