Skip to content

Show compiler cache statistics and update sccache to 0.17.0 - #113516

Open
pamarcos wants to merge 4 commits into
masterfrom
fix-sccache-stats
Open

Show compiler cache statistics and update sccache to 0.17.0#113516
pamarcos wants to merge 4 commits into
masterfrom
fix-sccache-stats

Conversation

@pamarcos

@pamarcos pamarcos commented Aug 5, 2026

Copy link
Copy Markdown
Member

The build jobs invoked cache statistics commands through non-verbose
Shell.check, which redirected their output to /dev/null and left empty
statistics sections in CI logs. The regular and fast-test build paths now stream
sccache --show-stats, and the fast-test build streams Rust chcache stats.
Clang-tidy builds also stream both clang-tidy-cache.py --show-stats and the
derived cache hit/miss summary. The output-oriented shell helper now enables
verbose output by construction.

This also updates sccache from 0.10.0 to 0.17.0 and configures PR builds with the
supported SCCACHE_S3_RW_MODE=READ_ONLY setting. The previous
SCCACHE_S3_READ_ONLY=true variable was ignored by sccache.

Observed in:
https://s3.amazonaws.com/clickhouse-test-reports/PRs/111718/b5a9b3b217645fc3424246f783ecb152a0bd3f73/build_amd_release/job.log

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Not for changelog.

The stats commands used non-verbose `Shell.check`, which discarded all output.
Enable verbose output in build jobs, update sccache to 0.17.0, and use the
supported `SCCACHE_S3_RW_MODE=READ_ONLY` setting for PR builds.

Observed in:
https://s3.amazonaws.com/clickhouse-test-reports/PRs/111718/b5a9b3b217645fc3424246f783ecb152a0bd3f73/build_amd_release/job.log
@pamarcos
pamarcos requested a review from Copilot August 5, 2026 15:32
@clickhouse-gh

clickhouse-gh Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d20795c]


AI Review

Summary

This PR does fix the empty-cache-stat sections for sccache and clang-tidy-cache, and the CI Fix or Improvement changelog category is appropriate. The remaining problem is that the fast-test job still claims to stream Rust chcache stats even though that build is configured to use sccache, so one material part of the PR's stated behavior is still not implemented.

Findings

⚠️ Majors

  • [ci/jobs/fast_test.py:290] [dismissed by author -- https://github.com/Show compiler cache statistics and update sccache to 0.17.0 #113516#discussion_r3727529014] The fast-test build still configures CMake with -DCOMPILER_CACHE=sccache (ci/defs/defs.py), while cmake/ccache.cmake only points CCACHE_EXECUTABLE at rust/chcache/chcache in chcache mode and rust/chcache/CMakeLists.txt only builds that crate behind the same guard. The Shell.check(f"{build_dir}/rust/chcache/chcache stats", verbose=True) call therefore still cannot succeed in the current code, so the PR does not actually deliver the promised Rust cache-stats output for fast tests.
    Suggested fix: gate this command on ToolSet.COMPILER_CACHE == "chcache" / file existence, or remove it and rely on sccache --show-stats for the cache wrapper that is actually active in this job.
Final Verdict

Not ready: the already-threaded fast-test chcache issue is still present in the current code.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes missing sccache statistics in CI logs by ensuring sccache --show-stats output is streamed (not redirected to /dev/null), and updates the fasttest container to sccache v0.17.0 while configuring PR builds to use the supported SCCACHE_S3_RW_MODE=READ_ONLY setting to avoid writing into shared cache storage.

Changes:

  • Switch PR builds from SCCACHE_S3_READ_ONLY=true to SCCACHE_S3_RW_MODE=READ_ONLY in CI build job scripts.
  • Run sccache --show-stats via verbose Shell.check / run_shell so stats appear in CI logs.
  • Bump the fasttest Docker image sccache version from v0.10.0 to v0.17.0.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
ci/jobs/fast_test.py Sets SCCACHE_S3_RW_MODE=READ_ONLY for PRs and makes sccache --show-stats run with verbose output so stats are visible in logs.
ci/jobs/build_clickhouse.py Same PR read-only cache mode change; ensures sccache --show-stats output is streamed when invoked via run_shell.
ci/docker/fasttest/Dockerfile Updates bundled sccache binary version to v0.17.0 in the fasttest image.

The clang-tidy stats commands used the same non-verbose wrapper as sccache,
discarding both cache summaries and the derived log hit counts. Stream all
three summaries into the job log.

Observed in:
https://s3.amazonaws.com/clickhouse-test-reports/PRs/111718/b5a9b3b217645fc3424246f783ecb152a0bd3f73/build_amd_release/job.log
@pamarcos pamarcos changed the title Show sccache statistics and update to 0.17.0 Show compiler cache statistics and update sccache to 0.17.0 Aug 5, 2026
@pamarcos
pamarcos requested a review from Copilot August 5, 2026 15:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

ci/jobs/fast_test.py:290

  • chcache stats is still executed via Shell.check without verbose=True, so its output is redirected to /dev/null (same issue that hid the sccache --show-stats output). If these stats are intended to appear in CI logs, enable verbosity here as well.
        )
        Shell.check(f"{build_dir}/rust/chcache/chcache stats")
        Shell.check("sccache --show-stats", verbose=True)

