From 06b063e3100249e1acf3b53daf3f7c69618b2703 Mon Sep 17 00:00:00 2001 From: Brandon Duffany Date: Wed, 6 Nov 2024 13:44:27 -0800 Subject: [PATCH] Fix nil digest error logged when calling BatchReadBlobs (#7856) --- server/remote_cache/cachetools/cachetools.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/remote_cache/cachetools/cachetools.go b/server/remote_cache/cachetools/cachetools.go index 5883d052612..d8863e9f22b 100644 --- a/server/remote_cache/cachetools/cachetools.go +++ b/server/remote_cache/cachetools/cachetools.go @@ -144,9 +144,12 @@ func GetBlob(ctx context.Context, bsClient bspb.ByteStreamClient, r *digest.Reso // BlobResponse is a response to an individual blob in a BatchReadBlobs request. type BlobResponse struct { + // Digest identifies the blob that was requested. Digest *repb.Digest - Data []byte + // Data contains the blob contents if it was fetched successfully. + Data []byte + // Err holds any error encountered when fetching the blob. Err error } @@ -185,7 +188,10 @@ func batchReadBlobs(ctx context.Context, casClient repb.ContentAddressableStorag err := gstatus.ErrorProto(res.GetStatus()) if err != nil { - results = append(results, &BlobResponse{Err: err}) + results = append(results, &BlobResponse{ + Digest: res.GetDigest(), + Err: err, + }) continue } data := res.Data