Skip to content

Commit

Permalink
spanset: print stack with assertion error
Browse files Browse the repository at this point in the history
It's going to be much easier figuring out what happened when the stack
is included.

See cockroachdb#48147.

Release note: None
  • Loading branch information
tbg committed Apr 29, 2020
1 parent 05e45df commit a05da86
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/kv/kvserver/spanset/spanset.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package spanset
import (
"context"
"fmt"
"runtime/debug"
"strings"

"github.com/cockroachdb/cockroach/pkg/keys"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a05da86

Please sign in to comment.