diff --git a/configure.ac b/configure.ac index 8c3530a6..2169292f 100644 --- a/configure.ac +++ b/configure.ac @@ -61,6 +61,13 @@ AM_CFLAGS="${AM_CFLAGS} -fuse-ld=lld -ffunction-sections -Wl,--no-warn-symbol-ordering,--symbol-ordering-file,${ac_abs_confdir}/hotfuncs.txt" fi + #check el9, add -DEL9_PlATFORM for el9 + is_el9=`cat /proc/version | grep el9` + if test "$is_el9" != ""; then + AM_CXXFLAGS="${AM_CXXFLAGS} -DEL9_PLATFORM" + AM_CFLAGS="${AM_CFLAGS} -DEL9_PLATFORM" + fi + #check gcc version, add -Wno-ignored-qualifiers flag for gcc version greater than 4.3.0 GCC_VERSION=`$CC -dumpfullversion -dumpversion` if test $? -eq 0; then diff --git a/deps/3rd/dep_create.sh b/deps/3rd/dep_create.sh index 6ea9d229..36e6dca7 100644 --- a/deps/3rd/dep_create.sh +++ b/deps/3rd/dep_create.sh @@ -56,6 +56,9 @@ function get_os_release() { version_ge "8.0" && OS_RELEASE=8 && return version_ge "7.0" && OS_RELEASE=7 && return ;; + almalinux) + version_ge "8.0" && compat_centos8 && return + ;; debian) version_ge "9" && compat_centos7 && return ;; diff --git a/deps/3rd/obproxy.el8.x86_64.deps b/deps/3rd/obproxy.el8.x86_64.deps index 04d6a67f..84691730 100644 --- a/deps/3rd/obproxy.el8.x86_64.deps +++ b/deps/3rd/obproxy.el8.x86_64.deps @@ -7,7 +7,7 @@ devdeps-openssl-static-1.0.1e-3.el8.x86_64.rpm devdeps-libcurl-static-7.29.0-3.el8.x86_64.rpm devdeps-mariadb-connector-c-3.1.12-3.el8.x86_64.rpm devdeps-prometheus-cpp-0.8.0-4.el8.x86_64.rpm -devdeps-gtest-1.8.0-3.el8.x86_64.rpm +devdeps-gtest-1.8.0-132022101316.el8.x86_64.rpm devdeps-grpc-1.20.1-3.el8.x86_64.rpm devdeps-sqlite-3.38.1-5.el8.x86_64.rpm diff --git a/src/lib/allocator/ob_mod_define.cpp b/src/lib/allocator/ob_mod_define.cpp index 82851e11..0c7401ba 100644 --- a/src/lib/allocator/ob_mod_define.cpp +++ b/src/lib/allocator/ob_mod_define.cpp @@ -94,6 +94,16 @@ void ObModSet::print_mod_memory_usage(bool print_glibc) const _OB_LOG(INFO, "=== malloc_stats ==="); malloc_stats(); _OB_LOG(INFO, "=== main heap info ==="); +#ifdef EL9_PLATFORM + struct mallinfo2 info = mallinfo2(); + _OB_LOG(INFO, "mmap_chunks=%ld", info.hblks); + _OB_LOG(INFO, "mmap_bytes=%ld", info.hblkhd); + _OB_LOG(INFO, "sbrk_sys_bytes=%ld", info.arena); + _OB_LOG(INFO, "sbrk_used_chunk_bytes=%ld", info.uordblks); + _OB_LOG(INFO, "sbrk_not_in_use_chunks=%ld", info.ordblks); + _OB_LOG(INFO, "sbrk_not_in_use_chunk_bytes=%ld", info.fordblks); + _OB_LOG(INFO, "sbrk_top_most_releasable_chunk_bytes=%ld", info.keepcost); +#else struct mallinfo info = mallinfo(); _OB_LOG(INFO, "mmap_chunks=%d", info.hblks); _OB_LOG(INFO, "mmap_bytes=%d", info.hblkhd); @@ -102,7 +112,9 @@ void ObModSet::print_mod_memory_usage(bool print_glibc) const _OB_LOG(INFO, "sbrk_not_in_use_chunks=%d", info.ordblks); _OB_LOG(INFO, "sbrk_not_in_use_chunk_bytes=%d", info.fordblks); _OB_LOG(INFO, "sbrk_top_most_releasable_chunk_bytes=%d", info.keepcost); +#endif _OB_LOG(INFO, "=== detailed malloc_info ==="); + //malloc_info(0, stderr); } ObObjFreeListList::get_freelists().dump(); diff --git a/src/lib/ob_define.h b/src/lib/ob_define.h index e80ff17f..9aa4a41b 100644 --- a/src/lib/ob_define.h +++ b/src/lib/ob_define.h @@ -1216,7 +1216,7 @@ inline void reset_tid_cache() get_tid_cache() = -1; } -inline int64_t gettid() +inline int64_t gettid_ob() { int64_t &tid = get_tid_cache(); if (OB_UNLIKELY(tid <= 0)) { @@ -1224,6 +1224,6 @@ inline int64_t gettid() } return tid; } -#define GETTID() gettid() +#define GETTID() gettid_ob() #endif // OCEANBASE_COMMON_DEFINE_H_ diff --git a/src/lib/random/ob_random.cpp b/src/lib/random/ob_random.cpp index a9be32da..d56cf6f4 100644 --- a/src/lib/random/ob_random.cpp +++ b/src/lib/random/ob_random.cpp @@ -35,7 +35,7 @@ int64_t ObRandom::rand(const int64_t a, const int64_t b) { static __thread uint16_t seed[3] = {0, 0, 0}; if (0 == seed[0] && 0 == seed[1] && 0 == seed[2]) { - seed[0] = static_cast(gettid()); + seed[0] = static_cast(GETTID()); seed[1] = seed[0]; seed[2] = seed[1]; seed48(seed); diff --git a/src/obproxy/cmd/ob_show_memory_handler.cpp b/src/obproxy/cmd/ob_show_memory_handler.cpp index 98909ba0..a04132d7 100644 --- a/src/obproxy/cmd/ob_show_memory_handler.cpp +++ b/src/obproxy/cmd/ob_show_memory_handler.cpp @@ -111,7 +111,11 @@ int ObShowMemoryHandler::handle_show_memory(int event, void *data) } if (OB_SUCC(ret)) { // dump memory allocated by glibc +#ifdef EL9_PLATFORM + struct mallinfo2 mi = mallinfo2(); +#else struct mallinfo mi = mallinfo(); +#endif int64_t allocated = mi.arena + mi.hblkhd; int64_t used = allocated - mi.fordblks; if (OB_FAIL(dump_mod_memory("GLIBC", "user", allocated, used, mi.hblks))) { diff --git a/src/obproxy/ob_proxy_main.cpp b/src/obproxy/ob_proxy_main.cpp index 3a5161b3..ea376a9a 100644 --- a/src/obproxy/ob_proxy_main.cpp +++ b/src/obproxy/ob_proxy_main.cpp @@ -909,7 +909,11 @@ void ObProxyMain::print_memory_usage() void ObProxyMain::print_glibc_memory_usage() { +#ifdef EL9_PLATFORM + struct mallinfo2 mi = mallinfo2(); +#else struct mallinfo mi = mallinfo(); +#endif int64_t hold = mi.arena + mi.hblkhd; int64_t used = hold - mi.fordblks; int64_t count = mi.hblks; diff --git a/src/obproxy/proxy/mysql/ob_mysql_client_session.cpp b/src/obproxy/proxy/mysql/ob_mysql_client_session.cpp index aae717e1..058773c2 100644 --- a/src/obproxy/proxy/mysql/ob_mysql_client_session.cpp +++ b/src/obproxy/proxy/mysql/ob_mysql_client_session.cpp @@ -296,7 +296,7 @@ int ObMysqlClientSession::new_connection( session_manager_new_.set_mutex(mutex_); MUTEX_TRY_LOCK(lock, mutex_, this_ethread()); if (OB_LIKELY(lock.is_locked())) { - current_tid_ = gettid(); + current_tid_ = GETTID(); hooks_on_ = true; MYSQL_INCREMENT_DYN_STAT(CURRENT_CLIENT_CONNECTIONS); diff --git a/src/obproxy/proxy/route/ob_cache_cleaner.cpp b/src/obproxy/proxy/route/ob_cache_cleaner.cpp index f81a0e0c..b9503adc 100644 --- a/src/obproxy/proxy/route/ob_cache_cleaner.cpp +++ b/src/obproxy/proxy/route/ob_cache_cleaner.cpp @@ -991,7 +991,7 @@ int ObCacheCleaner::do_delete_cluster_resource() cr->destroy(); } LOG_INFO("this thread has clean cluster resource complete", - "thread_id", gettid(), KPC(cr)); + "thread_id", GETTID(), KPC(cr)); cr_actor->free(); // will dec cr ref cr_actor = NULL; cr = NULL; diff --git a/src/obproxy/utils/ob_proxy_lib.h b/src/obproxy/utils/ob_proxy_lib.h index 98768673..cb778858 100644 --- a/src/obproxy/utils/ob_proxy_lib.h +++ b/src/obproxy/utils/ob_proxy_lib.h @@ -91,7 +91,10 @@ struct ifafilt; typedef unsigned int in_addr_t; #endif #include +#ifdef EL9_PLATFORM +#else #include +#endif #include #include #include