Skip to content

[chore](thirdparty) build only hadoop 3.4.2.4, build azure everywhere and slim it down, and add ccache - #66842

Open
morningman wants to merge 3 commits into
apache:masterfrom
morningman:thirdparty-hadoop-azure-ccache
Open

[chore](thirdparty) build only hadoop 3.4.2.4, build azure everywhere and slim it down, and add ccache#66842
morningman wants to merge 3 commits into
apache:masterfrom
morningman:thirdparty-hadoop-azure-ccache

Conversation

@morningman

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: apache/doris-thirdparty#410

Problem Summary:

Three related third-party build changes, all measured against
apache/doris-thirdparty run 31988123966.
Supersedes #66837 and #66839, which are now closed.


1. Only build hadoop-libs 3.4.2.4

The tree carried two libhdfs builds: build_hadoop_libs built the 3.3.6.6 fork
into installed/{include,lib}/hadoop_hdfs/, build_hadoop_libs_3_4 built the
3.4.2.4 fork into .../hadoop_hdfs_3_4/, and on Linux both ran - 11m38s of the
x86_64 build and 10m00s of the arm64 one, for a fork only the cloud module still
consumed.

The two prefixes were also mixed up on the consumer side:

consumer header library
be/src/io/fs/hdfs.h hadoop_hdfs_3_4/hdfs.h (3.4.2.4)
be/src/io/hdfs_builder.cpp hadoop_hdfs/hdfs.h (3.3.6.6)
be/CMakeLists.txt hadoop_hdfs_3_4/native/libhdfs.a (3.4.2.4)
cloud/src/recycler/hdfs_accessor.{h,cpp} hadoop_hdfs/hdfs.h (3.3.6.6)
cloud/CMakeLists.txt hadoop_hdfs/native/libhdfs.a (3.3.6.6)

Both headers share the LIBHDFS_HDFS_H include guard, so hdfs_builder.cpp
compiled against the 3.3.6.6 header (it came first) while BE linked the 3.4.2.4
archive.

3.4.2.4 stays where it is, under hadoop_hdfs_3_4/, so a build-env image from this
change can still compile older Doris branches. The 3.3.6.6 build and its
hadoop_hdfs/ prefix are gone, and cloud/, build.sh's LAST_THIRDPARTY_LIB
sentinel, run-be-ut.sh, run-cloud-ut.sh and the thirdparty lifecycle test move
to hadoop_hdfs_3_4/. The unit-test runners still stage the jars at
lib/hadoop_hdfs/, so the classpath loops below them are unchanged.

2. Build azure everywhere, and stop building what Doris does not link

It was only ever built on x86_64 Linux. env.sh forced
DISABLE_BUILD_AZURE=ON on aarch64 and macOS, and build_azure skipped Darwin a
second time, so BE and the cloud meta-service lost +AZURE_BLOB and
+AZURE_STORAGE_VAULT there. Nothing in the recipe was genuinely x86_64-Linux-only,
just two details: -ldl fails on Apple (there is no libdl; those symbols are in
libSystem), and vcpkg ships no prebuilt cmake/ninja/curl for aarch64 Linux so it
needs VCPKG_FORCE_SYSTEM_BINARIES=1. The triplet is now derived from uname
rather than left to vcpkg's host detection.

It was the most expensive package in the tree - 26m06s of the 2h43m x86_64 Linux
build - almost none of it for Doris:

phase time
vcpkg install 22m11s
  - protobuf 5.29.3 12m29s
  - opentelemetry-cpp 4m35s
  - abseil 1m58s
  - openssl 1.1.1n 1m38s
  - curl / libxml2 / zlib / uAMQP / utf8-range ~1m30s
azure SDK configure + build ~3m55s

protobuf, abseil and utf8-range were pulled in only because vcpkg.json declared
opentelemetry-cpp unconditionally - roughly 19 of the 26 minutes. Doris does not
use azure's OpenTelemetry tracing. On top of that vcpkg builds every port twice
(Building x64-linux-dbg then -rel) and Doris links only the release halves, and
the SDK builds appconfiguration, attestation, eventhubs, keyvault, tables, template,
uAMQP, storage-files-datalake, storage-files-shares and storage-queues, while
be/cmake/thirdparty.cmake links exactly four targets: azure-core,
azure-identity, azure-storage-blobs, azure-storage-common.

So the patch drops opentelemetry-cpp and the uAMQP C libraries from vcpkg.json,
flips DISABLE_AMQP / DISABLE_AZURE_CORE_OPENTELEMETRY to ON and trims the
sub-projects to the four Doris links; build_azure writes an overlay triplet that
sets VCPKG_BUILD_TYPE release. What is left for vcpkg to build is curl, libxml2,
openssl 1.1.1n and zlib, release only.

