From 6342516e607f123c872627f1df74809cab13621e Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:17:28 +0000 Subject: [PATCH 01/16] update BUILD.bazel. Signed-off-by: mayuehit --- BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.bazel b/BUILD.bazel index ad73528..ad9d6fa 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -94,6 +94,7 @@ cc_library( "@msgpack", "@nlohmann_json", "@securec", + "@com_googlesource_code_re2//:re2", ], alwayslink = True, ) -- Gitee From c10585b7f20c79c889756461e73ea6fc687f2f10 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:18:11 +0000 Subject: [PATCH 02/16] update bazel/preload_grpc.bzl. Signed-off-by: mayuehit --- bazel/preload_grpc.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bazel/preload_grpc.bzl b/bazel/preload_grpc.bzl index 0cd85de..9525492 100644 --- a/bazel/preload_grpc.bzl +++ b/bazel/preload_grpc.bzl @@ -67,9 +67,9 @@ def preload_grpc(): http_archive( name = "com_googlesource_code_re2", - url = "https://gitee.com/mirrors/re2/repository/archive/2024-07-02.zip", - sha256 = "20f5af5320da5a704125eaec5965ddc0cfa86fb420575a9f9f04c5cef905ba93", - strip_prefix = "re2-2024-07-02", + url = "https://cmc.cloudartifact.szv.dragon.tools.huawei.com/artifactory/opensource_general/re2/2022-04-01/package/re2-2022-04-01.zip", + sha256 = "e7a7a796c5c207f1cd0a909799077640594c1aaa46518bd4eb5efbde62b7e753", + strip_prefix = "re2-2022-04-01", ) http_archive( -- Gitee From 5beb26dfb63cbbdc04cf72275c4dd1cbb1ef0713 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:19:49 +0000 Subject: [PATCH 03/16] update api/cpp/src/local_state_store.cpp. Signed-off-by: mayuehit --- api/cpp/src/local_state_store.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api/cpp/src/local_state_store.cpp b/api/cpp/src/local_state_store.cpp index 905c255..2f77bbe 100644 --- a/api/cpp/src/local_state_store.cpp +++ b/api/cpp/src/local_state_store.cpp @@ -16,7 +16,7 @@ */ #include "yr/api/local_state_store.h" #include -#include +#include "re2/re2.h" #include "parallel_for/complier.h" #include "src/libruntime/err_type.h" #include "src/libruntime/statestore/state_store.h" @@ -33,7 +33,7 @@ const int MIN_CHECK_INTERVAL_MS = 200; const int MAX_CHECK_INTERVAL_MS = 1000; const int GET_RETRY_MAX_TIME = 5; const int MAX_MSET_SIZE = 8; -const std::regex KEY_REGEX("^[a-zA-Z0-9\\~\\.\\-\\/_!@#%\\^\\&\\*\\(\\)\\+\\=\\:;]*$"); +const re2::RE2 KEY_REGEX("^[a-zA-Z0-9\\~\\.\\-\\/_!@#%\\^\\&\\*\\(\\)\\+\\=\\:;]*$"); LocalStateStore::LocalStateStore() {} @@ -51,10 +51,9 @@ void LocalStateStore::Write(const std::string &key, std::shared_ptr Date: Fri, 31 Oct 2025 08:21:35 +0000 Subject: [PATCH 04/16] update src/libruntime/auto_init.cpp. Signed-off-by: mayuehit --- src/libruntime/auto_init.cpp | 39 ++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/libruntime/auto_init.cpp b/src/libruntime/auto_init.cpp index 0b46e90..d5639a3 100644 --- a/src/libruntime/auto_init.cpp +++ b/src/libruntime/auto_init.cpp @@ -21,7 +21,7 @@ #include #endif #include "src/dto/config.h" - +#include "src/utility/string_utility.h" namespace YR { namespace Libruntime { @@ -65,18 +65,16 @@ void ClusterAccessInfo::ParseFromMasterInfo(const std::string &masterInfoPath) std::map kvMap; std::map> kvsMap; - std::regex regex("[,:]"); - std::sregex_token_iterator iter(masterInfo.begin(), masterInfo.end(), regex, -1); - std::sregex_token_iterator end; - - while (iter != end) { - std::string key = *iter; - iter++; - if (iter == end) { + std::string pattern = "[,:]"; + auto result = YR::utility::SplitToStr(masterInfo, pattern); + for (size_t i = 0; i < result.size();) { + std::string key = result[i]; + ++i; + if (i >= result.size()) { break; } - std::string value = *iter; - iter++; + std::string value = result[i]; + ++i; if (kvMap.find(key) != kvMap.end()) { if (kvsMap.find(key) == kvsMap.end()) { kvsMap[key].push_back(kvMap[key]); @@ -187,13 +185,10 @@ void ClusterAccessInfo::ParseDsAddr() std::pair ClusterAccessInfo::ParseURLWithProtocol(const std::string &url) { - std::regex urlPattern(R"((^[a-zA-Z]+://)?(.*))"); - std::smatch matches; - - if (std::regex_match(url, matches, urlPattern)) { - std::string protocol = matches[1].str(); - std::string remainder = matches[2].str(); - + re2::RE2 urlPattern(R"((^[a-zA-Z]+://)?(.*))"); + std::string protocol; + std::string remainder; + if (RE2::PartialMatch(url, urlPattern, &protocol, &remainder)) { if (protocol.empty()) { return {"", remainder}; } else { @@ -315,14 +310,14 @@ ClusterAccessInfo AutoCreateYuanRongCluster(std::vector &args) bool IsValidIPPort(const std::string &input) { - std::regex pattern(R"((\d{1,3}\.){3}\d{1,3}:\d{1,5})"); - return std::regex_match(input, pattern); + re2::RE2 pattern(R"((\d{1,3}\.){3}\d{1,3}:\d{1,5})"); + return RE2::FullMatch(input, pattern); } bool IsURLHasProtocalPrefix(const std::string &input) { - std::regex pattern(R"((http|https|grpc)://([a-zA-Z0-9.-]+|\d{1,3}(\.\d{1,3}){3}):\d{1,5})"); - return std::regex_match(input, pattern); + re2::RE2 pattern(R"((http|https|grpc)://([a-zA-Z0-9.-]+|\d{1,3}(\.\d{1,3}){3}):\d{1,5})"); + return RE2::FullMatch(input, pattern); } bool NeedToBeParsed(ClusterAccessInfo info) -- Gitee From 696ba5cae376614992ddc03959aed8a4ac7beafb Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:21:49 +0000 Subject: [PATCH 05/16] update src/libruntime/auto_init.h. Signed-off-by: mayuehit --- src/libruntime/auto_init.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libruntime/auto_init.h b/src/libruntime/auto_init.h index 96a6e6c..4cf8e3c 100644 --- a/src/libruntime/auto_init.h +++ b/src/libruntime/auto_init.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include -- Gitee From a908e1aa1ed2ea10ec8bb484357c7c3478187d49 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:22:18 +0000 Subject: [PATCH 06/16] update src/libruntime/clientsmanager/clients_manager.cpp. Signed-off-by: mayuehit --- src/libruntime/clientsmanager/clients_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libruntime/clientsmanager/clients_manager.cpp b/src/libruntime/clientsmanager/clients_manager.cpp index ff7a48a..abd39a2 100644 --- a/src/libruntime/clientsmanager/clients_manager.cpp +++ b/src/libruntime/clientsmanager/clients_manager.cpp @@ -23,7 +23,7 @@ std::pair, ErrorInfo> ClientsManager::GetFsConn(c { auto addr = GetIpAddr(ip, port); YRLOG_DEBUG("grpc client target is {}", addr); - if (!std::regex_match(addr, std::regex(IP_PORT_REGEX))) { + if (!RE2::FullMatch(addr, re2::RE2(IP_PORT_REGEX))) { YRLOG_ERROR("failed to get valid runtime-rpc server address({})", addr); return std::make_pair(nullptr, ErrorInfo(ErrorCode::ERR_CONNECTION_FAILED, "The server address is invalid.")); } -- Gitee From 94328af111141b68c5865b9bedd57bc94cbc24bd Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:22:41 +0000 Subject: [PATCH 07/16] update src/libruntime/clientsmanager/clients_manager.h. Signed-off-by: mayuehit --- src/libruntime/clientsmanager/clients_manager.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libruntime/clientsmanager/clients_manager.h b/src/libruntime/clientsmanager/clients_manager.h index 43e25cb..53707fd 100644 --- a/src/libruntime/clientsmanager/clients_manager.h +++ b/src/libruntime/clientsmanager/clients_manager.h @@ -17,7 +17,6 @@ #pragma once #include -#include #include "src/libruntime/err_type.h" #include "src/libruntime/gwclient/http/client_manager.h" -- Gitee From f1582c019b62a7a7c5e1e2370c47534fc4c15df1 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:25:00 +0000 Subject: [PATCH 08/16] update src/libruntime/libruntime.cpp. Signed-off-by: mayuehit --- src/libruntime/libruntime.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libruntime/libruntime.cpp b/src/libruntime/libruntime.cpp index 6826920..600191f 100755 --- a/src/libruntime/libruntime.cpp +++ b/src/libruntime/libruntime.cpp @@ -15,7 +15,7 @@ */ #include - +#include "re2/re2.h" #include "invoke_order_manager.h" #include "src/dto/config.h" #include "src/dto/data_object.h" @@ -42,8 +42,8 @@ const std::string ACTOR_INSTANCE_TYPE = "actor"; const char *DEFAULT_DELEGATE_DIRECTORY_QUOTA = "512"; // 512MB const int MAX_DELEGATE_DIRECTORY_QUOTA = 1024 * 1024; // 1TB const std::string QUOTA_NO_LIMIT = "-1"; -const std::regex POD_LABELS_KEY_REGEX("^[a-zA-Z0-9]([-a-zA-Z0-9]{0,61}[a-zA-Z0-9])?$"); -const std::regex POD_LABELS_VALUE_REGEX("^[a-zA-Z0-9]([-a-zA-Z0-9]{0,61}[a-zA-Z0-9])?$|^$"); +const re2::RE2 POD_LABELS_KEY_REGEX("^[a-zA-Z0-9]([-a-zA-Z0-9]{0,61}[a-zA-Z0-9])?$"); +const re2::RE2 POD_LABELS_VALUE_REGEX("^[a-zA-Z0-9]([-a-zA-Z0-9]{0,61}[a-zA-Z0-9])?$|^$"); const std::string DISPATCHER = "dis"; const size_t NUM_DISPATCHER = 2; @@ -126,12 +126,12 @@ ErrorInfo Libruntime::CheckSpec(std::shared_ptr spec) "The number of pod labels is invalid, please set the pod labels less than and equal to 5"); } for (auto &iter : spec->opts.podLabels) { - if (!std::regex_match(iter.first, POD_LABELS_KEY_REGEX)) { + if (!RE2::FullMatch(iter.first, POD_LABELS_KEY_REGEX)) { return ErrorInfo(YR::Libruntime::ErrorCode::ERR_PARAM_INVALID, YR::Libruntime::ModuleCode::RUNTIME, "The pod label key is invalid, please set the pod label key with letters, digits and '-' " "which cannot start or end with '-' and cannot exceed 63 characters."); } - if (!std::regex_match(iter.second, POD_LABELS_VALUE_REGEX)) { + if (!RE2::FullMatch(iter.second, POD_LABELS_VALUE_REGEX)) { return ErrorInfo( YR::Libruntime::ErrorCode::ERR_PARAM_INVALID, YR::Libruntime::ModuleCode::RUNTIME, "The pod label value is invalid, please set the pod label value with letters, digits and '-' which " @@ -141,8 +141,8 @@ ErrorInfo Libruntime::CheckSpec(std::shared_ptr spec) } if (spec->opts.customExtensions.find(DELEGATE_DIRECTORY_QUOTA) != spec->opts.customExtensions.end()) { auto quota = spec->opts.customExtensions[DELEGATE_DIRECTORY_QUOTA]; - std::regex pattern(R"(^[0-9]+$)"); - if (quota != QUOTA_NO_LIMIT && !std::regex_match(quota, pattern)) { + re2::RE2 pattern(R"(^[0-9]+$)"); + if (quota != QUOTA_NO_LIMIT && !RE2::FullMatch(quota, pattern)) { return ErrorInfo(YR::Libruntime::ErrorCode::ERR_PARAM_INVALID, YR::Libruntime::ModuleCode::RUNTIME, "The DELEGATE_DIRECTORY_QUOTA value: {" + quota + "} is invalid, not composed of numbers"); } -- Gitee From a6c1001737ed8b18f7e6eee03bf7cda0b534b731 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:25:25 +0000 Subject: [PATCH 09/16] update src/libruntime/libruntime.h. Signed-off-by: mayuehit --- src/libruntime/libruntime.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libruntime/libruntime.h b/src/libruntime/libruntime.h index 9d38e54..f942e8d 100644 --- a/src/libruntime/libruntime.h +++ b/src/libruntime/libruntime.h @@ -17,7 +17,6 @@ #pragma once #include -#include #include #include -- Gitee From c4af57aa2580e6cab7b338f09d0910f1aefd9b9d Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:25:51 +0000 Subject: [PATCH 10/16] update src/utility/BUILD.bazel. Signed-off-by: mayuehit --- src/utility/BUILD.bazel | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utility/BUILD.bazel b/src/utility/BUILD.bazel index f8f9b99..a1ffec5 100644 --- a/src/utility/BUILD.bazel +++ b/src/utility/BUILD.bazel @@ -25,6 +25,7 @@ cc_library( "@com_google_absl//absl/random:random", "@com_google_absl//absl/synchronization:synchronization", "@securec", + "@com_googlesource_code_re2//:re2", ], ) @@ -45,5 +46,6 @@ cc_library( "@com_google_absl//absl/random:random", "@com_google_absl//absl/synchronization:synchronization", "@securec", + "@com_googlesource_code_re2//:re2", ], ) -- Gitee From 6b26d2fefa554318b696761e1fc67c0d1853d52b Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:26:27 +0000 Subject: [PATCH 11/16] update src/utility/string_utility.h. Signed-off-by: mayuehit --- src/utility/string_utility.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/utility/string_utility.h b/src/utility/string_utility.h index e0faf8d..1d467a7 100644 --- a/src/utility/string_utility.h +++ b/src/utility/string_utility.h @@ -21,7 +21,7 @@ #include #include - +#include "re2/re2.h" namespace YR { namespace utility { inline void Split(const std::string &source, std::vector &result, const char sep) @@ -81,5 +81,30 @@ inline std::string DecodedToString(const std::string &inStr) boost::beast::detail::base64::decode(data, inStr.data(), inStr.size()); return reinterpret_cast(data); } + +inline std::vector SplitToStr(const std::string &info, const std::string &pattern) +{ + if (info.empty()) { + return {}; + } + re2::StringPiece text(info); + re2::RE2 re2Pattern(pattern); + std::vector result; + size_t lastPos = 0; + + re2::StringPiece match; + while (re2Pattern.Match(text, lastPos, text.size(), RE2::UNANCHORED, &match, 1)) { + uint64_t splitIndex = match.data() - text.data(); + if (match.data() - (text.data() + lastPos) > 0) { + result.push_back(std::string(text.data() + lastPos, match.data() - (text.data() + lastPos))); + } + lastPos = splitIndex + match.size(); + } + + if (lastPos < text.size()) { + result.push_back(std::string(text.data() + lastPos)); + } + return result; +} } // namespace utility } // namespace YR \ No newline at end of file -- Gitee From afeb5616e300367374983e0e5dcf251d811b90ca Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:27:43 +0000 Subject: [PATCH 12/16] update test/libruntime/auto_init_test.cpp. Signed-off-by: mayuehit --- test/libruntime/auto_init_test.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/libruntime/auto_init_test.cpp b/test/libruntime/auto_init_test.cpp index 52fcd6e..cb983dc 100644 --- a/test/libruntime/auto_init_test.cpp +++ b/test/libruntime/auto_init_test.cpp @@ -84,3 +84,13 @@ TEST_F(AutoInitTest, AutoInitWithClusterAccessInfo) ASSERT_EQ(info2.dsAddr, "127.0.0.1:31499"); ASSERT_EQ(info2.inCluster, true); } + +TEST_F(AutoInitTest, ParseFromMasterInfo) +{ + MakeMasterInfoFile(YR::Libruntime::kDefaultDeployPathCurrMasterInfo, masterInfoString); + YR::Libruntime::ClusterAccessInfo info; + info.ParseFromMasterInfo(); + ASSERT_EQ(info.serverAddr, "10.90.42.75:34834"); + ASSERT_EQ(info.dsAddr, "10.90.42.75:31499"); + ASSERT_EQ(info.inCluster, true); +} \ No newline at end of file -- Gitee From 554c2ae40f38721cfc2f5756a71644cbc8cb2418 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Fri, 31 Oct 2025 08:29:35 +0000 Subject: [PATCH 13/16] update src/libruntime/invoke_spec.cpp. Signed-off-by: mayuehit --- src/libruntime/invoke_spec.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libruntime/invoke_spec.cpp b/src/libruntime/invoke_spec.cpp index ef472eb..b407c20 100644 --- a/src/libruntime/invoke_spec.cpp +++ b/src/libruntime/invoke_spec.cpp @@ -15,7 +15,6 @@ */ #include "src/libruntime/invoke_spec.h" -#include namespace YR { namespace Libruntime { const std::string LOW_RELIABILITY_TYPE = "low"; -- Gitee From eb9e0772aa3e2a68e084fa97d7183c6ea78bb6da Mon Sep 17 00:00:00 2001 From: mayuehit Date: Sat, 1 Nov 2025 01:39:43 +0000 Subject: [PATCH 14/16] update bazel/preload_grpc.bzl. Signed-off-by: mayuehit --- bazel/preload_grpc.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazel/preload_grpc.bzl b/bazel/preload_grpc.bzl index 9525492..fc50d25 100644 --- a/bazel/preload_grpc.bzl +++ b/bazel/preload_grpc.bzl @@ -67,7 +67,7 @@ def preload_grpc(): http_archive( name = "com_googlesource_code_re2", - url = "https://cmc.cloudartifact.szv.dragon.tools.huawei.com/artifactory/opensource_general/re2/2022-04-01/package/re2-2022-04-01.zip", + url = "https://gitee.com/mirrors/re2/repository/archive/2022-04-01.zip", sha256 = "e7a7a796c5c207f1cd0a909799077640594c1aaa46518bd4eb5efbde62b7e753", strip_prefix = "re2-2022-04-01", ) -- Gitee From 4395cc1630867f4cd539ecbc0306d37410b77946 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Mon, 3 Nov 2025 02:38:14 +0000 Subject: [PATCH 15/16] update tools/download_dependency.sh. Signed-off-by: mayuehit --- tools/download_dependency.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/download_dependency.sh b/tools/download_dependency.sh index 71044b3..0daff57 100644 --- a/tools/download_dependency.sh +++ b/tools/download_dependency.sh @@ -37,7 +37,9 @@ YR_METRICS_BIN_DIR="${RUNTIME_SRC_DIR}/../metrics" THIRD_PARTY_DIR="${RUNTIME_SRC_DIR}/../thirdparty/" MODULES="runtime" bash -x ${BASE_DIR}/download_opensource.sh -M $MODULES -T $THIRD_PARTY_DIR - +RUNTIME_THIRD_PARTY_CACHE=${RUNTIME_THIRD_PARTY_CACHE:-"https://build-logs.openeuler.openatom.cn:38080/temp-archived/openeuler/openYuanrong/runtime_deps/"} +DATA_SYSTEM_CACHE=${DATA_SYSTEM_CACHE:-"https://build-logs.openeuler.openatom.cn:38080/temp-archived/openeuler/openYuanrong/yr_cache/$(uname -m)/yr-datasystem-v0.5.0.tar.gz"} +FUNCTION_SYSTEM_CACHE=${FUNCTION_SYSTEM_CACHE:-"https://build-logs.openeuler.openatom.cn:38080/temp-archived/openeuler/openYuanrong/yr_cache/$(uname -m)/yr-functionsystem-v0.5.0.tar.gz"} function check_datasystem() { # check whether datasystem exist if [ ! -d "${YR_DATASYSTEM_BIN_DIR}"/datasystem/output/sdk/cpp/include ]; then -- Gitee From fdadf7c52a1f3a3bcc5b686bc56e41b51131fa62 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Mon, 3 Nov 2025 02:38:42 +0000 Subject: [PATCH 16/16] update tools/download_opensource.sh. Signed-off-by: mayuehit --- tools/download_opensource.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/download_opensource.sh b/tools/download_opensource.sh index a8cb80d..44a03e2 100644 --- a/tools/download_opensource.sh +++ b/tools/download_opensource.sh @@ -22,7 +22,7 @@ MODULES="all" DOWNLOAD_TEST_THIRDPARTY="ON" LOCAL_OS=$(head -1 /etc/os-release | tail -1 | awk -F "\"" '{print $2}')_$(uname -m) - +THIRD_PARTY_CACHE=${THIRD_PARTY_CACHE:-"https://build-logs.openeuler.openatom.cn:38080/temp-archived/openeuler/openYuanrong/deps/"} echo -e "local os is $LOCAL_OS" -- Gitee