Skip to content

Commit

Permalink
Always append shard path in diags
Browse files Browse the repository at this point in the history
This code is clearer -- simply append an empty path if the shard is not
local.

Fixes issue #2430
  • Loading branch information
otoolep committed Apr 26, 2015
1 parent 8b12472 commit 257aa4d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [#2426](https://github.com/influxdb/influxdb/pull/2426): Fix race condition around listener address in openTSDB server.
- [#2426](https://github.com/influxdb/influxdb/pull/2426): Fix race condition around listener address in Graphite server.
- [#2429](https://github.com/influxdb/influxdb/pull/2429): Ensure no field value is null.
- [#2431](https://github.com/influxdb/influxdb/pull/2431): Always append shard path in diags. Thanks @marcosnils

### Features
- [#2410](https://github.com/influxdb/influxdb/pull/2410) Allow configuration of Raft timers
Expand Down
5 changes: 5 additions & 0 deletions cmd/influxd/server_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,11 @@ func TestSingleServerDiags(t *testing.T) {
nodes := createCombinedNodeCluster(t, testName, dir, 1, config)
defer nodes.Close()

// Ensure some data shards also exist.
createDatabase(t, testName, nodes, "mydb")
createRetentionPolicy(t, testName, nodes, "mydb", "myrp", len(nodes))
write(t, nodes[0], `{"database" : "mydb", "retentionPolicy" : "myrp", "points": [{"name": "cpu", "fields": {"value": 100}}]}`)

time.Sleep(1 * time.Second)
}

Expand Down
12 changes: 5 additions & 7 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3339,21 +3339,19 @@ func (s *Server) DiagnosticsAsRows() []*influxql.Row {
// Shards
shardsRow := &influxql.Row{Columns: []string{}}
shardsRow.Name = "shards_diag"
shardsRow.Columns = append(shardsRow.Columns, "time", "id", "dataNodes", "index")
shardsRow.Columns = append(shardsRow.Columns, "time", "id", "dataNodes", "index", "path")
shardsRow.Tags = tags
for _, sh := range s.shards {
var nodes []string
for _, n := range sh.DataNodeIDs {
nodes = append(nodes, strconv.FormatUint(n, 10))
}
shardsRow.Values = append(shardsRow.Values, []interface{}{now, strconv.FormatUint(sh.ID, 10),
strings.Join(nodes, ","), strconv.FormatUint(sh.Index(), 10)})

// Shard may not be local to this node.
var path string
if sh.store != nil {
shardsRow.Columns = append(shardsRow.Columns, "path")
shardsRow.Values[0] = append(shardsRow.Values[0], sh.store.Path())
path = sh.store.Path()
}
shardsRow.Values = append(shardsRow.Values, []interface{}{now, strconv.FormatUint(sh.ID, 10),
strings.Join(nodes, ","), strconv.FormatUint(sh.Index(), 10), path})
}

return []*influxql.Row{
Expand Down

0 comments on commit 257aa4d

Please sign in to comment.