From a05da8657203d4ad41fd8ab715dc850679a1c3ba Mon Sep 17 00:00:00 2001 From: Tobias Schottdorf Date: Wed, 29 Apr 2020 17:14:58 +0200 Subject: [PATCH] spanset: print stack with assertion error It's going to be much easier figuring out what happened when the stack is included. See #48147. Release note: None --- pkg/kv/kvserver/spanset/spanset.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/kv/kvserver/spanset/spanset.go b/pkg/kv/kvserver/spanset/spanset.go index 4b736b710016..3c01e1dafe04 100644 --- a/pkg/kv/kvserver/spanset/spanset.go +++ b/pkg/kv/kvserver/spanset/spanset.go @@ -13,6 +13,7 @@ package spanset import ( "context" "fmt" + "runtime/debug" "strings" "github.com/cockroachdb/cockroach/pkg/keys" @@ -289,7 +290,7 @@ func (s *SpanSet) checkAllowed( } } - return errors.Errorf("cannot %s undeclared span %s\ndeclared:\n%s", access, span, s) + return errors.Errorf("cannot %s undeclared span %s\ndeclared:\n%s\nstack:\n%s", access, span, s, debug.Stack()) } // contains returns whether s1 contains s2. Unlike Span.Contains, this function