From d7fad1a99136bf28c936beab27b838e83f51380f Mon Sep 17 00:00:00 2001 From: hejiahuan11 Date: Tue, 25 Feb 2025 10:46:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=20=E5=8D=87=E7=BA=A7=E6=9C=AA=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=97=B6=E7=9A=84=E5=BD=92=E6=A1=A3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin/gs_guc/pg_guc.cpp | 11 +++++++++++ src/common/backend/utils/init/globals.cpp | 2 +- src/gausskernel/process/postmaster/pgarch.cpp | 6 ++++++ src/gausskernel/process/postmaster/postmaster.cpp | 8 ++++++++ src/include/miscadmin.h | 1 + 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/bin/gs_guc/pg_guc.cpp b/src/bin/gs_guc/pg_guc.cpp index 4174952d63..860be3bed2 100644 --- a/src/bin/gs_guc/pg_guc.cpp +++ b/src/bin/gs_guc/pg_guc.cpp @@ -1349,6 +1349,17 @@ do_gucset(const char *action_type, const char *data_dir) return FAILURE; } + if (strncmp(ss_enable_dss, "on", strlen("on")) == 0 && + ((strncmp(config_param[i], "archive_mode", strlen("archive_mode")) == 0 && + strncmp(config_value[i], "on", strlen("on")) == 0) || + (strncmp(config_param[i], "archive_command", strlen("archive_command")) == 0 && + config_value[i] != NULL))) { + release_file_lock(&filelock); + freefile(opt_lines); + GS_FREE(tmpAZStr); + write_stderr(_("%s: Not support archive function while DMS and DSS enabled\n"), progname); + return FAILURE; + } // only when the parameter is synchronous_standby_names, this branch can be reached. if (g_need_changed && 0 == strncmp(config_param[i], "synchronous_standby_names", strlen(config_param[i]) > strlen("synchronous_standby_names") ? strlen(config_param[i]) : strlen("synchronous_standby_names"))) { diff --git a/src/common/backend/utils/init/globals.cpp b/src/common/backend/utils/init/globals.cpp index c37683e8ca..5efe13b5e9 100644 --- a/src/common/backend/utils/init/globals.cpp +++ b/src/common/backend/utils/init/globals.cpp @@ -240,7 +240,7 @@ const uint32 PARTIALPUSH_VERSION_NUM = 92087; const uint32 CURSOR_EXPRESSION_VERSION_NUMBER = 92935; const uint32 FLOAT_VERSION_NUMBER = 92938; - +const uint32 SS_ARCHIVE_VERSION_NUM = 93039; const uint32 PAGE_BASED_VERSION_NUM = 93039; /* This variable indicates wheather the instance is in progress of upgrade as a whole */ diff --git a/src/gausskernel/process/postmaster/pgarch.cpp b/src/gausskernel/process/postmaster/pgarch.cpp index f2a51255f4..ddd30e7ed5 100755 --- a/src/gausskernel/process/postmaster/pgarch.cpp +++ b/src/gausskernel/process/postmaster/pgarch.cpp @@ -197,6 +197,12 @@ ThreadId pgarch_start() */ NON_EXEC_STATIC void PgArchiverMain(knl_thread_arg* arg) { + /* + * Archive functions are not supported before 700 online while DMS and DSS enabled. + */ + if (ENABLE_DSS && (t_thrd.proc->workingVersionNum < SS_ARCHIVE_VERSION_NUM)) { + ereport(ERROR, (errmsg("archive functions are not supported before 700 online while DMS and DSS enabled"))); + } IsUnderPostmaster = true; /* we are a postmaster subprocess now */ t_thrd.proc_cxt.MyProcPid = gs_thread_self(); /* reset t_thrd.proc_cxt.MyProcPid */ diff --git a/src/gausskernel/process/postmaster/postmaster.cpp b/src/gausskernel/process/postmaster/postmaster.cpp index 92c62ef305..f57ae055ad 100644 --- a/src/gausskernel/process/postmaster/postmaster.cpp +++ b/src/gausskernel/process/postmaster/postmaster.cpp @@ -3644,6 +3644,14 @@ static void CheckGUCConflicts(void) errmsg( "WAL archival (archive_mode=on) requires wal_level \"archive\", \"hot_standby\" or \"logical\""))); + if (ENABLE_DSS && (t_thrd.proc->workingVersionNum < SS_ARCHIVE_VERSION_NUM)) { + if (u_sess->attr.attr_common.XLogArchiveMode || strlen(u_sess->attr.attr_storage.XLogArchiveCommand) != 0) { + ereport(ERROR, + (errcode(ERRCODE_SYSTEM_ERROR), + errmsg("Archive functions are not supported before 700 online while DMS and DSS enabled\n"))); + } + } + if (g_instance.attr.attr_storage.max_wal_senders > 0 && g_instance.attr.attr_storage.wal_level == WAL_LEVEL_MINIMAL) ereport(ERROR, (errcode(ERRCODE_SYSTEM_ERROR), diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 80ac64e525..d6db328294 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -170,6 +170,7 @@ extern const uint32 CAST_FUNC_VERSION_NUMBER; extern const uint32 HASH_SAOP_VERSION_NUMBER; extern const uint32 ASOFJOIN_VERSION_NUM; extern const uint32 PAGE_BASED_VERSION_NUM; +extern const uint32 SS_ARCHIVE_VERSION_NUM; extern void register_backend_version(uint32 backend_version); extern bool contain_backend_version(uint32 version_number); -- Gitee From 0989118d68d08b83577753bf1cd7d621adf67a55 Mon Sep 17 00:00:00 2001 From: hejiahuan11 Date: Tue, 25 Feb 2025 16:53:02 +0800 Subject: [PATCH 2/2] x --- src/bin/gs_guc/pg_guc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/gs_guc/pg_guc.cpp b/src/bin/gs_guc/pg_guc.cpp index 860be3bed2..0dc67a0118 100644 --- a/src/bin/gs_guc/pg_guc.cpp +++ b/src/bin/gs_guc/pg_guc.cpp @@ -1350,6 +1350,7 @@ do_gucset(const char *action_type, const char *data_dir) } if (strncmp(ss_enable_dss, "on", strlen("on")) == 0 && + (t_thrd.proc->workingVersionNum < SS_ARCHIVE_VERSION_NUM) && ((strncmp(config_param[i], "archive_mode", strlen("archive_mode")) == 0 && strncmp(config_value[i], "on", strlen("on")) == 0) || (strncmp(config_param[i], "archive_command", strlen("archive_command")) == 0 && @@ -1357,9 +1358,10 @@ do_gucset(const char *action_type, const char *data_dir) release_file_lock(&filelock); freefile(opt_lines); GS_FREE(tmpAZStr); - write_stderr(_("%s: Not support archive function while DMS and DSS enabled\n"), progname); + write_stderr(_("%s: Not support archive function before 700 online while DMS and DSS enabled\n"), progname); return FAILURE; } + // only when the parameter is synchronous_standby_names, this branch can be reached. if (g_need_changed && 0 == strncmp(config_param[i], "synchronous_standby_names", strlen(config_param[i]) > strlen("synchronous_standby_names") ? strlen(config_param[i]) : strlen("synchronous_standby_names"))) { -- Gitee