This is an automated email from the ASF dual-hosted git repository. michaelsmith pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 1157d6e10f59a87bdb76f8e07f163743b6ef7094 Author: Joe McDonnell <[email protected]> AuthorDate: Tue Apr 29 13:50:14 2025 -0700 IMPALA-13479: Patch gperftools to remove 1GB limit on thread caches Upstream gperftools does not allow setting tcmalloc.max_total_thread_cache_bytes to greater than 1GB. This moves to a new toolchain that has patched gperftools to remove this limitation and allow setting tcmalloc.max_total_thread_cache_bytes > 1GB. This also reads back the value from tcmalloc and prints a warning if it doesn't match what we set. Testing: - Set tcmalloc_max_total_thread_cache_bytes to 2GB and verified that the warning message doesn't appear. On unpatched versions of gperftools, the warning message does appear. Change-Id: If78c8734c704090c12737a8c2a8456b73ea4b8e8 Reviewed-on: http://gerrit.cloudera.org:8080/22834 Reviewed-by: Michael Smith <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Reviewed-by: Joe McDonnell <[email protected]> --- be/src/runtime/exec-env.cc | 23 +++++++++++++++++++++-- bin/impala-config.sh | 8 ++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/be/src/runtime/exec-env.cc b/be/src/runtime/exec-env.cc index bf45e42bb..b16275ed4 100644 --- a/be/src/runtime/exec-env.cc +++ b/be/src/runtime/exec-env.cc @@ -481,13 +481,32 @@ Status ExecEnv::Init() { } #if !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) + const static char* TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES = + "tcmalloc.max_total_thread_cache_bytes"; // Change the total TCMalloc thread cache size if necessary. if (FLAGS_tcmalloc_max_total_thread_cache_bytes > 0 && !MallocExtension::instance()->SetNumericProperty( - "tcmalloc.max_total_thread_cache_bytes", + TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES, FLAGS_tcmalloc_max_total_thread_cache_bytes)) { - return Status("Failed to change TCMalloc total thread cache size."); + return Status(Substitute("Failed to change {0}", + TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES)); } + // Read the value back from tcmalloc to verify it matches what we set. + size_t actual_max_total_thread_cache_bytes = 0; + bool retval = MallocExtension::instance()->GetNumericProperty( + TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES, + &actual_max_total_thread_cache_bytes); + if (!retval) { + return Status(Substitute("Could not retrieve value of {0}.", + TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES)); + } + if (actual_max_total_thread_cache_bytes != + FLAGS_tcmalloc_max_total_thread_cache_bytes) { + LOG(WARNING) << "Set " << TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES << " to " + << FLAGS_tcmalloc_max_total_thread_cache_bytes << " bytes but actually " + << "using " << actual_max_total_thread_cache_bytes << " bytes."; + } + // A MemTracker for TCMalloc overhead which is the difference between the physical bytes // reserved (TcmallocMetric::PHYSICAL_BYTES_RESERVED) and the bytes in use // (TcmallocMetrics::BYTES_IN_USE). This overhead accounts for all the cached freelists diff --git a/bin/impala-config.sh b/bin/impala-config.sh index b86c46393..098707c71 100755 --- a/bin/impala-config.sh +++ b/bin/impala-config.sh @@ -81,13 +81,13 @@ export USE_AVRO_CPP=${USE_AVRO_CPP:=false} # moving to a different build of the toolchain, e.g. when a version is bumped or a # compile option is changed. The build id can be found in the output of the toolchain # build jobs, it is constructed from the build number and toolchain git hash prefix. -export IMPALA_TOOLCHAIN_BUILD_ID_AARCH64=63-3a0ac57d41 -export IMPALA_TOOLCHAIN_BUILD_ID_X86_64=491-3a0ac57d41 +export IMPALA_TOOLCHAIN_BUILD_ID_AARCH64=78-49a326be6f +export IMPALA_TOOLCHAIN_BUILD_ID_X86_64=509-49a326be6f export IMPALA_TOOLCHAIN_REPO=\ ${IMPALA_TOOLCHAIN_REPO:-https://github.com/cloudera/native-toolchain.git} export IMPALA_TOOLCHAIN_BRANCH=${IMPALA_TOOLCHAIN_BRANCH:-master} export IMPALA_TOOLCHAIN_COMMIT_HASH=\ -${IMPALA_TOOLCHAIN_COMMIT_HASH-810d0f47572d9ac4036c34eb2ad6342d51d510cd} +${IMPALA_TOOLCHAIN_COMMIT_HASH-49a326be6f1836127b1189cea71ea9832b31b7aa} # Compare the build ref in build IDs by removing everything up-to-and-including the # first hyphen. if [ "${IMPALA_TOOLCHAIN_BUILD_ID_AARCH64#*-}" \ @@ -135,7 +135,7 @@ export IMPALA_GFLAGS_VERSION=2.2.0-p2 unset IMPALA_GFLAGS_URL export IMPALA_GLOG_VERSION=0.3.5-p3 unset IMPALA_GLOG_URL -export IMPALA_GPERFTOOLS_VERSION=2.10 +export IMPALA_GPERFTOOLS_VERSION=2.10-p1 unset IMPALA_GPERFTOOLS_URL export IMPALA_GTEST_VERSION=1.14.0 unset IMPALA_GTEST_URL
