@@ -2918,7 +2918,7 @@ func (r *Replica) TestingRefreshLeaderlessWatcherUnavailableState(
2918
2918
// manner via the replica scanner, see #130199. This functionality is disabled
2919
2919
// by default for this reason.
2920
2920
func (r * Replica ) maybeEnqueueProblemRange (
2921
- ctx context.Context , now time.Time , leaseValid , isLeaseholder bool , shouldLog bool ,
2921
+ ctx context.Context , now time.Time , leaseValid , isLeaseholder bool , maybeLog bool ,
2922
2922
) {
2923
2923
2924
2924
// The method expects the caller to provide whether the lease is valid and
@@ -2959,44 +2959,28 @@ func (r *Replica) maybeEnqueueProblemRange(
2959
2959
r .store .metrics .DecommissioningNudgerEnqueue .Inc (1 )
2960
2960
// TODO(dodeca12): Figure out a better way to track the
2961
2961
// decommissioning nudger enqueue failures/errors.
2962
+ level := log .Level (2 )
2963
+ if maybeLog {
2964
+ level = log .Level (0 )
2965
+ }
2962
2966
r .store .replicateQueue .AddAsyncWithCallback (ctx , r ,
2963
2967
allocatorimpl .AllocatorReplaceDecommissioningVoter .Priority (), processCallback {
2964
2968
onEnqueueResult : func (indexOnHeap int , err error ) {
2965
- if shouldLog {
2966
- if err != nil {
2967
- log .KvDistribution .Infof (ctx ,
2968
- "decommissioning nudger failed to enqueue range %v due to %v" , r .Desc (), err )
2969
- } else {
2970
- log .KvDistribution .Infof (ctx ,
2971
- "decommissioning nudger successfully enqueued range %v at index %d" , r .Desc (), indexOnHeap )
2972
- }
2969
+ if err != nil {
2970
+ log .KvDistribution .VInfof (ctx , level ,
2971
+ "decommissioning nudger failed to enqueue range %v due to %v" , r .Desc (), err )
2973
2972
} else {
2974
- if err != nil {
2975
- log .KvDistribution .VInfof (ctx , 2 ,
2976
- "decommissioning nudger failed to enqueue range %v due to %v" , r .Desc (), err )
2977
- } else {
2978
- log .KvDistribution .VInfof (ctx , 2 ,
2979
- "decommissioning nudger successfully enqueued range %v at index %d" , r .Desc (), indexOnHeap )
2980
- }
2973
+ log .KvDistribution .VInfof (ctx , level ,
2974
+ "decommissioning nudger successfully enqueued range %v at index %d" , r .Desc (), indexOnHeap )
2981
2975
}
2982
2976
},
2983
2977
onProcessResult : func (err error ) {
2984
- if shouldLog {
2985
- if err != nil {
2986
- log .KvDistribution .Infof (ctx ,
2987
- "decommissioning nudger failed to process range %v due to %v" , r .Desc (), err )
2988
- } else {
2989
- log .KvDistribution .Infof (ctx ,
2990
- "decommissioning nudger successfully processed replica %s" , r .Desc ())
2991
- }
2978
+ if err != nil {
2979
+ log .KvDistribution .VInfof (ctx , level ,
2980
+ "decommissioning nudger failed to process range %v due to %v" , r .Desc (), err )
2992
2981
} else {
2993
- if err != nil {
2994
- log .KvDistribution .VInfof (ctx , 2 ,
2995
- "decommissioning nudger failed to process range %v due to %v" , r .Desc (), err )
2996
- } else {
2997
- log .KvDistribution .VInfof (ctx , 2 ,
2998
- "decommissioning nudger successfully processed replica %s" , r .Desc ())
2999
- }
2982
+ log .KvDistribution .VInfof (ctx , level ,
2983
+ "decommissioning nudger successfully processed replica %s" , r .Desc ())
3000
2984
}
3001
2985
},
3002
2986
})
0 commit comments