zhengruifeng commented on PR #56324:
URL: https://github.com/apache/spark/pull/56324#issuecomment-4631461833

   **Why `zstd` is required**
   
   `@actions/cache` computes a cache **version** as `SHA256(paths + 
compression_method)` and includes it in the cache API request URL. This version 
is what distinguishes "the same key saved with different compression" — two 
entries can coexist under the same key string but different versions.
   
   - Host runners have `zstd` installed → the action uses `zstdmt` → version = 
`SHA256(paths + "zstd")`
   - Container images lacked `zstd` → the action fell back to `gzip` → version 
= `SHA256(paths + "gzip")`
   
   So even when the key string matched exactly, the cache lookup URL differed → 
every restore in a container reported `Cache not found`, despite the entry 
existing.
   
   This is why the `build-` (SBT/Maven tools) cache *did* work in containers: 
it's saved by both host *and* container jobs (using `actions/cache@v5`), so 
both a zstd-version entry (from host jobs) and a gzip-version entry (from a 
container job) existed simultaneously. Containers found the gzip entry; hosts 
found the zstd entry. The Coursier cache was only ever saved by the host-runner 
`precompile` job, so only the zstd version existed → containers always missed.
   
   The relevant source is 
[`packages/cache/src/internal/cacheUtils.ts`](https://github.com/actions/toolkit/blob/main/packages/cache/src/internal/cacheUtils.ts)
 in the `@actions/toolkit` repo.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to