Skip to content

Commit

Permalink
kvserver: fix replicate queue metrics tracking bug
Browse files Browse the repository at this point in the history
In cockroachdb#85844, tracking replicate queue success and error metrics by
allocator action was introduced, however this change inadvertently
included a bug due to missing the `RemoveDead(Non)Voter` allocator
action case, in combination with a panic on unexpected actions. This
change fixes the missing case as well as the panic.

Release justification: Bug fix
Release note: None
  • Loading branch information
AlexTalks committed Aug 25, 2022
1 parent bdadde2 commit 053abc0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/kv/kvserver/replicate_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,12 @@ func (metrics *ReplicateQueueMetrics) trackResultByAllocatorAction(
} else {
metrics.ReplaceDeadReplicaErrorCount.Inc(1)
}
case allocatorimpl.AllocatorRemoveDeadVoter, allocatorimpl.AllocatorRemoveDeadNonVoter:
if err == nil {
metrics.RemoveDeadReplicaSuccessCount.Inc(1)
} else {
metrics.RemoveDeadReplicaErrorCount.Inc(1)
}
case allocatorimpl.AllocatorReplaceDecommissioningVoter, allocatorimpl.AllocatorReplaceDecommissioningNonVoter:
if err == nil {
metrics.ReplaceDecommissioningReplicaSuccessCount.Inc(1)
Expand All @@ -494,7 +500,7 @@ func (metrics *ReplicateQueueMetrics) trackResultByAllocatorAction(
metrics.RemoveDecommissioningReplicaErrorCount.Inc(1)
}
default:
panic(fmt.Sprintf("unsupported AllocatorAction: %v", action))
// Unsupported AllocatorAction.
}
}

Expand Down

0 comments on commit 053abc0

Please sign in to comment.