Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion go/vt/discovery/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import (
querypb "github.com/youtube/vitess/go/vt/proto/query"
topodatapb "github.com/youtube/vitess/go/vt/proto/topodata"
"github.com/youtube/vitess/go/vt/topo/topoproto"
"github.com/youtube/vitess/go/vt/topotools"
"github.com/youtube/vitess/go/vt/vttablet/queryservice"
"github.com/youtube/vitess/go/vt/vttablet/tabletconn"
"golang.org/x/net/context"
Expand Down Expand Up @@ -477,7 +478,8 @@ func (hcc *healthCheckConn) processResponse(hc *HealthCheckImpl, shr *querypb.St
// initial message), we want to log it, and maybe advertise it too.
if hcc.tabletStats.Target.TabletType != topodatapb.TabletType_UNKNOWN && hcc.tabletStats.Target.TabletType != shr.Target.TabletType {
// Log and maybe notify
log.Infof("HealthCheckUpdate(Type Change): %v, tablet: %v/%+v, target %+v => %+v, reparent time: %v", oldTs.Name, oldTs.Tablet.Alias.Cell, oldTs.Tablet, oldTs.Target, shr.Target, shr.TabletExternallyReparentedTimestamp)
log.Infof("HealthCheckUpdate(Type Change): %v, tablet: %s, target %+v => %+v, reparent time: %v",
oldTs.Name, topotools.TabletIdent(oldTs.Tablet), topotools.TargetIdent(oldTs.Target), topotools.TargetIdent(shr.Target), shr.TabletExternallyReparentedTimestamp)
if hc.listener != nil && hc.sendDownEvents {
oldTs.Up = false
hc.listener.StatsUpdate(&oldTs)
Expand Down
10 changes: 5 additions & 5 deletions go/vt/discovery/tablet_stats_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ func (tc *TabletStatsCache) StatsUpdate(ts *TabletStats) {
// We already have one up server, see if we
// need to replace it.
if ts.TabletExternallyReparentedTimestamp < e.healthy[0].TabletExternallyReparentedTimestamp {
log.Warningf("not marking healthy master as Up because its externally reparented timestamp is smaller than the highest known timestamp from previous MASTERs: %d < %d ",
ts.TabletExternallyReparentedTimestamp,
e.healthy[0].TabletExternallyReparentedTimestamp,
topoproto.KeyspaceShardString(ts.Target.Keyspace, ts.Target.Shard),
log.Warningf("not marking healthy master %s as Up for %s because its externally reparented timestamp is smaller than the highest known timestamp from previous MASTERs %s: %d < %d ",
topoproto.TabletAliasString(ts.Tablet.Alias),
topoproto.TabletAliasString(e.healthy[0].Tablet.Alias))
topoproto.KeyspaceShardString(ts.Target.Keyspace, ts.Target.Shard),
topoproto.TabletAliasString(e.healthy[0].Tablet.Alias),
ts.TabletExternallyReparentedTimestamp,
e.healthy[0].TabletExternallyReparentedTimestamp)
return
}

Expand Down
6 changes: 6 additions & 0 deletions go/vt/topotools/tablet.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/youtube/vitess/go/vt/topo"
"github.com/youtube/vitess/go/vt/topo/topoproto"

querypb "github.com/youtube/vitess/go/vt/proto/query"
topodatapb "github.com/youtube/vitess/go/vt/proto/topodata"
)

Expand Down Expand Up @@ -113,3 +114,8 @@ func TabletIdent(tablet *topodatapb.Tablet) string {

return fmt.Sprintf("%s-%d (%s%s)", tablet.Alias.Cell, tablet.Alias.Uid, tablet.Hostname, tagStr)
}

// TargetIdent returns a concise string representation of a query target
func TargetIdent(target *querypb.Target) string {
return fmt.Sprintf("%s/%s (%s)", target.Keyspace, target.Shard, target.TabletType)
}