Skip to content

Commit

Permalink
Fixed issues in vtctld's heatmap
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
  • Loading branch information
frouioui committed May 25, 2022
1 parent 63dc0b0 commit 3c0cebc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions go/vt/vtctld/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ import (
"net/http"
"strings"
"time"
"vitess.io/vitess/go/vt/discovery"

"context"

"vitess.io/vitess/go/acl"
"vitess.io/vitess/go/netutil"
"vitess.io/vitess/go/vt/discovery"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/logutil"
"vitess.io/vitess/go/vt/mysqlctl"
"vitess.io/vitess/go/vt/proto/vttime"
"vitess.io/vitess/go/vt/schema"
"vitess.io/vitess/go/vt/schemamanager"
"vitess.io/vitess/go/vt/topo"
Expand All @@ -42,11 +44,9 @@ import (
"vitess.io/vitess/go/vt/workflow"
"vitess.io/vitess/go/vt/wrangler"

"vitess.io/vitess/go/vt/mysqlctl"
logutilpb "vitess.io/vitess/go/vt/proto/logutil"
querypb "vitess.io/vitess/go/vt/proto/query"
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
"vitess.io/vitess/go/vt/proto/vttime"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion go/vt/vtctld/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ import (
"net/http/httptest"
"strings"
"testing"

"vitess.io/vitess/go/vt/discovery"
querypb "vitess.io/vitess/go/vt/proto/query"
"vitess.io/vitess/go/vt/topo/memorytopo"
"vitess.io/vitess/go/vt/wrangler"

querypb "vitess.io/vitess/go/vt/proto/query"
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
vschemapb "vitess.io/vitess/go/vt/proto/vschema"
)
Expand Down
8 changes: 5 additions & 3 deletions go/vt/vtctld/api_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package vtctld
import (
"fmt"
"sort"
"strings"

"vitess.io/vitess/go/vt/discovery"
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
"vitess.io/vitess/go/vt/topo/topoproto"
Expand Down Expand Up @@ -132,7 +134,7 @@ func qps(stat *discovery.TabletHealth) float64 {
func getTabletHealthWithCellFilter(hc discovery.HealthCheck, ks, shard, cell string, tabletType topodatapb.TabletType) []*discovery.TabletHealth {
tabletTypeStr := topoproto.TabletTypeLString(tabletType)
m := hc.CacheStatusMap()
key := fmt.Sprintf("%v.%v.%v.%v", cell, ks, shard, tabletTypeStr)
key := fmt.Sprintf("%v.%v.%v.%v", cell, ks, shard, strings.ToUpper(tabletTypeStr))
if _, ok := m[key]; !ok {
return nil
}
Expand Down Expand Up @@ -208,8 +210,8 @@ func getShardsForKeyspace(healthcheck discovery.HealthCheck, keyspace string) []
if status.Target.Keyspace != keyspace {
continue
}
if _, ok := seenShards[status.Target.Keyspace]; !ok {
seenShards[status.Target.Keyspace] = true
if _, ok := seenShards[status.Target.Shard]; !ok {
seenShards[status.Target.Shard] = true
shards = append(shards, status.Target.Shard)
}
}
Expand Down
7 changes: 3 additions & 4 deletions go/vt/vtctld/vtctld.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ import (
"net/http"
"strings"
"time"
"vitess.io/vitess/go/vt/discovery"
"vitess.io/vitess/go/vt/vtctl"

rice "github.com/GeertJohan/go.rice"

"vitess.io/vitess/go/vt/log"

"vitess.io/vitess/go/acl"
"vitess.io/vitess/go/vt/discovery"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/topo"
"vitess.io/vitess/go/vt/vtctl"
"vitess.io/vitess/go/vt/vtctl/reparentutil"
"vitess.io/vitess/go/vt/wrangler"

Expand Down

0 comments on commit 3c0cebc

Please sign in to comment.