Skip to content

Commit

Permalink
Stop printing warnings when we get redis.Nil errors. (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
fische authored May 7, 2024
1 parent f31b091 commit a710d29
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 11.10.1
--------------
* Stop printing warnings when we get redis.Nil errors.

Version 11.10.0
--------------
* Move redis flags to a common package.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.10.0
11.10.1
20 changes: 10 additions & 10 deletions elan/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@ func (s *server) FindMissingBlobs(ctx context.Context, req *pb.FindMissingBlobsR
}

// blobExists returns true if this blob exists in the underlying storage.
func (s *server) blobExists(ctx context.Context, prefix string, digest *pb.Digest, compressed, redis bool) bool {
if redis && s.readRedis != nil && prefix == CASPrefix && digest.SizeBytes < s.redisMaxSize {
func (s *server) blobExists(ctx context.Context, prefix string, digest *pb.Digest, compressed, redisRequest bool) bool {
if redisRequest && s.readRedis != nil && prefix == CASPrefix && digest.SizeBytes < s.redisMaxSize {
exists, err := s.readRedis.Exists(ctx, digest.Hash).Result()
if err != nil {
if err != nil && err != redis.Nil {
log.Warningf("Failed to check blob in Redis: %v", err)
} else if exists > 0 {
} else if err != redis.Nil && exists > 0 {
return true
}
}
Expand Down Expand Up @@ -531,13 +531,13 @@ func (s *server) readCompressed(ctx context.Context, prefix string, digest *pb.D
// NOTE: we could use GETRANGE here, but given it's a bit more expensive on the redis
// side and redisMaxSize is quite small, we get the whole blob
blob, err := s.readRedis.Get(ctx, digest.Hash).Bytes()
if err != nil {
if err != nil && err != redis.Nil {
log.Warningf("Failed to get blob in Redis: %v", err)
} else if blob != nil && limit == 0 {
} else if err != redis.Nil && blob != nil && limit == 0 {
return ioutil.NopCloser(bytes.NewReader(nil)), false, nil
} else if blob != nil && limit > 0 {
} else if err != redis.Nil && blob != nil && limit > 0 {
return io.NopCloser(bytes.NewReader(blob[offset : offset+limit])), false, nil
} else if blob != nil && limit < 0 {
} else if err != redis.Nil && blob != nil && limit < 0 {
return io.NopCloser(bytes.NewReader(blob[offset:])), false, nil
}
}
Expand Down Expand Up @@ -623,9 +623,9 @@ func (s *server) readAllBlobBatched(ctx context.Context, prefix string, digest *

if s.readRedis != nil && prefix == CASPrefix && digest.SizeBytes < s.redisMaxSize {
blob, err := s.readRedis.Get(ctx, digest.Hash).Bytes()
if err != nil {
if err != nil && err != redis.Nil {
log.Warningf("Failed to get blob in Redis: %v", err)
} else if blob != nil {
} else if err != redis.Nil && blob != nil {
return blob, false, nil
}
}
Expand Down

0 comments on commit a710d29

Please sign in to comment.