[arvados] updated: 2.7.0-5677-g8a75f8623b

git repository hosting git at public.arvados.org
Tue Jan 16 22:32:36 UTC 2024


Summary of changes:
 sdk/go/arvados/keep_cache.go | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

       via  8a75f8623b74b17d56180fb08f4d86168662776f (commit)
      from  f6e6f83268a4665a050d10b4a790906598dc1018 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 8a75f8623b74b17d56180fb08f4d86168662776f
Author: Tom Clegg <tom at curii.com>
Date:   Tue Jan 16 17:32:01 2024 -0500

    20318: Update stale comments to match current error handling.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/sdk/go/arvados/keep_cache.go b/sdk/go/arvados/keep_cache.go
index f6265d5d0a..108081d5ac 100644
--- a/sdk/go/arvados/keep_cache.go
+++ b/sdk/go/arvados/keep_cache.go
@@ -373,24 +373,23 @@ func (cache *DiskCache) ReadAt(locator string, dst []byte, offset int) (int, err
 
 	if err != nil {
 		// If the copy-from-backend goroutine encountered an
-		// error before copying enough bytes to satisfy our
-		// request, we return that error.
+		// error, we return that error. (Even if we read the
+		// desired number of bytes, the error might be
+		// something like BadChecksum so we should not ignore
+		// it.)
 		return 0, err
-	} else if len(dst) == 0 {
+	}
+	if len(dst) == 0 {
 		// It's possible that sharedf==nil here (the writer
 		// goroutine might not have done anything at all yet)
 		// and we don't need it anyway because no bytes are
 		// being read. Reading zero bytes seems pointless, but
 		// if someone does it, we might as well return
-		// suitable values, and not crash.
+		// suitable values, rather than risk a crash by
+		// calling sharedf.ReadAt() when sharedf is nil.
 		return 0, nil
-	} else {
-		// Regardless of whether the copy-from-backend
-		// goroutine succeeded, or failed after copying the
-		// bytes we need, the only errors we need to report
-		// are errors reading from the cache file.
-		return sharedf.ReadAt(dst, int64(offset))
 	}
+	return sharedf.ReadAt(dst, int64(offset))
 }
 
 var quickReadAtLostRace = errors.New("quickReadAt: lost race")

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list