3. ccache for the third-party build

ENABLE_THIRDPARTY_CCACHE=ON (off by default) exports
CMAKE_C_COMPILER_LAUNCHER / CMAKE_CXX_COMPILER_LAUNCHER, which CMake initialises
from the environment, so no cmake invocation in the script changes. It deliberately
does not prefix CC/CXX: CMake splits "ccache clang" into the compiler plus a
CMAKE_<LANG>_FLAGS entry, and that leaks into whatever a package exports.
Autotools packages are left alone.

.github/workflows/build-thirdparty.yml turns it on and carries the cache with the
ccache-action this repository already vendors. Today a change to one package
recompiles all ~80, at -j 2 on two of the three jobs.

max-size is 1G per job so the three together stay inside what is left of the
repository's 10 GB Actions cache budget next to the 5G BE-UT-macOS cache. Note
that a cache saved by a pull request run is only visible to that same pull request,
so this pays off across pushes to one branch; sharing it across pull requests would
need this workflow to run on master, the way be-ut-mac.yml uses a schedule for
exactly that reason. Happy to drop this hunk if the cache budget is too tight.

Also: the macOS jobs stalled for 10 minutes each

Carried over from apache/doris-thirdparty#410. thrift's configure finds the dotnet
the runner images ship, so make runs dotnet build -c Release for lib/netstd.
The build finishes in seconds and then the compiler server it leaves behind holds
the stdout it inherited for its full keep-alive while nothing happens:

runner "Build succeeded" -> "Making install in compiler/cpp"
macos-14 600.03s
macos-15-intel 598.79s
ubuntu-22.04 0.01s

UseSharedCompilation=false and MSBUILDDISABLENODEREUSE=1 stop the server from
being started. Both macOS jobs in this workflow pay this today.

The other two fixes in apache/doris-thirdparty#410 do not apply here: there is no
Docker job to decouple, and no macOS x86_64 job to build less often.

Release note

Azure Blob Storage support (+AZURE_BLOB, +AZURE_STORAGE_VAULT) is now built on
aarch64 and macOS, not just x86_64 Linux.

