SERVER-98738 Fix some config issues and turn on fission (#30721)

GitOrigin-RevId: 33e96a268eff70f5926f9d2b8c9272c322879a7e
This commit is contained in:
Andrew Bradshaw 2024-12-31 07:17:31 -08:00 committed by MongoDB Bot
parent a99fdc0a43
commit 167b857d56
3 changed files with 51 additions and 4 deletions

View File

@ -7,6 +7,10 @@ info --config=local
# Don't use legacy toolchain resolution. # Don't use legacy toolchain resolution.
build --incompatible_enable_cc_toolchain_resolution build --incompatible_enable_cc_toolchain_resolution
# Improves build performance after first clean pull by
# about 1 minute on developer machines
build --experimental_remote_merkle_tree_cache
# This makes builds more hermetic by preventing environment variables from leaking into the execution of rules # This makes builds more hermetic by preventing environment variables from leaking into the execution of rules
build --incompatible_strict_action_env=true build --incompatible_strict_action_env=true
@ -108,6 +112,8 @@ build --flag_alias=dbg_level=//bazel/config:dbg_level
# The 'default' build profile - should match all the settings of a profile, currently fastbuild # The 'default' build profile - should match all the settings of a profile, currently fastbuild
build -c fastbuild build -c fastbuild
build --fission=yes
build --remote_download_regex=.*\.dwo$
build --//bazel/config:opt=off build --//bazel/config:opt=off
build --//bazel/config:dbg=True build --//bazel/config:dbg=True
build --//bazel/config:dbg_level=1 build --//bazel/config:dbg_level=1
@ -122,6 +128,8 @@ build --enable_platform_specific_config=true
# Profile for building fast with minimal debuggability - the build is fast ################################################## # Profile for building fast with minimal debuggability - the build is fast ##################################################
build:fastbuild -c fastbuild build:fastbuild -c fastbuild
build:fastbuild --fission=yes
build:fastbuild --remote_download_regex=.*\.dwo$
build:fastbuild --//bazel/config:opt=off build:fastbuild --//bazel/config:opt=off
build:fastbuild --//bazel/config:dbg=True build:fastbuild --//bazel/config:dbg=True
build:fastbuild --//bazel/config:dbg_level=1 build:fastbuild --//bazel/config:dbg_level=1
@ -136,7 +144,9 @@ build:fastbuild --enable_platform_specific_config=true
# Profile for building highly debuggable code - the build is slow, the code is slow, the binaries are large ################# # Profile for building highly debuggable code - the build is slow, the code is slow, the binaries are large #################
build:dbg -c dbg build:dbg -c dbg
build:dbg --//bazel/config:opt=debug build:dbg --fission=yes
build:dbg --remote_download_regex=.*\.dwo$
build:dbg --//bazel/config:opt=off
build:dbg --//bazel/config:dbg=True build:dbg --//bazel/config:dbg=True
build:dbg --//bazel/config:dbg_level=2 build:dbg --//bazel/config:dbg_level=2
build:dbg --//bazel/config:debug_symbols=True build:dbg --//bazel/config:debug_symbols=True
@ -150,15 +160,15 @@ build:dbg --enable_platform_specific_config=true
# Build with address and undefined sanitizers # Build with address and undefined sanitizers
build:dbg_aubsan --config=dbg build:dbg_aubsan --config=dbg
build:dbg_aubsan --//bazel/config:linkstatic=False build:dbg_aubsan --//bazel/config:opt=debug
build:dbg_aubsan --//bazel/config:allocator=system build:dbg_aubsan --//bazel/config:allocator=system
build:dbg_aubsan --//bazel/config:asan=True build:dbg_aubsan --//bazel/config:asan=True
build:dbg_aubsan --//bazel/config:ubsan=True build:dbg_aubsan --//bazel/config:ubsan=True
build:dbg_aubsan --//bazel/config:skip_archive=False
build:dbg_aubsan --enable_platform_specific_config=true build:dbg_aubsan --enable_platform_specific_config=true
# Build with thread sanitizers # Build with thread sanitizers
build:dbg_tsan --config=dbg build:dbg_tsan --config=dbg
build:dbg_tsan --//bazel/config:opt=debug
build:dbg_tsan --//bazel/config:linkstatic=False build:dbg_tsan --//bazel/config:linkstatic=False
build:dbg_tsan --//bazel/config:allocator=system build:dbg_tsan --//bazel/config:allocator=system
build:dbg_tsan --//bazel/config:tsan=True build:dbg_tsan --//bazel/config:tsan=True
@ -168,6 +178,8 @@ build:dbg_tsan --enable_platform_specific_config=true
# Profile for building optimized code - the build is slow, the code is fast ################################################# # Profile for building optimized code - the build is slow, the code is fast #################################################
build:opt -c opt build:opt -c opt
build:opt --fission=yes
build:opt --remote_download_regex=.*\.dwo$
build:opt --//bazel/config:opt=on build:opt --//bazel/config:opt=on
build:opt --//bazel/config:dbg=False build:opt --//bazel/config:dbg=False
build:opt --//bazel/config:dbg_level=2 build:opt --//bazel/config:dbg_level=2
@ -303,7 +315,7 @@ build:public-release --legacy_important_outputs
--config=fission --config=fission
build:fission --fission=yes build:fission --fission=yes
build:fission --remote_download_all build:fission --remote_download_regex=.*\.dwo$
# Avoid failing builds when BES metadata fails to upload. # Avoid failing builds when BES metadata fails to upload.
common --bes_upload_mode=fully_async common --bes_upload_mode=fully_async

View File

@ -1411,6 +1411,7 @@ def generate(env: SCons.Environment.Environment) -> None:
f"MONGO_DISTMOD={env['MONGO_DISTMOD']}", f"MONGO_DISTMOD={env['MONGO_DISTMOD']}",
"--compilation_mode=dbg", # always build this compilation mode as we always build with -g "--compilation_mode=dbg", # always build this compilation mode as we always build with -g
"--dynamic_mode=off", "--dynamic_mode=off",
"--fission=no",
] ]
# Timeout linking at 8 minutes to retry with a lower concurrency. # Timeout linking at 8 minutes to retry with a lower concurrency.

