@@ -2567,7 +2567,7 @@ func (r *Replica) GetMutexForTesting() *ReplicaMutex {
2567
2567
// manner via the replica scanner, see #130199. This functionality is disabled
2568
2568
// by default for this reason.
2569
2569
func (r * Replica ) maybeEnqueueProblemRange (
2570
- ctx context.Context , now time.Time , leaseValid , isLeaseholder bool , shouldLog bool ,
2570
+ ctx context.Context , now time.Time , leaseValid , isLeaseholder bool , maybeLog bool ,
2571
2571
) {
2572
2572
2573
2573
// The method expects the caller to provide whether the lease is valid and
@@ -2608,44 +2608,28 @@ func (r *Replica) maybeEnqueueProblemRange(
2608
2608
r .store .metrics .DecommissioningNudgerEnqueue .Inc (1 )
2609
2609
// TODO(dodeca12): Figure out a better way to track the
2610
2610
// decommissioning nudger enqueue failures/errors.
2611
+ level := log .Level (2 )
2612
+ if maybeLog {
2613
+ level = log .Level (0 )
2614
+ }
2611
2615
r .store .replicateQueue .AddAsyncWithCallback (ctx , r ,
2612
2616
allocatorimpl .AllocatorReplaceDecommissioningVoter .Priority (), processCallback {
2613
2617
onEnqueueResult : func (indexOnHeap int , err error ) {
2614
- if shouldLog {
2615
- if err != nil {
2616
- log .KvDistribution .Infof (ctx ,
2617
- "decommissioning nudger failed to enqueue range %v due to %v" , r .Desc (), err )
2618
- } else {
2619
- log .KvDistribution .Infof (ctx ,
2620
- "decommissioning nudger successfully enqueued range %v at index %d" , r .Desc (), indexOnHeap )
2621
- }
2618
+ if err != nil {
2619
+ log .KvDistribution .VInfof (ctx , level ,
2620
+ "decommissioning nudger failed to enqueue range %v due to %v" , r .Desc (), err )
2622
2621
} else {
2623
- if err != nil {
2624
- log .KvDistribution .VInfof (ctx , 2 ,
2625
- "decommissioning nudger failed to enqueue range %v due to %v" , r .Desc (), err )
2626
- } else {
2627
- log .KvDistribution .VInfof (ctx , 2 ,
2628
- "decommissioning nudger successfully enqueued range %v at index %d" , r .Desc (), indexOnHeap )
2629
- }
2622
+ log .KvDistribution .VInfof (ctx , level ,
2623
+ "decommissioning nudger successfully enqueued range %v at index %d" , r .Desc (), indexOnHeap )
2630
2624
}
2631
2625
},
2632
2626
onProcessResult : func (err error ) {
2633
- if shouldLog {
2634
- if err != nil {
2635
- log .KvDistribution .Infof (ctx ,
2636
- "decommissioning nudger failed to process range %v due to %v" , r .Desc (), err )
2637
- } else {
2638
- log .KvDistribution .Infof (ctx ,
2639
- "decommissioning nudger successfully processed replica %s" , r .Desc ())
2640
- }
2627
+ if err != nil {
2628
+ log .KvDistribution .VInfof (ctx , level ,
2629
+ "decommissioning nudger failed to process range %v due to %v" , r .Desc (), err )
2641
2630
} else {
2642
- if err != nil {
2643
- log .KvDistribution .VInfof (ctx , 2 ,
2644
- "decommissioning nudger failed to process range %v due to %v" , r .Desc (), err )
2645
- } else {
2646
- log .KvDistribution .VInfof (ctx , 2 ,
2647
- "decommissioning nudger successfully processed replica %s" , r .Desc ())
2648
- }
2631
+ log .KvDistribution .VInfof (ctx , level ,
2632
+ "decommissioning nudger successfully processed replica %s" , r .Desc ())
2649
2633
}
2650
2634
},
2651
2635
})
0 commit comments