imay closed pull request #285: Fix BE can't be grayscale upgraded URL: https://github.com/apache/incubator-doris/pull/285
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/be/src/runtime/lib_cache.cpp b/be/src/runtime/lib_cache.cpp index e57fcd9d..5bfaa1a3 100644 --- a/be/src/runtime/lib_cache.cpp +++ b/be/src/runtime/lib_cache.cpp @@ -124,8 +124,9 @@ LibCache::LibCacheEntry::~LibCacheEntry() { } Status LibCache::get_so_function_ptr( - const std::string& hdfs_lib_file, const std::string& symbol, + const std::string& hdfs_lib_file, const std::string& origin_symbol, void** fn_ptr, LibCacheEntry** ent, bool quiet) { + const std::string symbol = get_real_symbol(origin_symbol); if (hdfs_lib_file.empty()) { // Just loading a function ptr in the current process. No need to take any locks. DCHECK(_current_process_handle != NULL); @@ -191,7 +192,8 @@ Status LibCache::get_local_lib_path( Status LibCache::check_symbol_exists( const std::string& hdfs_lib_file, LibType type, - const std::string& symbol, bool quiet) { + const std::string& origin_symbol, bool quiet) { + const std::string symbol = get_real_symbol(origin_symbol); if (type == TYPE_SO) { void* dummy_ptr = NULL; return get_so_function_ptr(hdfs_lib_file, symbol, &dummy_ptr, NULL, quiet); diff --git a/be/src/runtime/lib_cache.h b/be/src/runtime/lib_cache.h index 81d87f41..2083875a 100644 --- a/be/src/runtime/lib_cache.h +++ b/be/src/runtime/lib_cache.h @@ -19,6 +19,7 @@ #define DORIS_BE_RUNTIME_LIB_CACHE_H #include <string> +#include <regex> #include <boost/scoped_ptr.hpp> #include <boost/unordered_map.hpp> #include <boost/unordered_set.hpp> @@ -161,6 +162,15 @@ class LibCache { const std::string& hdfs_lib_file, LibType type, boost::unique_lock<boost::mutex>* entry_lock, LibCacheEntry** entry); + // map "palo" to "doris" in symbol, only for grayscale upgrading + std::string get_real_symbol(const std::string& symbol) { + static std::regex rx1("8palo_udf"); + std::string str1 = std::regex_replace(symbol, rx1, "9doris_udf"); + static std::regex rx2("4palo"); + std::string str2 = std::regex_replace(str1, rx2, "5doris"); + return str2; + } + /// Utility function for generating a filename unique to this process and /// 'hdfs_path'. This is to prevent multiple impalad processes or different library files /// with the same name from clobbering each other. 'hdfs_path' should be the full path diff --git a/fe/src/main/java/org/apache/doris/catalog/ScalarFunction.java b/fe/src/main/java/org/apache/doris/catalog/ScalarFunction.java index 8e1178f1..c6f54c1e 100644 --- a/fe/src/main/java/org/apache/doris/catalog/ScalarFunction.java +++ b/fe/src/main/java/org/apache/doris/catalog/ScalarFunction.java @@ -160,7 +160,7 @@ public static ScalarFunction createBuiltinOperator( } } String beClass = usesDecimal ? "DecimalOperators" : "Operators"; - String symbol = "palo::" + beClass + "::" + beFn; + String symbol = "doris::" + beClass + "::" + beFn; return createBuiltinOperator(name, symbol, argTypes, retType); } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@doris.apache.org For additional commands, e-mail: dev-h...@doris.apache.org