From 13c45bcfe0ec22d49d5cef5dfece910bcfdc91cd Mon Sep 17 00:00:00 2001 From: chenxiaobin19 <1025221611@qq.com> Date: Wed, 23 Aug 2023 16:05:46 +0800 Subject: [PATCH] copy upgrade script of dolphin from old appPath to new one --- script/impl/upgrade/UpgradeImpl.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/script/impl/upgrade/UpgradeImpl.py b/script/impl/upgrade/UpgradeImpl.py index 18d7887..9f49117 100644 --- a/script/impl/upgrade/UpgradeImpl.py +++ b/script/impl/upgrade/UpgradeImpl.py @@ -1529,6 +1529,9 @@ class UpgradeImpl: # prepared in the preinstall self.installNewBin() + # copy dolphin upgrade script from old appPath to new one + self.cpDolphinUpgradeScript() + # decompress the catalog upgrade_sql.tar.gz to temp dir, # include upgrade sql file and guc set self.prepareUpgradeSqlFolder() @@ -6763,6 +6766,23 @@ class UpgradeImpl: self.context.logger.debug("Failed to install new binary files.") raise Exception(str(e)) + def cpDolphinUpgradeScript(self): + """ + function: copy upgrade script of dolphin from old appPath to new one + input: none + output: none + """ + self.context.logger.debug("Start to copy dolphin upgrade script.") + + try: + cmd = "if ls %s/share/postgresql/extension/ | grep -qE \"dolphin--(.*)--(.*)sql\" ; " \ + "then cp -f %s/share/postgresql/extension/dolphin--*--*sql %s/share/postgresql/extension/; fi" % \ + (self.context.oldClusterAppPath, self.context.oldClusterAppPath, self.context.newClusterAppPath) + CmdExecutor.execCommandLocally(cmd) + self.context.logger.debug("Successfully copy dolphin upgrade script.") + except Exception as e: + raise Exception("Failed to copy dolphin upgrade script.") + def backupHotpatch(self): """ function: backup hotpatch config file patch.info in xxx/data/hotpatch