Skip to content

Commit

Permalink
rac2: allow kvflowcontrol.TestingKnobs to be nil
Browse files Browse the repository at this point in the history
Epic: CRDB-37515

Release note: None
  • Loading branch information
sumeerbhola committed Oct 7, 2024
1 parent 0ce3817 commit 1937d99
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/kv/kvserver/kvflowcontrol/rac2/range_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2031,8 +2031,10 @@ func (rss *replicaSendStream) handleReadyEntriesLocked(
}
}
tokens := entry.tokens
if fn := rss.parent.parent.opts.Knobs.OverrideTokenDeduction; fn != nil {
tokens = fn(tokens)
if rss.parent.parent.opts.Knobs != nil {
if fn := rss.parent.parent.opts.Knobs.OverrideTokenDeduction; fn != nil {
tokens = fn(tokens)
}
}
if inSendQueue && entry.index >= rss.mu.nextRaftIndexInitial {
// Was in send-queue and had eval tokens deducted for it.
Expand Down Expand Up @@ -2074,8 +2076,10 @@ func (rss *replicaSendStream) handleReadyEntriesLocked(
pri = entry.pri
}
tokens := entry.tokens
if fn := rss.parent.parent.opts.Knobs.OverrideTokenDeduction; fn != nil {
tokens = fn(tokens)
if rss.parent.parent.opts.Knobs != nil {
if fn := rss.parent.parent.opts.Knobs.OverrideTokenDeduction; fn != nil {
tokens = fn(tokens)
}
}
if inSendQueue && entry.index >= rss.mu.nextRaftIndexInitial {
// Is in send-queue and will have eval tokens deducted for it.
Expand Down

0 comments on commit 1937d99

Please sign in to comment.