Check List (For Author)

  • Test

    • Manual test (add detailed scripts or steps below)

      This PR touches thirdparty/** and env.sh, so its own
      Build Third Party Libraries run builds the whole tree on ubuntu-22.04,
      macos-15 and macos-14 - which is exactly where the hadoop change, the azure
      slimming and, for the first time, azure on macOS arm64 get exercised.
      aarch64 Linux is the one path this workflow does not cover; that is only
      built in apache/doris-thirdparty.

      The azure patch was verified to apply cleanly to a pristine
      azure-sdk-for-cpp-azure-core_1.16.0 tarball, and the resulting vcpkg.json
      parses and declares only curl, libxml2, openssl, wil. actionlint is
      clean on the workflow.

  • Behavior changed:

    • Yes.
      • installed/{include,lib}/hadoop_hdfs/ no longer exists in the prebuilt
        third-party archive; only hadoop_hdfs_3_4/ remains. Anything outside this
        repository reading the hadoop_hdfs/ prefix needs updating.
      • Azure is now built and linked on aarch64 and macOS. The third-party
        prebuilt has to be rebuilt before this lands
        : BE/cloud on those platforms
        will pass -DBUILD_AZURE=ON and fail to link against an older prebuilt
        archive that has no azure libraries. DISABLE_BUILD_AZURE=ON still opts out.
      • installed/ no longer contains the azure sub-libraries Doris does not link.
  • Does this need documentation?

    • No.

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Aug 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

…4 everywhere

The tree carried two libhdfs builds. `build_hadoop_libs` built the 3.3.6.6
fork into `installed/{include,lib}/hadoop_hdfs/`, `build_hadoop_libs_3_4`
built the 3.4.2.4 fork into `.../hadoop_hdfs_3_4/`, and on Linux both ran -
roughly 10 extra minutes of every third-party build for a fork only the cloud
module still consumed.

The two prefixes were also mixed up on the consumer side. BE linked
`hadoop_hdfs_3_4/native/libhdfs.a`, but `be/src/io/hdfs_builder.cpp` included
`hadoop_hdfs/hdfs.h` - the 3.3.6.6 header - while `be/src/io/fs/hdfs.h`
included the 3.4.2.4 one. Both headers share the LIBHDFS_HDFS_H include guard,
so that translation unit compiled against 3.3.6.6 and linked 3.4.2.4. The cloud
meta-service used 3.3.6.6 for both.

Build 3.4.2.4 only, and move the remaining 3.3.6.6 consumers onto it:

- thirdparty: drop `build_hadoop_libs` and the `HADOOP_LIBS_*` variables;
  `hadoop_libs_3_4` now runs on Linux and macOS alike. The install prefix stays
  `hadoop_hdfs_3_4/` so a build-env image from this change can still compile
  older Doris branches.
- cloud: link `hadoop_hdfs_3_4/native/libhdfs.a` and include the matching header.
- `be/src/io/hdfs_builder.cpp`: drop the 3.3.6.6 include - `io/fs/hdfs.h`, two
  lines below, already re-exports the 3.4.2.4 one.
- `build.sh`, `run-be-ut.sh`, `run-cloud-ut.sh` and the thirdparty lifecycle
  test follow the same prefix.
…hat Doris does not link

Two things about azure-sdk-for-cpp.

It only ever got built on x86_64 Linux. env.sh forced DISABLE_BUILD_AZURE=ON on
aarch64 and macOS, and build_azure skipped Darwin a second time, so BE and the
cloud meta-service lost +AZURE_BLOB and +AZURE_STORAGE_VAULT on those platforms.
Nothing in the recipe was actually x86_64-Linux-specific except two details:
`-ldl`, which fails on Apple because there is no libdl there, and vcpkg needing
VCPKG_FORCE_SYSTEM_BINARIES on aarch64 Linux, where it ships no prebuilt tools.
Both are handled now, and the triplet is derived from uname instead of being left
to vcpkg's host detection.

And it was by far the most expensive package in the tree - 26m06s of the 2h43m
x86_64 Linux third-party build in apache/doris-thirdparty run 31988123966 - almost
none of it for Doris's benefit:

- 22m of the 26m was `vcpkg install`, and 19m of that was opentelemetry-cpp
  (4m35s) plus the protobuf 5.29.3 (12m29s), abseil (1m58s) and utf8-range it
  drags in. Doris does not use azure's OpenTelemetry tracing at all; the
  dependency was in vcpkg.json unconditionally.
- vcpkg builds every port twice, debug and release, and Doris links only the
  release halves.
- The SDK builds appconfiguration, attestation, eventhubs, keyvault, tables,
  template, uAMQP, datalake, file shares and queues. Doris links azure-core,
  azure-identity, azure-storage-common and azure-storage-blobs.

So the patch drops opentelemetry-cpp and the uAMQP C libraries from vcpkg.json,
flips DISABLE_AMQP and DISABLE_AZURE_CORE_OPENTELEMETRY to ON, and trims the
sub-projects to the four Doris links; build_azure adds an overlay triplet that
sets VCPKG_BUILD_TYPE=release. What is left to build is curl, libxml2, openssl
1.1.1n and zlib, release only.

Also add an opt-in ENABLE_THIRDPARTY_CCACHE. A third-party build is cold every
time, so a warm ccache turns a rebuild triggered by one changed package into
minutes rather than hours. It exports CMAKE_<LANG>_COMPILER_LAUNCHER, which CMake
picks up from the environment, rather than prefixing CC/CXX - that would put the
compiler name into CMAKE_<LANG>_FLAGS. Autotools packages are left alone, and it
is off unless asked for.
…nd cache ccache

Two of the four fixes in apache/doris-thirdparty#410 apply to this workflow too.

thrift's configure finds the dotnet the runner images ship, so `make` runs
`dotnet build -c Release` for lib/netstd. The build itself finishes in seconds and
then the compiler server it leaves behind holds the stdout it inherited for its
full keep-alive while nothing happens. Between "Build succeeded" and "Making
install in compiler/cpp" in apache/doris-thirdparty run 31988123966: 600.03s on
macos-14, 598.79s on macos-15-intel, 0.01s on Linux. Both macOS jobs here pay it.
`UseSharedCompilation=false` and `MSBUILDDISABLENODEREUSE=1` stop the server from
being started.

And nothing was cached between runs: ccache is installed on every runner but
nothing routed compilation through it, so a change to one package recompiled all
~80, at `-j 2` on two of the three jobs. Turn on ENABLE_THIRDPARTY_CCACHE and
carry the cache with the ccache-action this repository already vendors.

max-size is 1G per job so that all three together stay inside what is left of the
repository's 10 GB Actions cache budget next to the 5G BE-UT-macOS cache. Note
that a cache saved by a pull request run is only visible to that same pull
request, so this pays off across pushes to one branch; sharing it across pull
requests would need this workflow to run on master.

The other two fixes in that PR do not apply here: there is no Docker job to
decouple, and no macOS x86_64 job to build less often.
@morningman
morningman force-pushed the thirdparty-hadoop-azure-ccache branch from 98dea2d to c596cd5 Compare August 17, 2026 13:01
@morningman

Copy link
Copy Markdown
Contributor Author

run compile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants