From bfafc9bfc35bbcb4c1def817c93ad36134bf7983 Mon Sep 17 00:00:00 2001 From: Zousar Shaker Date: Mon, 29 Sep 2025 03:55:02 -0600 Subject: 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. --- src/zenstore/cache/cacherpc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/zenstore/cache/cacherpc.cpp') 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; -- cgit v1.2.3