Rename `run_shell` to `run_shell_with_output` and make it always invoke
`Shell.check` with verbose output. This makes the helper's contract explicit
and prevents future output-oriented calls from silently writing to `/dev/null`.

Also stream Rust `chcache stats`, which still used quiet `Shell.check`.

Observed in:
https://s3.amazonaws.com/clickhouse-test-reports/PRs/111718/b5a9b3b217645fc3424246f783ecb152a0bd3f73/build_amd_release/job.log

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

ci/jobs/build_clickhouse.py:110

  • run_shell_with_output forwards arbitrary **kwargs to Shell.check but also hardcodes verbose=True. If a caller passes verbose (e.g. by copy/paste from older run_shell usage), Python will raise TypeError: got multiple values for keyword argument 'verbose', breaking the build job at runtime. Make the helper robust by dropping any caller-provided verbose before calling Shell.check.
def run_shell_with_output(name, command, **kwargs):
    print(f"\n>>>> {name}\n")
    Shell.check(command, verbose=True, **kwargs)
    print(f"\n<<<< {name}\n")

@antaljanosbenjamin antaljanosbenjamin self-assigned this Aug 6, 2026
Comment thread ci/jobs/fast_test.py
@pamarcos

pamarcos commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

From https://github.com/ClickHouse/ClickHouse/actions/runs/31022910765/job/92573965023?pr=113516

[2026-08-06 09:51:24] >>>> sccache stats

[2026-08-06 09:51:24] Run command: [sccache --show-stats]
[2026-08-06 09:51:24] Compile requests                  17778
[2026-08-06 09:51:24] Compile requests executed         17525
[2026-08-06 09:51:24] Cache hits                            0
[2026-08-06 09:51:24] Cache misses                      17525
[2026-08-06 09:51:24] Cache misses (Assembler)             23
[2026-08-06 09:51:24] Cache misses (C/C++)              16683
[2026-08-06 09:51:24] Cache misses (Rust)                 819
[2026-08-06 09:51:24] Cache hits rate                    0.00 %
[2026-08-06 09:51:24] Cache hits rate (Assembler)        0.00 %
[2026-08-06 09:51:24] Cache hits rate (C/C++)            0.00 %
[2026-08-06 09:51:24] Cache hits rate (Rust)             0.00 %
[2026-08-06 09:51:24] Cache timeouts                        0
[2026-08-06 09:51:24] Cache read errors                     0
[2026-08-06 09:51:24] Forced recaches                       0
[2026-08-06 09:51:24] Cache write errors                17525
[2026-08-06 09:51:24] Cache errors                          0
[2026-08-06 09:51:24] Compilations                      17525
[2026-08-06 09:51:24] Compilation failures                  0
[2026-08-06 09:51:24] Non-cacheable compilations            0
[2026-08-06 09:51:24] Non-cacheable calls                 241
[2026-08-06 09:51:24] Non-compilation calls                12
[2026-08-06 09:51:24] Unsupported compiler calls            0
[2026-08-06 09:51:24] Average cache write               0.000 s
[2026-08-06 09:51:24] Average compiler                  2.406 s
[2026-08-06 09:51:24] Average cache read hit            0.000 s
[2026-08-06 09:51:24] Failed distributed compilations       0

[2026-08-06 09:51:24] Non-cacheable reasons:
[2026-08-06 09:51:24] crate-type                          197
[2026-08-06 09:51:24] -o                                   17
[2026-08-06 09:51:24] -                                    14
[2026-08-06 09:51:24] missing input                        12
[2026-08-06 09:51:24] -E                                    1

[2026-08-06 09:51:24] Cache location                  s3, name: clickhouse-builds, prefix: /ccache/sccache/
[2026-08-06 09:51:24] Base directories                (none)
[2026-08-06 09:51:24] Version (client)                0.17.0

[2026-08-06 09:51:24] <<<< sccache stats

[2026-08-06 09:51:24] >>>> Output programs

