aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZousar Shaker <[email protected]>2025-09-29 03:55:02 -0600
committerGitHub Enterprise <[email protected]>2025-09-29 11:55:02 +0200
commitbfafc9bfc35bbcb4c1def817c93ad36134bf7983 (patch)
treea88bf3244f55cec9780f5287788a11556ddfc229
parentmake cpr a HttpClient implementation detail (#517) (diff)
downloadzen-bfafc9bfc35bbcb4c1def817c93ad36134bf7983.tar.xz
zen-bfafc9bfc35bbcb4c1def817c93ad36134bf7983.zip
GetCacheChunk value request respects RawHash (#518)
When requesting a value via the GetCacheChunks rpc method, if the request specified a raw hash, only return a hit if the raw hash matches what was in the cache.
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/zenstore/cache/cacherpc.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 09bf35b3a..ab62e9bc8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,8 @@
##
-
- Bugfix: Fixed invalid namespace+bucket regexes in BuildStore (only fired with new MSVC compiler)
- Bugfix: `GcScheduler` could delay shutdown in some situations
- Bugfix: On exit, trace shutdown can happen before all threads completed their TLS cleanup
+- Bugfix: When requesting a value via the GetCacheChunks rpc method, if the request specified a raw hash, only return a hit if the raw hash matches what was in the cache
## 5.7.2
- Feature: Added `--force` option to `zen builds download` command that forces download of all content ignoring any local state
diff --git a/src/zenstore/cache/cacherpc.cpp b/src/zenstore/cache/cacherpc.cpp
index e4f23816d..fdee017e0 100644
--- a/src/zenstore/cache/cacherpc.cpp
+++ b/src/zenstore/cache/cacherpc.cpp
@@ -1823,7 +1823,9 @@ CacheRpcHandler::GetLocalCacheValues(const CacheRequestContext& Context,
ChunkRequest* Request = ValueRequests[RequestIndex];
if (Chunks[RequestIndex].Value)
{
- if (IsCompressedBinary(Chunks[RequestIndex].Value.GetContentType()))
+ // If the request included a raw hash, only offer a result if the RawHash matched what we found in storage
+ if (IsCompressedBinary(Chunks[RequestIndex].Value.GetContentType()) &&
+ ((Request->Key->ChunkId == IoHash::Zero) || (Request->Key->ChunkId == Chunks[RequestIndex].RawHash)))
{
Request->Key->ChunkId = Chunks[RequestIndex].RawHash;
Request->Exists = true;