From 6e458d88918c5f7b4eeff56270d93dd92a1177c5 Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Mon, 21 Mar 2022 10:49:47 +0100 Subject: [PATCH 1/2] Revert "kvserver: disable assertion in SetPriorityID" This reverts commit 86f51efb26c709192f0aa4c839930334270ffa42. Release note (): --- pkg/kv/kvserver/scheduler.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/kv/kvserver/scheduler.go b/pkg/kv/kvserver/scheduler.go index d658c72a1428..9a2712c0e6c5 100644 --- a/pkg/kv/kvserver/scheduler.go +++ b/pkg/kv/kvserver/scheduler.go @@ -121,10 +121,7 @@ func (q *rangeIDQueue) Len() int { } func (q *rangeIDQueue) SetPriorityID(id roachpb.RangeID) { - if q.priorityID != 0 && q.priorityID != id && - // This assertion is temporarily disabled, see: - // https://github.com/cockroachdb/cockroach/issues/75939 - false { + if q.priorityID != 0 && q.priorityID != id { panic(fmt.Sprintf( "priority range ID already set: old=%d, new=%d", q.priorityID, id)) From 0695b83ff06561ed575cd4d8579c17dc72e2814c Mon Sep 17 00:00:00 2001 From: Tobias Grieger Date: Mon, 21 Mar 2022 10:59:17 +0100 Subject: [PATCH 2/2] kvserver: print old stack in SetPriorityID assertion See #75939. The issue appears to have been fixed; I've run 100ks of iterations without a reproduction. Should it ever reproduce, the additional stack trace should give valuable clues to debug the issue anew. Release note: None --- pkg/kv/kvserver/scheduler.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/kv/kvserver/scheduler.go b/pkg/kv/kvserver/scheduler.go index 9a2712c0e6c5..dbfdddb843d6 100644 --- a/pkg/kv/kvserver/scheduler.go +++ b/pkg/kv/kvserver/scheduler.go @@ -14,6 +14,7 @@ import ( "container/list" "context" "fmt" + "runtime/debug" "sync" "github.com/cockroachdb/cockroach/pkg/roachpb" @@ -76,6 +77,7 @@ type rangeIDQueue struct { // High priority. priorityID roachpb.RangeID + priorityStack []byte // for debugging in case of assertion failure; see #75939 priorityQueued bool } @@ -123,9 +125,10 @@ func (q *rangeIDQueue) Len() int { func (q *rangeIDQueue) SetPriorityID(id roachpb.RangeID) { if q.priorityID != 0 && q.priorityID != id { panic(fmt.Sprintf( - "priority range ID already set: old=%d, new=%d", - q.priorityID, id)) + "priority range ID already set: old=%d, new=%d, first set at:\n\n%s", + q.priorityID, id, q.priorityStack)) } + q.priorityStack = debug.Stack() q.priorityID = id }