fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

search: log query when a shard crashes (#1032)

It would be useful to know the query which caused a shard to crash.

+4 -3
+4 -3
search/shards.go
··· 932 932 } 933 933 } 934 934 935 - func logShardCrash(operation string, s zoekt.Searcher, recovered any, stack []byte) { 935 + func logShardCrash(operation string, s zoekt.Searcher, q query.Q, recovered any, stack []byte) { 936 936 fields := []sglog.Field{ 937 937 sglog.String("operation", operation), 938 938 sglog.String("shard", s.String()), 939 + sglog.String("query", q.String()), 939 940 sglog.String("stacktrace", string(stack)), 940 941 } 941 942 ··· 953 954 defer func() { 954 955 metricSearchShardRunning.Dec() 955 956 if e := recover(); e != nil { 956 - logShardCrash("search", s, e, debug.Stack()) 957 + logShardCrash("search", s, q, e, debug.Stack()) 957 958 958 959 if sr == nil { 959 960 sr = &zoekt.SearchResult{} ··· 975 976 defer func() { 976 977 metricListShardRunning.Dec() 977 978 if r := recover(); r != nil { 978 - logShardCrash("list", s, r, debug.Stack()) 979 + logShardCrash("list", s, q, r, debug.Stack()) 979 980 sink <- shardListResult{ 980 981 &zoekt.RepoList{Crashes: 1}, nil, 981 982 }