This is an automated email from the ASF dual-hosted git repository.

pitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 82b6fa5780 GH-50208: [CI][C++][Python] Disable ccache `hash_dir` 
(#50209)
82b6fa5780 is described below

commit 82b6fa57803f8161132a2cb0100ae81873c7b517
Author: Antoine Pitrou <[email protected]>
AuthorDate: Thu Jun 18 11:29:46 2026 +0200

    GH-50208: [CI][C++][Python] Disable ccache `hash_dir` (#50209)
    
    ### Rationale for this change
    
    By default, ccache hashes the path to the current directory in its cache 
key. However, some builds put their source files in a temporary directory (such 
as Python builds), which makes caching inefficient as the current directory is 
different everytime.
    
    ### What changes are included in this PR?
    
    Disable the ccache `hash_dir` option on CI, using an environment variable.
    
    ### Are these changes tested?
    
    Yes, by existing CI jobs.
    
    I also checked locally using `ccache -s` that this improves the caching of 
compiled C++ artifacts (from the source files in `python/pyarrow/src`) when 
building PyArrow.
    
    ### Are there any user-facing changes?
    
    No.
    
    * GitHub Issue: #50208
    
    Authored-by: Antoine Pitrou <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 ci/scripts/ccache_setup.sh | 2 ++
 compose.yaml               | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/ci/scripts/ccache_setup.sh b/ci/scripts/ccache_setup.sh
index df00efe702..4006a63a73 100755
--- a/ci/scripts/ccache_setup.sh
+++ b/ci/scripts/ccache_setup.sh
@@ -19,10 +19,12 @@
 
 set -eux
 
+# See similar definitions in compose.yaml under the `x-ccache` key
 {
   echo "ARROW_USE_CCACHE=ON"
   echo "CCACHE_COMPILERCHECK=content"
   echo "CCACHE_COMPRESS=1"
   echo "CCACHE_COMPRESSLEVEL=6"
   echo "CCACHE_MAXSIZE=1G"
+  echo "CCACHE_NOHASHDIR=1"
 } >> "$GITHUB_ENV"
diff --git a/compose.yaml b/compose.yaml
index 119a8fc589..dbb22862ae 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -59,6 +59,9 @@ x-ccache: &ccache
   CCACHE_COMPRESSLEVEL: 6
   CCACHE_MAXSIZE: 1G
   CCACHE_DIR: /ccache
+  # Some builds (such as PyArrow) copy their source files in a temporary 
directory,
+  # avoid hashing the current directory to make ccache useful on those builds.
+  CCACHE_NOHASHDIR: 1
 
 x-common: &common
   GITHUB_ACTIONS:

Reply via email to