-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix panic when reporting shard diagnostics #2430
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3335,6 +3335,7 @@ func (s *Server) DiagnosticsAsRows() []*influxql.Row { | |
shardsRow.Name = "shards_diag" | ||
shardsRow.Columns = append(shardsRow.Columns, "time", "id", "dataNodes", "index") | ||
shardsRow.Tags = tags | ||
var hasPath bool | ||
for _, sh := range s.shards { | ||
var nodes []string | ||
for _, n := range sh.DataNodeIDs { | ||
|
@@ -3345,9 +3346,14 @@ func (s *Server) DiagnosticsAsRows() []*influxql.Row { | |
|
||
// Shard may not be local to this node. | ||
if sh.store != nil { | ||
shardsRow.Columns = append(shardsRow.Columns, "path") | ||
shardsRow.Values[0] = append(shardsRow.Values[0], sh.store.Path()) | ||
if !hasPath { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is necessary. If a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @otoolep but you iterate through each shard. The hasPath variable controls if if the path column has been added before or we need to add it as it's the first time it appears. Otherwise the path column get's appended multiple times unnecessarily |
||
shardsRow.Columns = append(shardsRow.Columns, "path") | ||
hasPath = true | ||
} | ||
index := len(shardsRow.Values) - 1 // Current shardsRow.Values index | ||
shardsRow.Values[index] = append(shardsRow.Values[index], sh.store.Path()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this is right, but I might be missing something. Can you show some raw data to explain what you are trying to fix? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, before my change the server was doing something like this:
And it panicked because the second row didn't contain a path. After my change is doing this
My understanding by looking at the code is that the |
||
} | ||
|
||
} | ||
|
||
return []*influxql.Row{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these changes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, OK, to repro the error.
Well, let me run your code, and I'll see if I can get answers to my questions below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because we need to to actually generate some shard data for the diag module to process it. Before this change the server diagnostic was just processing some basic information but not shard data