Skip to content

Commit

Permalink
feat: when the cache is missing, change the error log to a warning log (
Browse files Browse the repository at this point in the history
#2235)

Signed-off-by: Gaius <gaius.qi@gmail.com>
  • Loading branch information
gaius-qi authored Mar 31, 2023
1 parent 38ba453 commit 0a83607
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions manager/rpcserver/manager_server_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (s *managerServerV1) GetSeedPeer(ctx context.Context, req *managerv1.GetSee
// Cache hit.
var pbSeedPeer managerv1.SeedPeer
if err := s.cache.Get(ctx, cacheKey, &pbSeedPeer); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbSeedPeer, nil
Expand Down Expand Up @@ -270,7 +270,7 @@ func (s *managerServerV1) GetScheduler(ctx context.Context, req *managerv1.GetSc
// Cache hit.
var pbScheduler managerv1.Scheduler
if err := s.cache.Get(ctx, cacheKey, &pbScheduler); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbScheduler, nil
Expand Down Expand Up @@ -487,7 +487,7 @@ func (s *managerServerV1) ListSchedulers(ctx context.Context, req *managerv1.Lis
cacheKey := cache.MakeSchedulersCacheKeyForPeer(req.Hostname, req.Ip)

if err := s.cache.Get(ctx, cacheKey, &pbListSchedulersResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListSchedulersResponse, nil
Expand Down Expand Up @@ -630,7 +630,7 @@ func (s *managerServerV1) ListBuckets(ctx context.Context, req *managerv1.ListBu

// Cache hit.
if err := s.cache.Get(ctx, cacheKey, &pbListBucketsResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListBucketsResponse, nil
Expand Down Expand Up @@ -670,7 +670,7 @@ func (s *managerServerV1) ListApplications(ctx context.Context, req *managerv1.L
var pbListApplicationsResponse managerv1.ListApplicationsResponse
cacheKey := cache.MakeApplicationsCacheKey()
if err := s.cache.Get(ctx, cacheKey, &pbListApplicationsResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListApplicationsResponse, nil
Expand Down
10 changes: 5 additions & 5 deletions manager/rpcserver/manager_server_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (s *managerServerV2) GetSeedPeer(ctx context.Context, req *managerv2.GetSee
// Cache hit.
var pbSeedPeer managerv2.SeedPeer
if err := s.cache.Get(ctx, cacheKey, &pbSeedPeer); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbSeedPeer, nil
Expand Down Expand Up @@ -270,7 +270,7 @@ func (s *managerServerV2) GetScheduler(ctx context.Context, req *managerv2.GetSc
// Cache hit.
var pbScheduler managerv2.Scheduler
if err := s.cache.Get(ctx, cacheKey, &pbScheduler); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbScheduler, nil
Expand Down Expand Up @@ -487,7 +487,7 @@ func (s *managerServerV2) ListSchedulers(ctx context.Context, req *managerv2.Lis
cacheKey := cache.MakeSchedulersCacheKeyForPeer(req.Hostname, req.Ip)

if err := s.cache.Get(ctx, cacheKey, &pbListSchedulersResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListSchedulersResponse, nil
Expand Down Expand Up @@ -629,7 +629,7 @@ func (s *managerServerV2) ListBuckets(ctx context.Context, req *managerv2.ListBu

// Cache hit.
if err := s.cache.Get(ctx, cacheKey, &pbListBucketsResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListBucketsResponse, nil
Expand Down Expand Up @@ -669,7 +669,7 @@ func (s *managerServerV2) ListApplications(ctx context.Context, req *managerv2.L
var pbListApplicationsResponse managerv2.ListApplicationsResponse
cacheKey := cache.MakeApplicationsCacheKey()
if err := s.cache.Get(ctx, cacheKey, &pbListApplicationsResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListApplicationsResponse, nil
Expand Down

0 comments on commit 0a83607

Please sign in to comment.