View File

@ -10,6 +10,40 @@ bazel_real="$BAZEL_REAL"
echo $BAZEL_REAL > ".bazel_real" echo $BAZEL_REAL > ".bazel_real"
bazelrc_xcode_lines=() bazelrc_xcode_lines=()
# If disk space becomes an issue, this block can be used to clean up configs
# when disk space is getting low. It is commented out because "bazel info output_path"
# takes .5 seconds, and no need to add that extra time unless disk space becomes a large
# problem
#if [ $# -eq 2 ] || [ $# -eq 3 ]; then
# if [ "$1" = "build" ]; then
# output_path=$($bazel_real info output_path)
# remaining_kb=$(df --output=avail $output_path | tail -n 1)
# remaining_gb=$(($remaining_kb / 1024 / 1024))
# fastbuild_dir=${output_path}/aarch64-fastbuild
# dbg_dir=${output_path}/aarch64-dbg
# opt_dir=${output_path}/aarch64-opt
# if [ "$remaining_gb" -lt 40 ]; then
# echo "Disk space is getting low (under 40GB) - cleaning up other config outputs"
# if [ $# -eq 2 ]; then
# rm -rf "$dbg_dir" &>/dev/null
# rm -rf "$opt_dir" &>/dev/null
# elif [[ "$2" == "--config=fastbuild"* ]]; then
# rm -rf "$dbg_dir" &>/dev/null
# rm -rf "$opt_dir" &>/dev/null
# elif [[ "$2" == "--config=dbg"* ]]; then
# rm -rf "$fastbuild_dir" &>/dev/null
# rm -rf "$opt_dir" &>/dev/null
# elif [[ "$2" == "--config=opt"* ]]; then
# rm -rf "$fastbuild_dir" &>/dev/null
# rm -rf "$dbg_dir" &>/dev/null
# fi
# fi
# fi
#fi
if [[ -z "${BAZELISK_SKIP_WRAPPER}" ]]; then if [[ -z "${BAZELISK_SKIP_WRAPPER}" ]]; then
echo "You're not using Bazelisk, which is recommended for a consistent build environment." >&2 echo "You're not using Bazelisk, which is recommended for a consistent build environment." >&2
echo "Your version of Bazel may be mismatched with the version intended to be used to build MongoDB." >&2 echo "Your version of Bazel may be mismatched with the version intended to be used to build MongoDB." >&2