From 6dea9cdeeee9dae5cd976daae07d622d57eedc42 Mon Sep 17 00:00:00 2001 From: luqichao Date: Sun, 15 Sep 2024 18:29:59 +0800 Subject: [PATCH 1/2] valid most_available_sync when uwal on --- .../backend/utils/misc/guc/guc_storage.cpp | 16 +++++++++++++++- src/gausskernel/storage/gs_uwal/gs_uwal.cpp | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/common/backend/utils/misc/guc/guc_storage.cpp b/src/common/backend/utils/misc/guc/guc_storage.cpp index d88ef70ff9..3b1d54823c 100755 --- a/src/common/backend/utils/misc/guc/guc_storage.cpp +++ b/src/common/backend/utils/misc/guc/guc_storage.cpp @@ -214,6 +214,8 @@ static bool check_and_assign_namespace_oids(List* elemlist); static bool check_and_assign_general_oids(List* elemlist); static int GetLengthAndCheckReplConn(const char* ConnInfoList); +static bool check_most_available_sync_param(bool* newval, void** extra, GucSource source); + static bool check_ss_interconnect_url(char **newval, void **extra, GucSource source); static bool check_ss_ock_log_path(char **newval, void **extra, GucSource source); static bool check_ss_interconnect_type(char **newval, void **extra, GucSource source); @@ -811,7 +813,7 @@ static void InitStorageConfigureNamesBool() }, &u_sess->attr.attr_storage.guc_most_available_sync, false, - NULL, + check_most_available_sync_param, NULL, NULL}, {{"enable_show_any_tuples", @@ -6582,6 +6584,18 @@ static int GetLengthAndCheckReplConn(const char* ConnInfoList) return repl_len; } +static bool check_most_available_sync_param(bool* newval, void** extra, GucSource source) +{ + if (source == PGC_S_DEFAULT) { + return true; + } + if (*newval && g_instance.attr.attr_storage.enable_uwal) { + ereport(ERROR, (errmsg("Do not allow both enable uwal and most_available_sync"))); + return false; + } + return true; +} + static bool check_ss_interconnect_type(char **newval, void **extra, GucSource source) { return (strcmp("TCP", *newval) == 0 || strcmp("RDMA", *newval) == 0); diff --git a/src/gausskernel/storage/gs_uwal/gs_uwal.cpp b/src/gausskernel/storage/gs_uwal/gs_uwal.cpp index c027df8af2..73d8b66327 100644 --- a/src/gausskernel/storage/gs_uwal/gs_uwal.cpp +++ b/src/gausskernel/storage/gs_uwal/gs_uwal.cpp @@ -448,6 +448,11 @@ int GsUwalInit(ServerMode serverMode) } } + if ((volatile bool)u_sess->attr.attr_storage.guc_most_available_sync) { + ereport(ERROR, (errmsg("uwal only support most_available_sync is 'off'"))); + return ret; + } + if (GsUwalLoadSymbols() != 0) { ereport(ERROR, (errmsg("failed to dlopen libuwal.so"))); return ret; -- Gitee From adaf2d55007f942386ba88e5095587fee3ead5ae Mon Sep 17 00:00:00 2001 From: luqichao Date: Sun, 22 Sep 2024 16:28:28 +0800 Subject: [PATCH 2/2] add validate for uwal --- src/common/backend/utils/misc/guc/guc_storage.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/common/backend/utils/misc/guc/guc_storage.cpp b/src/common/backend/utils/misc/guc/guc_storage.cpp index 3b1d54823c..7640322df2 100755 --- a/src/common/backend/utils/misc/guc/guc_storage.cpp +++ b/src/common/backend/utils/misc/guc/guc_storage.cpp @@ -279,6 +279,7 @@ static bool check_logical_decode_options_default(char** newval, void** extra, Gu static void assign_logical_decode_options_default(const char* newval, void* extra); static bool check_uwal_devices_path(char** newval, void** extra, GucSource source); static bool check_uwal_log_path(char** newval, void** extra, GucSource source); +static bool check_enable_uwal(bool* newval, void** extra, GucSource source); static void assign_recovery_parallelism(int newval, void* extra); static const struct config_enum_entry resource_track_log_options[] = { @@ -1382,7 +1383,7 @@ static void InitStorageConfigureNamesBool() NULL}, &g_instance.attr.attr_storage.enable_uwal, false, - NULL, + check_enable_uwal, NULL, NULL}, {{"uwal_rpc_compression_switch", @@ -7153,6 +7154,18 @@ static bool check_uwal_log_path(char **newval, void **extra, GucSource source) return true; } +static bool check_enable_uwal(bool* newval, void** extra, GucSource source) +{ + if (source == PGC_S_DEFAULT) { + return true; + } + if (*newval && u_sess->attr.attr_storage.guc_most_available_sync) { + ereport(ERROR, (errmsg("Do not allow both enable uwal and most_available_sync"))); + return false; + } + return true; +} + static bool check_ss_work_thread_pool_attr(char** newval, void** extra, GucSource source) { if (newval == NULL || *newval == NULL || **newval == '\0') { -- Gitee