[2026-08-06 09:51:24] Run command: [ls -l /home/ubuntu/actions-runner/_work/ClickHouse/ClickHouse/ci/tmp/build/programs/]
[2026-08-06 09:51:24] total 7469344
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:27 CMakeFiles
[2026-08-06 09:51:24] -rw-r--r-- 1 clickhouse clickhouse        943 Aug  6 11:27 CTestTestfile.cmake
[2026-08-06 09:51:24] drwxr-xr-x 4 clickhouse clickhouse       4096 Aug  6 11:27 bash-completion
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 benchmark
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 ch -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 chc -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 chdig -> clickhouse
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 check-marks
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 checksum-for-compressed-block
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 chl -> clickhouse
[2026-08-06 09:51:24] -rwxr-xr-x 1 clickhouse clickhouse 6615978824 Aug  6 11:50 clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-benchmark -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-chdig -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-check-marks -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-checksum-for-compressed-block -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-client -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-compressor -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-disks -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-docker-init -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-extract-from-config -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-format -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-git-import -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-keeper -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-keeper-bench -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-keeper-client -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-keeper-converter -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-keeper-data-dumper -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-keeper-utils -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-local -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-obfuscator -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-oom-canary -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-packed-io -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-server -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-static-files-disk-uploader -> clickhouse
[2026-08-06 09:51:24] -rwxr-xr-x 1 clickhouse clickhouse 1032833152 Aug  6 11:50 clickhouse-stripped
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-su -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-zookeeper-dump-tree -> clickhouse
[2026-08-06 09:51:24] lrwxrwxrwx 1 clickhouse clickhouse         10 Aug  6 11:50 clickhouse-zookeeper-remove-by-list -> clickhouse
[2026-08-06 09:51:24] -rw-r--r-- 1 clickhouse clickhouse      83517 Aug  6 11:50 clickhouse.time-trace
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 client
[2026-08-06 09:51:24] -rw-r--r-- 1 clickhouse clickhouse      17516 Aug  6 11:27 cmake_install.cmake
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 compressor
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 disks
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 docker-init
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 extract-from-config
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 format
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 git-import
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 install
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 keeper
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 keeper-bench
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 keeper-client
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 keeper-converter
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 keeper-data-dumper
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 keeper-utils
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:50 lib
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 local
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 obfuscator
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 oom-canary
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 packed-io
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:50 self-extracting
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 server
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 static-files-disk-uploader
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 su
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 zookeeper-dump-tree
[2026-08-06 09:51:24] drwxr-xr-x 3 clickhouse clickhouse       4096 Aug  6 11:49 zookeeper-remove-by-list

[2026-08-06 09:51:24] <<<< Output programs

And from https://github.com/ClickHouse/ClickHouse/actions/runs/31022910765/job/92565945206?pr=113516

[2026-08-06 09:00:24] >>>> clang-tidy-cache stats

[2026-08-06 09:00:24] Run command: [clang-tidy-cache.py --show-stats]
[2026-08-06 09:00:25] Server host:            localhost
[2026-08-06 09:00:25] Server port:            5000
[2026-08-06 09:00:25] Long-term hit rate:     N/A
[2026-08-06 09:00:25] Hit rate:               99.9 %
[2026-08-06 09:00:25] Hit count:              4702
[2026-08-06 09:00:25] Miss count:             4
[2026-08-06 09:00:25] Miss rate:              0.1 %
[2026-08-06 09:00:25] Max hash age:           N/A
[2026-08-06 09:00:25] Max hash hits:          N/A
[2026-08-06 09:00:25] Cache size:             N/A
[2026-08-06 09:00:25] Cached hashes:          N/A
[2026-08-06 09:00:25] Cleaned hashes:         N/A
[2026-08-06 09:00:25] Cleaned ago:            N/A
[2026-08-06 09:00:25] Saved ago:              N/A
[2026-08-06 09:00:25] Uptime:                 N/A
[2026-08-06 09:00:25] Hit rate (local):       N/A
[2026-08-06 09:00:25] Hit count (local):      N/A
[2026-08-06 09:00:25] Miss count (local):     N/A
[2026-08-06 09:00:25] Miss rate (local):      N/A
[2026-08-06 09:00:25] Cached hashes (local):  N/A

[2026-08-06 09:00:25] <<<< clang-tidy-cache stats


[2026-08-06 09:00:25] >>>> clang-tidy-cache.log stats

[2026-08-06 09:00:25] Run command: [echo "$(grep "exists in cache" ./ci/tmp/clang-tidy-cache.log | wc -l) in cache
[2026-08-06 09:00:25] $(grep "does not exist in cache" ./ci/tmp/clang-tidy-cache.log | wc -l) not in cache"]
[2026-08-06 09:00:25] 4702 in cache
[2026-08-06 09:00:25] 4 not in cache

[2026-08-06 09:00:25] <<<< clang-tidy-cache.log stats

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants